http://stackoverflow.com/q/20734758
tagged with: mysql
has answer: http://stackoverflow.com/a/20735735
type: Question
has title: Mysql 5.5 with hibernate 4 order by is inconsistent
score: 0
answer count: 1
has body: We are using hibernate 4 and mysql 5.5.x with Innodb as our default engine. We have a stored proc that returns some rows by joining a view and a temporary MYISAM temp table that gets created inside the stored proc. The stored proc gets called using hibernate session factory and session and ScrollableResultSet. It returns a list of object arrays. Here is the sample query SELECT col1, col2, col3, col4 FROM view1 v JOIN temptable1 t on t.id = v.id ORDER BY intcol DESC, varcharcol Here is the problem... For rows that have the same intcol value, the secondary order by on the varcharcol is not working properly, they are being returned in jumbled order. Example rows being returned Row1, 10, 'foo' Row2 , 10, 'bar' Row3, 10, 'foo' Row4, 10, 'foo' Row5, 10, 'bar' Has anybody encountered a similar problem? Thanks in advance for your answers.
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/31196899
has text: I would prefer to have the field removed entirely ;) Ethnicity is at least a term that actually can be applied to humans :) Race is only applicable to certain kinds of animals. There already was a correct answer, as far as I remember. What was wrong with it? And can you please add the code for the `Gender` class?
comment on: http://stackoverflow.com/q/20792988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31268476
score: 0
type: AnswerComment
has text: it seems you are the one who got the nail first as is evident from your comment +1 :)
type: Comment
comment on: http://stackoverflow.com/a/20845934

http://stackoverflow.com/comment/31057875
has text: @Borodin I cannot add comment since I have less then 50 reputation :(
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20722451
type: Comment

http://stackoverflow.com/comment/31132833
type: AnswerComment
score: 0
type: Comment
has text: +1 I would start with `int sum = 0;`
comment on: http://stackoverflow.com/a/20771074

http://stackoverflow.com/comment/31025111
has text: @Cako To repeat that point, I predict that when you run with less memory (on an Android device, on a Pi, or anywhere else really) the GC will keep the memory consumption lower to make it fit.
score: 0
comment on: http://stackoverflow.com/q/20711565
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20753309
type: Question
has title: Graphics2D reset Screen?
tagged with: java
has body: I have a Game Tutorial that I followed, that paints String's on the Screen using Graphics2D. It works like a star, but the only problem is that I don't undertstand why. I call draw(graphics) in a game loop and it works fine. I use an int, named currentChoice to keep track of which letter should be Red and which should be Black. Well, I call the method Draw in a loop. I just don't understand how does the graphics clear the previous string it drew. I mean, I call the method constantly, and it keeps on Drawing string's on the window, and its 'clearing' the other ones (if you get what i'm saying). Basicly, I just don't undertstant how it's clearing the screen (NOTE: I am super new to this sort of thing) CODE (I call this in a loop and it works): public void draw(Graphics2D graphics) { bg.draw(graphics); graphics.setColor(titleColor); graphics.setFont(titleFont); graphics.drawString("Peache's Revenge", 50, 70); graphics.setFont(font); for (int i = 0; i &lt; options.length; i++) { if (i == currentChoice) { graphics.setColor(Color.RED); } else { graphics.setColor(Color.BLACK); } graphics.drawString(options[i], 145, 140 + i * 15); } }
score: 0
has comment: http://stackoverflow.com/comment/31100708
has comment: http://stackoverflow.com/comment/31100749
answer count: 1
type: UnansweredQuestion
tagged with: graphics2d
has answer: http://stackoverflow.com/a/20753393

http://stackoverflow.com/a/20680595
type: Answer
has comment: http://stackoverflow.com/comment/30970420
has comment: http://stackoverflow.com/comment/30970875
has comment: http://stackoverflow.com/comment/30970349
upvote count: 1
has body: First at all, you seem to ignore Strings created in read_JSON, but i assume you do this to avoid pasting here too much code. Problem is this line: String child_names = jso3.getString("Nombres_Hijos"); Because fields Nombres_Hijos is JsonArray, not String. To read it use: JSONArray jsa = jso3.getJSONArray("Nombres_Hijos"); Now all depands what you need to do later with this data. Easiest case would be: String names = jsa.toString(); //["Blur","Clur"]
has comment: http://stackoverflow.com/comment/30970241
downvote count: 0
answers question: http://stackoverflow.com/q/20680356
score: 1
has comment: http://stackoverflow.com/comment/30970674

http://stackoverflow.com/comment/31054549
type: Comment
comment on: http://stackoverflow.com/q/20727731
has text: Welcome to SO! If your question is directly related to a language, please tag it with the language.
score: 0
type: QuestionComment

http://stackoverflow.com/q/20811169
has comment: http://stackoverflow.com/comment/31211901
tagged with: performance
score: -2
tagged with: java
downvote count: 5
linked to: http://stackoverflow.com/q/20811061
type: Question
has answer: http://stackoverflow.com/a/20811324
tagged with: arrays
duplicate of: http://stackoverflow.com/q/20811061
has comment: http://stackoverflow.com/comment/31203923
has body: I get a result that sorting time of a Long array using Arrays.sort() is taking more time than sorting a long array using Arrays.sort(). Here is the code. public class ABtest { public static void main(String[] args) { long startTime; long endTime; //code block 1 startTime = System.nanoTime(); Long a[] = new Long[10000]; for (int i = 0; i &lt; a.length; i++) { a[i] = 12l; } Arrays.sort(a); endTime = System.nanoTime(); System.out.println("code block (has Long array) 1 = " + (endTime - startTime)); //code block 2 startTime = System.nanoTime(); long c[] = new long[10000]; for (int i = 0; i &lt; c.length; i++) { c[i] = 12l; } Arrays.sort(c); endTime = System.nanoTime(); System.out.println("code block (has long array) 2 = " + (endTime - startTime)); } } The running times : code block (has Long array) 1 = 3076331 code block (has long array) 2 = 741501 Can anyone explain this behavior. or Am i doing some mistake here ??
has answer: http://stackoverflow.com/a/20811283
tagged with: sorting
favorite count: 0
answer count: 3
has title: Why sorting Long array is slower than sorting long array using Arrays.sort()?
has answer: http://stackoverflow.com/a/20811394
has comment: http://stackoverflow.com/comment/31204028
has comment: http://stackoverflow.com/comment/31204219
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/a/20767348
has comment: http://stackoverflow.com/comment/31125721
has comment: http://stackoverflow.com/comment/31126292
type: Answer
has comment: http://stackoverflow.com/comment/31126572
upvote count: 1
has body: Here are some points that may help you(I hope they do somehow) Array Declarations as for the title of the question In java you can declare array in two ways Variable of array datatype(like int array type) int[] a,b; //both a and b are of integer array type Array variable of some datatype (like int) int c[],d; //both c and d are of int type but only c is array Initialization since it is required We can declare and initialize array as follows int[] a = {1, 2, 3, 4, 5}; // or int b[][] = {{1, 2, 3}, {4, 5, 6}, {1, 3, 5}, {2, 4, 6}}; We can initialize the declared array as follows a[0] = 1; a[1] = 2*a[0]; //or any other expression Things you missed in question or maybe missing in your code/problem graph is array of edges and edges have two vertex and hence intGraph[500][4] should be intGraph[500][2] public GraphCycleFinder(int[][] graphs) {...} should be static if you're calling it in main()and at last closing } is missing as described above. As shoover is saying you must initialize intGraph[j] also. By this we mean in code ..... intGraph[j][0] = Integer.parseInt(edge[i]); intGraph[j][1] = Integer.parseInt(edge[i+1]); intGraph[j][2] = Integer.parseInt(edge[i+2]); .... you are only initializing one dimension within same row or for example if j=1 then you're initializing intGraph[1][0] to intGraph[1][3] only not for all j=0 to 499 except 1. and most probably NPE is encountered because with int [][]intGraph; you're not initializing it all elements and trying to copy uninitialized array in function public GraphCycleFinder(int[][] graphs){graph=graphs;...} and you're not getting it while using int [][]intGraph=new int[500][4]; because you're initializing all elements and no NULL value is there. Hope this helps!!
answers question: http://stackoverflow.com/q/20766313
downvote count: 0
score: 1

http://stackoverflow.com/comment/31125583
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20767391
has text: Technically, it's the value of each variable or member field in a program that is a reference. (The "value of every Java Object" is the object.) Only references are assigned, passed, and returned.
score: 0

http://stackoverflow.com/comment/31224824
has text: Ok, but can please tell me what could cause this error to occur and what needs to be done to mitigate this ?
comment on: http://stackoverflow.com/a/20813820
score: 0
type: AnswerComment
type: Comment

arrays
tags question: http://stackoverflow.com/q/20683665
tags question: http://stackoverflow.com/q/20846540
tags question: http://stackoverflow.com/q/20724059
tags question: http://stackoverflow.com/q/20692590
tags question: http://stackoverflow.com/q/20714949
tags question: http://stackoverflow.com/q/20696213
tags question: http://stackoverflow.com/q/20763250
tags question: http://stackoverflow.com/q/20705826
tags question: http://stackoverflow.com/q/20788016
tags question: http://stackoverflow.com/q/20795158
type: Tag
tags question: http://stackoverflow.com/q/20800140
tags question: http://stackoverflow.com/q/20835473
tags question: http://stackoverflow.com/q/20786995
tags question: http://stackoverflow.com/q/20693884
tags question: http://stackoverflow.com/q/20763347
tags question: http://stackoverflow.com/q/20843057
tags question: http://stackoverflow.com/q/20733780
tags question: http://stackoverflow.com/q/20812093
tags question: http://stackoverflow.com/q/20833606
tags question: http://stackoverflow.com/q/20685677
tags question: http://stackoverflow.com/q/20770344
tags question: http://stackoverflow.com/q/20811593
tags question: http://stackoverflow.com/q/20765334
tags question: http://stackoverflow.com/q/20829647
tags question: http://stackoverflow.com/q/20785586
tags question: http://stackoverflow.com/q/20818712
tags question: http://stackoverflow.com/q/20767066
tags question: http://stackoverflow.com/q/20834953
tags question: http://stackoverflow.com/q/20709177
tags question: http://stackoverflow.com/q/20686951
tags question: http://stackoverflow.com/q/20724860
tags question: http://stackoverflow.com/q/20788399
tags question: http://stackoverflow.com/q/20802945
tags question: http://stackoverflow.com/q/20787099
tags question: http://stackoverflow.com/q/20756822
tags question: http://stackoverflow.com/q/20743250
tags question: http://stackoverflow.com/q/20725761
tags question: http://stackoverflow.com/q/20729220
tags question: http://stackoverflow.com/q/20811169
tags question: http://stackoverflow.com/q/20755326
tags question: http://stackoverflow.com/q/20823416
tags question: http://stackoverflow.com/q/20724250
tags question: http://stackoverflow.com/q/20702878
tags question: http://stackoverflow.com/q/20704339
tags question: http://stackoverflow.com/q/20692500
tags question: http://stackoverflow.com/q/20789768
tags question: http://stackoverflow.com/q/20771106
tags question: http://stackoverflow.com/q/20694610
tags question: http://stackoverflow.com/q/20794401
tags question: http://stackoverflow.com/q/20826010
tags question: http://stackoverflow.com/q/20808658
tags question: http://stackoverflow.com/q/20748280
tags question: http://stackoverflow.com/q/20826972
tags question: http://stackoverflow.com/q/20824708
tags question: http://stackoverflow.com/q/20685907
tags question: http://stackoverflow.com/q/20776319
tags question: http://stackoverflow.com/q/20755296
tags question: http://stackoverflow.com/q/20745311
tags question: http://stackoverflow.com/q/20828786
tags question: http://stackoverflow.com/q/20818985
tags question: http://stackoverflow.com/q/20825560
tags question: http://stackoverflow.com/q/20740444
tags question: http://stackoverflow.com/q/20841313
tags question: http://stackoverflow.com/q/20715481
tags question: http://stackoverflow.com/q/20804698
tags question: http://stackoverflow.com/q/20753401
tags question: http://stackoverflow.com/q/20766313
tags question: http://stackoverflow.com/q/20734750
tag name: arrays
tags question: http://stackoverflow.com/q/20821057
tags question: http://stackoverflow.com/q/20680604
tags question: http://stackoverflow.com/q/20712860
tags question: http://stackoverflow.com/q/20690683
tags question: http://stackoverflow.com/q/20812331
tags question: http://stackoverflow.com/q/20821343
tags question: http://stackoverflow.com/q/20724525
tags question: http://stackoverflow.com/q/20701816
tags question: http://stackoverflow.com/q/20790660
tags question: http://stackoverflow.com/q/20822590

http://stackoverflow.com/comment/31127349
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20765872
has text: Correct, it is script using the code on the page I have added to the end of the original post above

mmap
tags question: http://stackoverflow.com/q/20724902
tag name: mmap
tags question: http://stackoverflow.com/q/20753058
type: Tag

http://stackoverflow.com/a/20724831
upvote count: 3
answers question: http://stackoverflow.com/q/20724604
has body: Rather than drawing images, consider using a grid of JLabels held in a GridLayout for your map's grid, and then simply swapping ImageIcons if you want to change the grid cell's image. For example to combine code from a previous answer of mine and of TrashGod's, check out this implementation: import java.awt.Color; import java.awt.Component; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.util.Random; import javax.swing.*; @SuppressWarnings("serial") public class GridExample extends JPanel { private Ground[][] groundMap = { { Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.DIRT, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER, Ground.WATER }, { Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.GRASS, Ground.DIRT, Ground.DIRT, Ground.DIRT, Ground.DIRT, G…
has comment: http://stackoverflow.com/comment/31049184
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31049264
score: 3
has comment: http://stackoverflow.com/comment/31049257

http://stackoverflow.com/comment/31078298
type: Comment
has text: Just a remark: The line "array = new long [16];" inside do-loop cannot be okay because you are resetting the array every time.
comment on: http://stackoverflow.com/a/20740984
score: 0
type: AnswerComment

http://stackoverflow.com/a/20782587
downvote count: 0
has body: Your input is 26.11.2013 instead of 26/11/2013. Either change the format of the input or change the way you create the SimpleDateFormat SimpleDateFormat(dd/MM/yyyy); to SimpleDateFormat(dd.MM.yyyy); that's why it throws this exception
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/20782524
answers question: http://stackoverflow.com/q/20782524
type: AcceptedAnswer

http://stackoverflow.com/comment/31011526
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20695919
has text: Embarrassed, but my problem was clicking "Run as..." instead of "debug as"... Thanks!

http://stackoverflow.com/comment/31027920
type: QuestionComment
comment on: http://stackoverflow.com/q/20713107
has text: Your class Network should implement Serializable, inorder to participate in Serialization process.
score: 0
type: Comment

jboss
tags question: http://stackoverflow.com/q/20730752
tags question: http://stackoverflow.com/q/20800578
tags question: http://stackoverflow.com/q/20784480
tags question: http://stackoverflow.com/q/20804210
tags question: http://stackoverflow.com/q/20740952
tags question: http://stackoverflow.com/q/20801546
tags question: http://stackoverflow.com/q/20817223
tags question: http://stackoverflow.com/q/20846327
tag name: jboss
tags question: http://stackoverflow.com/q/20838555
tags question: http://stackoverflow.com/q/20683843
type: Tag
tags question: http://stackoverflow.com/q/20813767
tags question: http://stackoverflow.com/q/20752544
tags question: http://stackoverflow.com/q/20703676
tags question: http://stackoverflow.com/q/20700527
tags question: http://stackoverflow.com/q/20747936
tags question: http://stackoverflow.com/q/20692292
tags question: http://stackoverflow.com/q/20801569
tags question: http://stackoverflow.com/q/20788900
tags question: http://stackoverflow.com/q/20827834
tags question: http://stackoverflow.com/q/20818088
tags question: http://stackoverflow.com/q/20742115

http://stackoverflow.com/comment/31048761
type: QuestionComment
comment on: http://stackoverflow.com/q/20724604
score: 1
has text: Consider creating an [sscce](http://sscce.org) that reproduces your problem. Please read the link.
type: Comment

http://stackoverflow.com/comment/31001007
has text: I checked again the dependencies of spring-aspects and couldn't find any milestone repositories ! From where does it download the aspectjweaver 1.8.0.M1 ??
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20698348

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/20738334
tags question: http://stackoverflow.com/q/20772795
tags question: http://stackoverflow.com/q/20830057
tags question: http://stackoverflow.com/q/20750591
tags question: http://stackoverflow.com/q/20703450
tags question: http://stackoverflow.com/q/20705980
tag name: jfreechart

http://stackoverflow.com/comment/31026945
score: 1
comment on: http://stackoverflow.com/q/20712782
type: Comment
type: QuestionComment
has text: I suppose if they change BaseMatcher in the future, they won't break code that is dependent on use of Matcher type objects. I also wonder if it helps with dependency injection (just a wild guess as I'm no pro).

http://stackoverflow.com/comment/31134829
type: Comment
score: 1
has text: `writer = new BufferedWriter(new FileWriter("D:\\master_ship.txt"));` We cannot write to resources in a Jar. They are 'read only'.
comment on: http://stackoverflow.com/q/20772783
type: QuestionComment

http://stackoverflow.com/q/20696512
accepted answer: http://stackoverflow.com/a/20697782
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14210051
has comment: http://stackoverflow.com/comment/30999511
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/30998685
has body: I am stuck with a problem in automating pages having an iframe, http://jqueryui.com/draggable/ Scenario here is to Drag and drop element present INSIDE the iframe element which thus cannot be recognized by WebDriver
answer count: 2
possible better answer: http://stackoverflow.com/a/26903781
score: 0
has title: Handling iframes in WebDriver having no ID or Class property
has answer: http://stackoverflow.com/a/26903781
has comment: http://stackoverflow.com/comment/30997790
tagged with: selenium
has answer: http://stackoverflow.com/a/20697782

http://stackoverflow.com/comment/127997089
has text: Please post detailed answer and then references.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/72404901

http://stackoverflow.com/a/25234558
has comment: http://stackoverflow.com/comment/52159389
type: Answer
downvote count: 8
score: -7
answers question: http://stackoverflow.com/q/20706783
has body: what about simply this: byte[] args2 = getByteArry(); String byteStr = new String(args2);
upvote count: 1

http://stackoverflow.com/comment/31196991
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20807549
type: Comment
has text: logics could be 1. everything from JFileChooser is done on EDT (then invokeLater is very contraproductive), 2. ImageIO.Xxx could be redirected to Runnable#Thread or SwingWorker, 3. :-)

http://stackoverflow.com/comment/31248328
type: AnswerComment
score: 0
has text: because non static / non private methods are virtual, if a method is overridden in subclass when you call it inside super JVM redirects it to subclass method
type: Comment
comment on: http://stackoverflow.com/a/20834671

http://stackoverflow.com/q/20755343
has comment: http://stackoverflow.com/comment/31104479
tagged with: android
has title: Setting layout in Android activity crashes application
has comment: http://stackoverflow.com/comment/31104733
tagged with: opencv
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31104588
has body: I am developing an android application using OpenCV. In my camera activity, when I am setting layout, application crashes. I dont know why my application is behaving abnormally. It crashes randomly.First there was error when instantiated ScanCameraPreview, but now, it crashes while setting layout. CameraActivity.java public CameraActivity() { Log.i(TAG, "Instantiated new " + this.getClass()); } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "called onCreate"); super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_camera); // Crashes here mOpenCvCameraView = (ScanCameraPreview) findViewById(R.id.camera_surface_view); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); //mOpenCvCameraView.setCameraRotation(); ...... } This is my layout &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/camera_activity" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".CameraActivity" &gt; &lt;com.example.androiddms.ScanCameraPreview android:id="@+id/camera_surface_view" android:layout_width="match_parent" android:visibility="gone" android:layout_height="match_parent" /&gt; &lt;/LinearLayout&gt; This is my custom camera view public class ScanCameraPreview extends JavaCameraView { private static final String TAG = "AndroidDms::ScanCameraView"; public ScanCameraPreview(Context context, AttributeSet attrs) { super(context, attrs); Log.d(this.toString(), "Starting camera preview"); //mCamera.getParameters().get } } Please help me. I debugged it carefully pointwise and it crashes at setcontentview. Thanks for your time. Here it is my logcat
has answer: http://stackoverflow.com/a/20755694
score: 0
has comment: http://stackoverflow.com/comment/31104694
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/30985230
type: QuestionComment
has text: But i have to fill the cells with a List of Chars . How does this work
comment on: http://stackoverflow.com/q/20689672
type: Comment
score: 0

http://stackoverflow.com/comment/43435771
type: QuestionComment
type: Comment
has text: @NoughT have u achieved your target succesffully is your decryption algorithm working ??
comment on: http://stackoverflow.com/q/20737376
score: 0

http://stackoverflow.com/q/20845388
tagged with: java
has body: after spending number of hours and trying different things, i can't figure out what is wrong with my code, it's a simple program : ` public class AssignGrades { private int ntotal=0; private int []y; //constructor to initialize class instances AssignGrades(int t) { ntotal = t; //y = num1; } AssignGrades( int []num1) { y=num1; for (int i=0;i&lt;y.length;i++) y[i] = num1[i]; } //method to sort grades int []num1 void setGrades() { int [] y = new int[ntotal]; for (int i=0;i&lt;y.length;i++) { //assign grades if (y[i]&lt;80){ System.out.println("grade is A" +y[i]);} else if (y[i]&lt;70) System.out.println("grade is B" +y[i]); else if (y[i]&lt;60) System.out.println("grade is c" +y[i]); else System.out.println("FAIL" +y[i]); } } //show student grades - to print array[] values void showGrades() { for (int u: y) System.out.println(u); } }` my client program `import java.util.Scanner; public class AssignGradesDemo { public static void main(String[] args) { // TODO Auto-generated method stub int t=0; System.out.println("enter no of students" ); Scanner input = new Scanner(System.in); { t=input.nextInt(); // input.close(); } int [] num1 = new int[t]; System.out.println("enter grades"); Scanner input1 = new Scanner(System.in); for (int i=0;i&lt;num1.length;i++) { num1[i]=input1.nextInt(); } input1.close(); AssignGrades ag = new AssignGrades(t); AssignGrades ag1 = new AssignGrades( num1); ag.setGrades(); ag1.showGrades(); } } output is: enter no of students 2 enter grades 78 98 grade is A0 grade is A0 78 98 Question: now in the output 'A' and '0' -> where the problem is, it looks like array is not initialized, all the values appear to be zero: whereas when I print them separately, they are initialized.?! Please let me know if more clarification is required. thanks
score: 0
has comment: http://stackoverflow.com/comment/31267175
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/20845424
has comment: http://stackoverflow.com/comment/31267206
has answer: http://stackoverflow.com/a/20845424
has title: unexpected results - can please some one point the mistake
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/31100526
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20753178
has text: [This answer](http://stackoverflow.com/a/4262716/877472) I believe shows how you can update the JList using the list's model object (rather than creating an entirely new JList).

http://stackoverflow.com/q/20719191
linked to: http://stackoverflow.com/q/20554762
favorite count: 0
has body: the fact is that I'm trying to code an app that is able to graph math functions. The code makes graphics of square functions and is fine. My problem is that I want to make cubic functions. This is my code so far: import java.awt.Color; import java.awt.Graphics; import javax.swing.BorderFactory; import javax.swing.JPanel; public class plano extends JPanel{ public plano() { init(); } public void init() { this.setBorder(BorderFactory.createLineBorder(Color.black)); } @Override public void paintComponent( Graphics g ) { super.paintComponent(g); g.setColor(Color.red); g.drawLine(0, this.getHeight()/2, this.getWidth(), this.getHeight()/2); g.drawLine(this.getWidth()/2, 0,this.getWidth()/2 , this.getHeight()); } // y=c*x2 +c*x +c public void paintSQRFunc(Graphics g,double x3mult, double x2mult, double x1mult,double cons, double x1,double x2) { for(double i=x1;i&lt;x2;i++) { double y = ((double)Math.cbrt(i)*x3mult)+((double)Math.pow(i,2)*x2mult)+i*x1mult+cons; double xp = i+1; double yp = ((double)Math.cbrt(xp)*x3mult)+((double)Math.pow(xp,2)*x2mult)+xp*x1mult+cons; g.drawLine((int)coord_x(i), (int)coord_y(y), (int)coord_x(xp), (int)coord_y(yp)); } } private double coord_x(double x) { double real_x = x+this.getWidth()/2; return real_x; } private double coord_y(double y) { double real_y = -y+this.getHeight()/2; return (real_y); } } And then the main class where I call the methods: import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.event.ActionListener; import graficadora.Graficadora; public class Ventana extends JFrame implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { Graficadora.plano.paintSQRFunc(Graficadora.plano.getGraphics(),1,1,0,0,-200,200); As you see, I tried to make it able to graph cubic functions. When I set the parameters to graph a cubic function, there is my mistake: (It is supposed to graph y=x^3. The graph appears to be tilted in 90º.)
linked to: http://stackoverflow.com/q/20086441
has comment: http://stackoverflow.com/comment/31038558
has title: best way to graph cubic functions in java
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/13205251
has answer: http://stackoverflow.com/a/20720963
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: graph
accepted answer: http://stackoverflow.com/a/20720963
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31074901
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20739027
has text: I tried doing that but inside the onclicklistener it says Cannot refer to a non-final variable correctAnswer inside an inner class defined in a different method
score: 0

http://stackoverflow.com/comment/31109350
comment on: http://stackoverflow.com/q/20757100
score: 1
has text: Have you checked the closeness values before the normalization? NaN can be returned for 0/0 for example.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20682361
type: Question
type: AnsweredQuestion
has title: Webservice unavailable when packaged in EAR
has answer: http://stackoverflow.com/a/20682786
accepted answer: http://stackoverflow.com/a/20682786
has body: We have a webservice which is included in an ejb-jar within an ear. That jar is then deployed to a JBoss 7.2.0.Final instance. According to this JBoss documentation using webservice annotations on the session bean should be sufficient. Thus the webservice looks like this: @WebService(name = "TestWS", targetNamespace="http://test.com/ws") @WebContext(contextRoot="/test-ws", urlPattern="/*", transportGuarantee="NONE", secureWSDLAccess=false) @Stateless public class TestWS { @WebMethod public String sayHello() { return "hello"; } } When the ear is deployed exploded everything works fine. The problem is, when deploying the packaged ear (.ear-file) the service doesn't seem to be available. Management console displays this information in both cases: Context: test-ws Type: JAXWS_EJB3 WSDL Url: http://localhost:8080/test-ws?wsdl During startup the following is logged in both cases: [org.jboss.ws.cxf.metadata] (MSC service thread 1-4) JBWS024061: Adding service endpoint metadata: id=TestWS address=http://localhost:8080/test-ws implementor=com.test.TestWS serviceName={http://test.com/ws}TestWSService portName={http://test.com/ws}TestWSPort annotationWsdlLocation=null wsdlLocationOverride=null mtomEnabled=false ... [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-9) Setting the server's publish address to be http://localhost:8080/test-ws When the ear is exploded opening http://localhost:8080/test-ws?wsdl retrieves the wsdl, when the ear is packaged, I get the following result: JBWEB000065: HTTP Status 404 - /test-ws JBWEB000309: type JBWEB000067: Status report JBWEB000068: message /test-ws JBWEB000069: description JBWEB000124: The requested resource is not available. Any ideas what might be missing?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/30971545
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/30974748
favorite count: 0
has comment: http://stackoverflow.com/comment/30972929
has comment: http://stackoverflow.com/comment/30973687
has comment: http://stackoverflow.com/comment/30972831
score: 1
tagged with: java
upvote count: 1
tagged with: web-services

http://stackoverflow.com/comment/31200900
comment on: http://stackoverflow.com/q/20809545
type: Comment
score: 1
type: QuestionComment
has text: If you step through this with a debugger, you will most likely see your error immediately.

http://stackoverflow.com/comment/31268178
type: Comment
comment on: http://stackoverflow.com/a/20820072
score: 0
type: AnswerComment
has text: My question was originally tagged `java`. Today I tried converting your answer into the Java version of it (//// instead of //) but I didn't success with the `\d`, do you know the correct, full Java syntax for this regex string?

http://stackoverflow.com/q/20712223
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20712323
type: Question
tagged with: reddit
downvote count: 0
has comment: http://stackoverflow.com/comment/31025961
favorite count: 0
has body: So I have been googling how to download images and not getting very well written explanations, just code examples. I don't completely understand some of this code, mainly with the for (int b; (b = is.read()) != -1;) { os.write(b); } Can someone explain this above code like I am five, and also any alternatives to this method. EDIT2 import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Downloader { static String path = "C:\\reddit\\"; public static void main(String[] args) { connect(); } private static void download(String imageURL, int i) { InputStream is = null; OutputStream os = null; try { URL url = new URL(imageURL); is = url.openStream(); os = new FileOutputStream(path + i + ".jpg"); for (int b; (b = is.read()) != -1;) { os.write(b); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (is != null) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } if (os != null) { try { os.close(); } catch (IOException e) { e.printStackTrace(); } } } } public static void connect() { try { Document doc = Jsoup.connect("http://www.reddit.com/r/pics").get(); Elements url = doc.select("a"); int i = 0; for (Element img : url) { if (img.attr("href").startsWith("http://imgur.com/")) { String image = img.attr("abs:href")+".jpg"; System.out.println(image); i++; System.out.println(i); download(image, i); } } } catch (IOException e) { System.out.println("page scrape fail"); } } } EDIT I noticed my output is not right, its writing duplicates, I will just post my console result http://imgur.com/f7rW2Of 1 http://imgur.com/f7rW2Of 2 http://imgur.com/35jpkez 3 http://imgur.com/35jpkez 4 http://…
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31026318
upvote count: 1
has title: downloading images from reddit with java errors
has comment: http://stackoverflow.com/comment/31026184

http://stackoverflow.com/a/20822023
type: Answer
answers question: http://stackoverflow.com/q/20821866
type: AcceptedAnswer
score: 0
has body: This was the culprit: To have the system accept the URL, I'm changing the &amp; character in the URL parameter to be &amp;amp; For some reason the system wasn't accepting a URL without that change, but it seems to be fine now.
accepted answer of: http://stackoverflow.com/q/20821866

http://stackoverflow.com/comment/112144650
type: AnswerComment
comment on: http://stackoverflow.com/a/61336264
type: Comment
has text: I'm not sure what you mean in your last question. Are you referring to array types' `toString` result?
score: 0

http://stackoverflow.com/q/20689074
duplicate of: http://stackoverflow.com/q/4412179
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/30984098
has body: private int mCurrentIndex = 0; mPrevButton = (Button)findViewById(R.id.prev_button); mPrevButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCurrentIndex = (-33 % 5); Log.i("IndexClick", String.valueOf(mCurrentIndex)); } }); This is returning -3 instead of a 2. It does the math right with a positive number. Please help can't seem to find a solution.
linked to: http://stackoverflow.com/q/4412179
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20689116
tagged with: android
has title: Why is this returning the wrong modulo answer?
has comment: http://stackoverflow.com/comment/30984202
tagged with: java
has comment: http://stackoverflow.com/comment/30984048
type: Question
has answer: http://stackoverflow.com/a/20689198
has comment: http://stackoverflow.com/comment/30984136

http://stackoverflow.com/comment/31055241
has text: A tool like Maven or Gradle will handle all of this for you automatically.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20728246

http://stackoverflow.com/comment/31170753
has text: Thanks for the help. I decided to run it outside Eclipse.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20792925
type: Comment

http://stackoverflow.com/a/51423563
score: -2
upvote count: 0
type: Answer
has body: Might be a bit off topic but this is what we have for List&lt;T&gt; rather than Stream&lt;T&gt;. First you need to have a take util method. This methods takes first n elements: static &lt;T&gt; List&lt;T&gt; take(List&lt;T&gt; l, int n) { if (n &lt;= 0) { return newArrayList(); } else { int takeTo = Math.min(Math.max(n, 0), l.size()); return l.subList(0, takeTo); } } it just works like scala.List.take assertEquals(newArrayList(1, 2, 3), take(newArrayList(1, 2, 3, 4, 5), 3)); assertEquals(newArrayList(1, 2, 3), take(newArrayList(1, 2, 3), 5)); assertEquals(newArrayList(), take(newArrayList(1, 2, 3), -1)); assertEquals(newArrayList(), take(newArrayList(1, 2, 3), 0)); now it will be fairly simple to write a takeWhile method based on take static &lt;T&gt; List&lt;T&gt; takeWhile(List&lt;T&gt; l, Predicate&lt;T&gt; p) { return l.stream(). filter(p.negate()).findFirst(). // find first element when p is false map(l::indexOf). // find the index of that element map(i -&gt; take(l, i)). // take up to the index orElse(l); // return full list if p is true for all elements } it works like this: assertEquals(newArrayList(1, 2, 3), takeWhile(newArrayList(1, 2, 3, 4, 3, 2, 1), i -&gt; i &lt; 4)); this implementation iterate the list partially for a few times but it won't add add O(n^2) operations. Hope that's acceptable.
answers question: http://stackoverflow.com/q/20746429
downvote count: 2

http://stackoverflow.com/comment/31073161
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20737858
has text: I managed to send the filename as String through Socket. My Code was: PrintWriter pw = new PrintWriter(socket.getOutputStream(), true); pw.print(fileName); However, the file came empty this time! Should I post the code?
type: AnswerComment

http://stackoverflow.com/q/20686164
downvote count: 0
accepted answer: http://stackoverflow.com/a/20977433
score: 4
tagged with: rest
favorite count: 0
tagged with: interceptor
has title: Is it possible to register a CXF Interceptor in more than one Phases?
has body: I have a CXF Rest Service and I am trying to create a logging mechanism that will log specific request and response details. All the details I want to be written into a file in one write. As a result I am looking forward to create an Interceptor that will be invoked in the RECEIVE and in the SEND phase. Until now I haven't find any way to do it. Is it possible to create an Interceptor registered in two phases of two different chains? Thanks
has answer: http://stackoverflow.com/a/20977433
type: AnsweredQuestion
tagged with: cxf
tagged with: java
type: Question
upvote count: 4
answer count: 1

http://stackoverflow.com/q/20763084
type: Question
tagged with: jakarta-ee
tagged with: dependency-injection
has title: Why I can't inject multiple instances of a bean?
tagged with: java
has answer: http://stackoverflow.com/a/20763327
accepted answer: http://stackoverflow.com/a/20763327
has body: I have two beans: one manage a single stock, other manage the movements between two stocks. So, in the MovStock bean I have: @EJB private Stock stock1; @EJB private Stock stock2; [...] public void setStocks(int idStock1, int idStock2) { stock1.loadStock(idStock1); stock2.loadStock(idStock2); } somewhere in my code, on another bean, I do: @EJB private MovStock movStock; [...] movStock.setStocks(10,20); but it result in stock1 and stock2 to hold the same stock (20). Surely I'm doing something wrong, but what's the correct way to use multiple instance of the same bean that use @PersistenceContext, etc? thank you
upvote count: 1
answer count: 1
tagged with: jpa
tagged with: javabeans
favorite count: 0
has comment: http://stackoverflow.com/comment/31117859
has comment: http://stackoverflow.com/comment/31117989
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/a/20979259
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/20810928
score: 6
has body: I would first send a packet to all servers you want to ask if they are there, then let all servers respond. Since you want to find out how to receive the packages, here is how i would do that: long responseTimeout = 4000; long start = System.currentTimeMillis(); while(true){ long now = System.currentTimeMillis(); if(now - start &lt; responseTimeout){ datagramSocket.setSoTimeout((int) (responseTimeout - (now - start)); }else{ break; } try{ datagramSocket.receive(packet); addOnlineServer(packet.getAddress()); }catch(SocketTimeoutException e){ break; } } For a certain amount of time your android client should wait for responses, and add each ip of the received package to a list of online servers. Sure some of the packages could get lost as you are using UDP, but that's what you get. If you want to be sure that no packages get lost, use TCP instead.

java
tags question: http://stackoverflow.com/q/20713160
tags question: http://stackoverflow.com/q/20741969
tags question: http://stackoverflow.com/q/20683502
tags question: http://stackoverflow.com/q/20755556
tags question: http://stackoverflow.com/q/20697440
tags question: http://stackoverflow.com/q/20694226
tags question: http://stackoverflow.com/q/20752143
tags question: http://stackoverflow.com/q/20814946
tags question: http://stackoverflow.com/q/20804235
tags question: http://stackoverflow.com/q/20765746
tags question: http://stackoverflow.com/q/20768366
tags question: http://stackoverflow.com/q/20718169
tags question: http://stackoverflow.com/q/20795373
tags question: http://stackoverflow.com/q/20781987
tags question: http://stackoverflow.com/q/20841038
tags question: http://stackoverflow.com/q/20771026
tags question: http://stackoverflow.com/q/20839667
tags question: http://stackoverflow.com/q/20680216
tags question: http://stackoverflow.com/q/20783892
tags question: http://stackoverflow.com/q/20737191
tags question: http://stackoverflow.com/q/20807093
tags question: http://stackoverflow.com/q/20723320
tags question: http://stackoverflow.com/q/20745210
tags question: http://stackoverflow.com/q/20795527
tags question: http://stackoverflow.com/q/20816197
tags question: http://stackoverflow.com/q/20751835
tags question: http://stackoverflow.com/q/20772239
tags question: http://stackoverflow.com/q/20771245
tags question: http://stackoverflow.com/q/20745782
tags question: http://stackoverflow.com/q/20704767
tags question: http://stackoverflow.com/q/20815198
tags question: http://stackoverflow.com/q/20817250
tags question: http://stackoverflow.com/q/20775487
tags question: http://stackoverflow.com/q/20693046
tags question: http://stackoverflow.com/q/20760575
tags question: http://stackoverflow.com/q/20839242
tags question: http://stackoverflow.com/q/20839199
tags question: http://stackoverflow.com/q/20779583
tags question: http://stackoverflow.com/q/20685501
tags question: http://stackoverflow.com/q/20740678
tags question: http://stackoverflow.com/q/20840762
tags question: http://stackoverflow.com/q/20846121
tags question: http://stackoverflow.com/q/20743990
tags question: http://stackoverflow.com/q/20802808
tags question: http://stackoverflow.com/q/20847711
tags question: http://stackoverflow.com/q/20750749
tags question: http://stackoverflow.com/q/20771493
tags question: http://stackoverflow.com/q/20809788
tags question: http://stackoverflow.com/q/20693141
tags question: http://stackoverflow.com/q/20846492
tags question: http://stackoverflow.com/q/20681352
tags question: http://stackoverflow.com/q/20721576
tags question: http://stackoverflow.com/q/20832626
tags question: http://stackoverflow.com/q/20775604
tags question: http://stackoverflow.com/q/20778955
tags question: http://stackoverflow.com/q/20747283
tags question: http://stackoverflow.com/q/20756007
tags question: http://stackoverflow.com/q/20781351
tags question: http://stackoverflow.com/q/20799178
tags question: http://stackoverflow.com/q/20799913
tags question: http://stackoverflow.com/q/20838011
tags question: http://stackoverflow.com/q/20826711
tags question: http://stackoverflow.com/q/20679925
tags question: http://stackoverflow.com/q/20786571
tags question: http://stackoverflow.com/q/20832685
tags question: http://stackoverflow.com/q/20739462
tags question: http://stackoverflow.com/q/20721561
tags question: http://stackoverflow.com/q/20713059
tags question: http://stackoverflow.com/q/20726737
tags question: http://stackoverflow.com/q/20843815
tags question: http://stackoverflow.com/q/20725308
tags question: http://stackoverflow.com/q/20782877
tags question: http://stackoverflow.com/q/20788399
tags question: http://stackoverflow.com/q/20775968
tags question: http://stackoverflow.com/q/20743901
tags question: http://stackoverflow.com/q/20829590
tags question: http://stackoverflow.com/q/20832462
tags question: http://stackoverflow.com/q/20695014
tags question: http://stackoverflow.com/q/20834468
tags question: http://stackoverflow.com/q/20708749

http://stackoverflow.com/a/20729850
score: 0
type: Answer
has body: You need to format the double at the time of print.If you tried at var() function and then assign with double deviation then it will give numberformatException due to special character that returns by Var().You can run this code It will give you the output. public static void main(String[] args) throws ParseException { Scanner s = new Scanner(System.in); double[]x = new double[10]; int i; for(i = 0;i &lt; 2; i++){ x[i] = s.nextDouble(); } double mean = mean(x, i); double deviation = var(x); DecimalFormat myFormatter = new DecimalFormat("#,##0.00"); System.out.println("The mean is " + mean); System.out.println("The standard deviation is " +myFormatter.format(deviation)); } public static double sum(double[] a) { double sum = 0.0; for (int i = 0; i &lt; a.length; i++) { sum += a[i]; } return sum; } public static double mean(double[]x, double i){ if (x.length == 0) return Double.NaN; double sum = sum(x); return sum / x.length; } public static double var(double[] x) { if (x.length == 0) return Double.NaN; double avg = mean(x, 10); double sum = 0.0; for (int i = 0; i &lt; x.length; i++) { sum += (x[i] - avg) * (x[i] - avg); } return sum / Math.sqrt(x.length - 1); }
answers question: http://stackoverflow.com/q/20726531

http://stackoverflow.com/q/20826711
has answer: http://stackoverflow.com/a/20826812
score: 0
answer count: 2
has title: the value contained in my defined object, overwrites the value of my already-defined objects
possible better answer: http://stackoverflow.com/a/20826760
has answer: http://stackoverflow.com/a/20826760
accepted answer: http://stackoverflow.com/a/20826812
type: AnsweredQuestion
tagged with: java
has body: In my first statement, it printed out the values of hx, matrix hx = X.times(theta); System.out.println("Value of hx: "); for (int i =0; i&lt; hx.getRowdimension(); i++) { for (int j = 0; j&lt; hx.getColdimension(); j++) { System.out.println(hx.getArray()[i][j]); } } but in my second statement, log_hx overwrites the value of hx. why is that and how to get rid of it? matrix log_hx = MathUtility.matrixLog(hx); System.out.println("Value of hx: "); for (int i =0; i&lt; hx.getRowdimension(); i++) { for (int j = 0; j&lt; hx.getColdimension(); j++) { System.out.println(hx.getArray()[i][j]); } } Here's my MathUtility class: public final class MathUtility { public static matrix matrixLog(matrix B) { int m = B.getRowdimension(); int n = B.getColdimension(); double[][] C = B.getArray(); for (int i = 0; i&lt; m; i++) { for (int j = 0; j&lt; n; j++) { C[i][j] = Math.log(C[i][j]); } } return new matrix(C); } }
type: Question
tagged with: object
tagged with: oop
tagged with: math
tagged with: class

http://stackoverflow.com/comment/51252977
has text: i think that your question is related to mine http://stackoverflow.com/questions/30908632/is-it-possible-to-use-jax-ws-with-a-generic-interface
comment on: http://stackoverflow.com/q/20748079
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/30969796
comment on: http://stackoverflow.com/q/20681364
has text: I think `AbstractService<? super BaseResponse> myservice = new FirstService()` should do the trick isn't so?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31133290
type: AnswerComment
score: 0
type: Comment
has text: Well said, so using separate packages of Java EE project is a recipe for disaster unless someone really know what he is doing, it requires advanced knowledge of EJB technology. I have been using the java web project so far and I have found it easy. Any way thanks for the concise answer.
comment on: http://stackoverflow.com/a/20758138

http://stackoverflow.com/q/20702909
tagged with: nutch
upvote count: 1
has comment: http://stackoverflow.com/comment/31026042
type: Question
has body: Been trying to parse PDF documents with Nutch and Tika (PDFBox 1.8.3). Out of the 5 PDF's I have attempted to parse using: danny@Ubuntu-64:~/Nutch$ ./bin/nutch parsechecker file:///home/danny/Documents/DOC-443.pdf The only output I get is: fetching: file:///home/danny/Documents/DOC-443.pdf parsing: file:///home/danny/Documents/DOC-443.pdf contentType: application/pdf signature: 662453bc32a42af13cb4d5844d978cfc --------- Url --------------- file:///home/danny/Documents/DOC-443.pdf --------- Metadata --------- xmpTPg:NPages : 0 Content-Type : application/pdf My hadoop.log is: 2013-12-20 11:29:41,646 INFO parse.ParserChecker - fetching: file:///home/danny/Documents/DOC-443.pdf 2013-12-20 11:29:42,174 INFO crawl.SignatureFactory - Using Signature impl: org.apache.nutch.crawl.MD5Signature 2013-12-20 11:29:42,209 INFO parse.ParserFactory - The parsing plugins: [org.apache.nutch.parse.tika.TikaParser] are enabled via the plugin.includes system property, and all claim to support the content type application/pdf, but they are not mapped to it in the parse-plugins.xml file 2013-12-20 11:29:42,518 WARN pdfparser.PDFParser - Parsing Error, Skipping Object java.io.IOException: expected='endstream' actual='' org.apache.pdfbox.io.PushBackInputStream@2d4b2312 at org.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:604) at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:605) at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:194) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1224) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1189) at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:123) at org.apache.nutch.parse.tika.TikaParser.getParse(TikaParser.java:116) at org.apache.nutch.parse.ParseCallable.call(ParseCallable.java:36) at org.apache.nutch.parse.ParseCallable.call(ParseCallable.java:23) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(F…
has comment: http://stackoverflow.com/comment/31498950
has title: Nutch 2.2.1 PDF parse
tagged with: hadoop
has comment: http://stackoverflow.com/comment/31075973
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
has comment: http://stackoverflow.com/comment/35268405
tagged with: parsing
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31198898
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/31019851
type: AnswerComment
has text: That means that this method returns an object of type `Crab`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20708637

http://stackoverflow.com/q/20843246
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/20893788
has comment: http://stackoverflow.com/comment/73262858
has answer: http://stackoverflow.com/a/20843307
has title: GAE detect running place at localhost or appspot
favorite count: 0
upvote count: 2
answer count: 2
has body: I have GAE Application. It uses Oauth 2.0 protocol. I use Java library at the moment. At the moment, I manually switch the redirect URL. When I'm testing on localhost I use localhost:8888/oauth2callback And when I deploy app, I set example.appspot.com/oauth2callback. So how can I detect, if the app is running on the localhost or is deployed ?
tagged with: java
accepted answer: http://stackoverflow.com/a/20843307
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/20893788
linked to: http://stackoverflow.com/q/1993199
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/31223161
type: QuestionComment
score: 0
has text: java code is wrote by parter company, I can't change it, but I need to implement a decryption method in ruby, then I can send http request which can processed by them, I stuck here a long time...
type: Comment
comment on: http://stackoverflow.com/q/20811912

http://stackoverflow.com/comment/31154274
type: AnswerComment
has text: Try to do the same thing as what I did for commons-codec but for the javax library. You should add a newer version of javax inside your application. But it could be a little bit more complicated since the conflict is inside the EWS Java API. You probably must download source of the EWS API and rename the package of Javax classes (by adding a prefix for example) and then compile the library yourself.
type: Comment
comment on: http://stackoverflow.com/a/20781825
score: 0

http://stackoverflow.com/q/20731975
upvote count: 1
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/31064843
has comment: http://stackoverflow.com/comment/31064454
has title: Android Studio gradle manifest merging failed
has comment: http://stackoverflow.com/comment/31074552
has body: After trying to run a project, an error appears: Gradle: [AndroidManifest.xml:6, AndroidManifest.xml:3] Main manifest has &lt;uses-sdk android:minSdkVersion='14'&gt; but library uses minSdkVersion='19' Gradle: Execution failed for task ':myApp:processDebugManifest'. &gt; Manifest merging failed. See console for more info. build.gradle: buildscript { repositories { maven { url 'http://repo1.maven.org/maven2' } } dependencies { classpath 'com.android.tools.build:gradle:0.6+' } } apply plugin: 'android' dependencies { compile files('libs/android-support-v4.jar') compile files('libs/google-play-services.jar') compile files('libs/systembartint.jar') compile project(':GooglePlayServices') } android { compileSdkVersion 17 buildToolsVersion '17.0.0' defaultConfig { minSdkVersion 14 targetSdkVersion 19 } } Manifest: &lt;uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /&gt; Used libraries: Google Maps, Android Support v4, SystemBarTint. Looks like there is a minSdkVersion=19 in Manifest of library. But what's the name of that library? Google Maps is a module with minSdk 14 and target 19. SystemBarTint with minSdk 10, I think. If I have to change manifest of library, how can I do it in jar file?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20816694
favorite count: 0
tagged with: android-4.4-kitkat
tagged with: android
tagged with: android-studio
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20816694

http://stackoverflow.com/q/20782600
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31166882
score: 0
has body: I work with jsp and I want to display date in this format for example : 2013:08:18 I try with this code : &lt;%= new java.util.Date().getDay()+ ":" +new java.util.Date().getMonth()+":"+new java.util.Date().getYear() %&gt; but when test I have this format : 4:11:113 tha same think for hour : I want to have this format : 09:30:15 I try with this code : &lt;%= new java.util.Date().getHours()+ ":" +new java.util.Date().getMinutes()+":"+new java.util.Date().getSeconds() %&gt; but when I test I have this format : 10:6:26
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31166844
tagged with: date
has title: How to display date in yyyy:MM:dd format in jsp?
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/20782854
has answer: http://stackoverflow.com/a/20782834

http://stackoverflow.com/a/20785025
answers question: http://stackoverflow.com/q/20784954
score: 0
has body: Date is for holding a specific instant in time value. Calendar is for date / time manipulation such as getting day of weeek etc
type: Answer

http://stackoverflow.com/comment/31183263
score: 0
type: Comment
type: QuestionComment
has text: i edited the my question
comment on: http://stackoverflow.com/q/20789418

http://stackoverflow.com/q/20784407
tagged with: java
has body: How can I achieve SSL connection to mssql server through a java program for testing purpose using self-signed certificate? Currently I have tried connection using connection string as follows: String dbUrl = "jdbc:sqlserver://" + server + ":" + port + ";databaseName=" + database + ";user="+ username + ";password=" + password + ";encrypt="+true + ";integratedSecurity="+true + ";trustServerCertificate="+false + ";hostNameInCertificate=?" + ";trustStore=?;trustStorePassword=?"; I am now confused what should be placed at "?" position in the connection string above. Also I am able to connect with mssql from management studio by following approach: To Create a Self Signed Certificate: Go to Control Panel Administrative tools IIS Manager Server Certificates Then on server certificate, on right Panel, Click Create self-signed certificate and Give Friendly Name. > OK. Now certificate is ready. Open MMC, by typing mmc in cmd Add/Remove Snap in Choose Certificate Add Next, Choose Local Computer, Finish,OK Expand Certificates, Personal, Certificates, we can see recently added certificate. Select certificate, Right Click, All Tasks, Manage Private Keys Add MSSQL User, add give read permission. Now open SQL Server Configuration Manager SQL server network configuration, properties Set Force Encryption to Yes, In certificate Tab, Choose the Certificate recently added Restart SQL Server Services. Try encryption connection to database and connect. But how to connect it with java program? What should be kept in trustStore and trustStorePassword fields? Working Environment: Windows 8, and mssql server 2012
tagged with: ssl
has answer: http://stackoverflow.com/a/31049241
type: Question
score: 5
has answer: http://stackoverflow.com/a/78101982
downvote count: 0
tagged with: ssl-certificate
favorite count: 0
tagged with: sql-server
answer count: 3
has answer: http://stackoverflow.com/a/77731726
type: UnansweredQuestion
has title: SSL Connection to mssql from a Java Program
upvote count: 5

http://stackoverflow.com/comment/31238563
score: 1
comment on: http://stackoverflow.com/q/20829716
has text: This looks fine to me. So you're sayin that the value of the `meta` array is null after the `scrape` method returns? If so do you want to post your `scrape` method.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31019228
has text: Am I understood your question correctly.?
type: QuestionComment
comment on: http://stackoverflow.com/q/20708635
type: Comment
score: 0

http://stackoverflow.com/q/20842847
tagged with: locale
score: 0
answer count: 1
has title: Set custom currency sign using locale
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20843084
has body: I have code that formats default locale currency symbol (correct me if I'm wrong): String df = NumberFormat.getCurrencyInstance().getCurrency().getSymbol(); String dfs = NumberFormat.getCurrencyInstance().format(11); System.out.println(df + " "+ dfs ); Output $ $11.00 I would like to have custom currency symbol instead of $. I have changed currency symbol in locale file I found in my Debian under /usr/share/i18n/locales. Unfortunately this change has no influence on code output. How to solve this problem?
tagged with: java
linked to: http://stackoverflow.com/q/9982537
has comment: http://stackoverflow.com/comment/31262612
type: Question

http://stackoverflow.com/q/20786105
has title: Intent within same Activity - Android
type: AnsweredQuestion
score: 3
has body: I have this Java code in a file which is a mix and match of two files. The original existing code + code for graphing random data. (Thanks to Dan and keshav for helping to get that working). The graph displays on the app plotting random data. I would like to change the random data to my data. I have external accelerometer values as doubles further back in the app, and would like to use these values for the graph. Code where doubles are now, being written to file: @Override public void onDataRecieved(TiSensor&lt;?&gt; sensor, String text) { if (sensor instanceof TiAccelerometerSensor) { final TiAccelerometerSensor accSensor = (TiAccelerometerSensor) sensor; float[] values = accSensor.getData(); renderer.setRotation(values); viewText.setText(text); /** * The code here, when button clicked, adds the contents of the * edittext to the same file as x, y, and z */ Button confirmButton = (Button) findViewById(R.id.baddNametoFile); confirmButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { try { EditText bodyText; bodyText = (EditText) findViewById(R.id.ETName); // bodyText.setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS); // CAPS LOCK String name = bodyText.getText().toString(); PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter( "/sdcard/YS Data/Accelerometer.html", true))); out.println("&lt;hr&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;h2 style=padding-left:20px;&gt;" + name + "'s Data below" + "&lt;/h2&gt;&lt;br&gt;"); out.flush(); // new arraylist out.close(); } catch (IOException e) { Log.e(TAG, "Could not write file " + e.getMessage()); e.printStackTrace(); } } }); /** * Code Below is for splitting the string (text) into three strings * (x,y,z) of just numbers and then printing them to a file */ double doubx; double douby; double doubz; String accval = text; try { PrintWriter writer = new PrintWriter(new BufferedWriter( new FileWriter("sdcard/YS Data/Accelerometer.html", true))); String[] tempArr = accval.split("\\s…
downvote count: 0
accepted answer: http://stackoverflow.com/a/20787040
favorite count: 0
type: Question
tagged with: double
answer count: 2
tagged with: android
tagged with: android-intent
tagged with: achartengine
possible better answer: http://stackoverflow.com/a/20786194
has answer: http://stackoverflow.com/a/20786194
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20787040

http://stackoverflow.com/a/20827477
has body: This class (if taken as is) is NOT thread safe. In two words: there is reordering of instructions in java (Instruction reordering &amp; happens-before relationship in java) and when in your code you're instantiating MyClass, under some circumstances you may get following set of instructions: Allocate memory for new instance of MyClass; Return link to this block of memory; Link to this not fully initialized MyClass is available for other threads, they can call "methodCalledByOtherThreads()" and get NullPointerException; Initialize internals of MyClass. In order to prevent this and make your MyClass really thread safe - you either have to add "final" or "volatile" to the "obj" field. In this case Java's memory model (starting from Java 5 on) will guarantee that during initialization of MyClass, reference to alocated for it block of memory will be returned only when all internals are initialized. For more details I would strictly recommend you to read nice book "Java Concurrency in Practice". Exactly your case is described on the pages 50-51 (section 3.5.1). I would even say - you just can write correct multithreaded code without reading that book! :)
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20810210
downvote count: 0

http://stackoverflow.com/comment/31169139
score: 0
type: Comment
type: QuestionComment
has text: Toast : Uppercase T, is the class Toast; toast : all lowercase, is an instance of the class
comment on: http://stackoverflow.com/q/20792026

http://stackoverflow.com/q/20686896
possible better answer: http://stackoverflow.com/a/20687476
answer count: 2
tagged with: algorithm
has answer: http://stackoverflow.com/a/20687476
has comment: http://stackoverflow.com/comment/30980149
has answer: http://stackoverflow.com/a/20689507
has comment: http://stackoverflow.com/comment/30980757
has comment: http://stackoverflow.com/comment/30982928
has comment: http://stackoverflow.com/comment/30980108
favorite count: 0
has body: I was recently in a job interview for a position as Java Developer. I was given a task: To think about a good way to represent an electric circuit (such as the one in the figure below) in Java. A circuit is a combination of logic gates XOR, AND, OR etc.. Each gate has two input ports and an output port. Each output is connected to an input of another gate, which goes all the way to a higher gate (as in the picture). Make the system simple, no cycles are allowed (although real life circuits can have them). I was asked to think about a good way to represent this model in Java, using the following guidelines: I am given a circuit and a list of values which should be provided to its inputs. I need to create a model to represent the circuit in Java, i.e., I need to define classes and an API that could be used to represent the circuit. According to the input values and how the gates are connected, I need to calculate the output that the represented circuit would produce. I need to think about a way to represent the board, use abstract classes or interfaces, and show understanding of the model (and if needed to use pattern design). I chose to design the system as a tree and the interviewer told me it was a good choice. Then I build those classes: Node public class gate_node { gate_node right_c,left_c; Oprtator op; int value; int right_v,left_v; public gate_node(gate_node right,gate_node left,Oprtator op){ this.left_c=left; this.right_c=right; this.op=op; right_v=left_v=0; } } Tree public class tree { gate_node head; tree(gate_node head) { this.head = head; } void go_right() { head = head.right_c; } void go_left() { head = head.left_c; } static int arr[] = { 0, 0, 1, 0 }; static int counter=0; static int compute(gate_node head) { if ((head.left_c == null) &amp;&amp; (head.right_c == null)) { int ret=(head.op.calc(arr[counter], arr[counter+1])); counter++; counter++; return ret; } return (head.op.calc(compute(head.left_c), compute(head.right_c))); } public static void main(S…
upvote count: 8
tagged with: design-patterns
accepted answer: http://stackoverflow.com/a/20689507
has comment: http://stackoverflow.com/comment/30980648
type: AnsweredQuestion
tagged with: representation
tagged with: java
score: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/30980246
type: Question
has comment: http://stackoverflow.com/comment/30980376
has title: Construct a model of an electric circuit in java
has comment: http://stackoverflow.com/comment/30981496

http://stackoverflow.com/comment/31170903
has text: It returns a single byte in read yes, but because I create a new DataInputStream to wrap around it, calls that twice and reads both. Edit: What you've added is essentially what I'm doing, but I can't use a regular data input stream because I need the ability to modify parts of the stream easily and move the pointer around.
comment on: http://stackoverflow.com/a/20793028
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31161405
score: 4
has text: http://stackoverflow.com/questions/40480/is-java-pass-by-reference
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20787976

http://stackoverflow.com/comment/31103215
score: 0
type: Comment
has text: side note, should I delete this question?
comment on: http://stackoverflow.com/a/20754609
type: AnswerComment

http://stackoverflow.com/q/20691925
has answer: http://stackoverflow.com/a/20736201
score: 5
has comment: http://stackoverflow.com/comment/30990677
upvote count: 5
has title: Batch File: "Environment Variable Not Defined"
tagged with: arrays
possible better answer: http://stackoverflow.com/a/20693517
has comment: http://stackoverflow.com/comment/30989758
has answer: http://stackoverflow.com/a/20693517
has comment: http://stackoverflow.com/comment/30992370
tagged with: batch-file
answer count: 3
has comment: http://stackoverflow.com/comment/30991670
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/30992324
downvote count: 0
tagged with: undefined
favorite count: 0
accepted answer: http://stackoverflow.com/a/20736201
has comment: http://stackoverflow.com/comment/30991722
has comment: http://stackoverflow.com/comment/30991894
has answer: http://stackoverflow.com/a/20693299
type: AnsweredQuestion
has body: I am working with a Java program that calls an external batch file and passes in an array of commands. I have a loop in the batch file that looks like this: set paramCount=0 for %%x in (%*) do ( set /A paramCount+=1 set list[!paramCount!]=%%x ) The parameters are a bunch of directories, stored as strings, like this: String[] commands = {"cmd.exe", "/C", "C:\Users\user\Documents", "C:\Users\user\Pictures", "C:\Users\user\Videos"} As you can see, my for loop is supposed to loop through the list of the arguments passed to the batch file (%*) and emulate an array within the script (Since the first two elements in the command array are used to start the command process, that only leaves the directories to be looped through). The program was working just fine until the other day, when I suddenly started getting an error saying the following: Environment variable list[ not defined I had not made any changes to the batch file at all and it seemed to stop working for no reason. In case it's necessary information, I'm using a process builder to run the process: ProcessBuilder pb = new ProcessBuilder(commands); Process p = pb.start(); Supposedly using this syntax for an array in a batch file is okay, so I'm not sure why it doesn't accept it. I appreciate any help you can provide in this matter. I've run into a lot of roadblocks with this program, and while I've been able to solve 90% of them, the remaining 10% have begun to drive me crazy! Thanks! EDIT: I have re-written the loop and added in some echo commands to make debugging easier. When I run the batch file, though, nothing prints to the screen as a result of the echo but I still get the same error: @echo off setlocal enableDelayedExpansion set paramCount=0 for %%x in (%*) do ( echo !paramCount! echo %%x set list[!paramCount!]=%%x set /A paramCount=paramCount+1 ) I also forgot to mention that the program works fine when I run the Java from Eclipse; it calls the batch files correctly and all works as expected. I don't get …
has comment: http://stackoverflow.com/comment/30992742
tagged with: java
linked to: http://stackoverflow.com/q/10166386
linked to: http://stackoverflow.com/q/20617065
linked to: http://stackoverflow.com/q/18462169
has comment: http://stackoverflow.com/comment/30992105
type: Question

http://stackoverflow.com/a/20776192
accepted answer of: http://stackoverflow.com/q/20776123
score: 1
has body: Save your program file as UTF-8. Try this code below. I don't think you were printing the right thing here. System.out.print(fmt); Also note that in your program you typed some of your chars as latin not as cyrillic (the first c for example was latin). public class Test33 { public static void main(String[] args) { String russianAlphabet = " абвгдеёжзийклмнопрстуфхцчшщъыьэюя"; String text = "с точки зрения банальной эрудиции, каждый индивидуум вышедший из сферы эмбрионального развития " + "не способен патологически идеализировать метаморфические абстракции"; for(int i = 0; i &lt; text.length(); i++){ System.out.print(String.format("%3c | ",text.charAt(i))); } System.out.println(); for(int i = 0; i &lt; text.length(); i++){ System.out.print(String.format("%3d | ",russianAlphabet.indexOf(text.charAt(i)))); } System.out.println(); } } OUTPUT: с | | т | о | ч | к | и | | з | р | е | н | и | я | | б | а | н | а | л | ь | н | о | й | | э | р | у | д | и | ц | и | и | , | | к | а | ж | д | ы | й | | и | н | д | и | в | и | д | у | у | м | | в | ы | ш | е | д | ш | и | й | | и | з | | с | ф | е | р | ы | | э | м | б | р | и | о | н | а | л | ь | н | о | г | о | | р | а | з | в | и | т | и | я | | н | е | | с | п | о | с | о | б | е | н | | п | а | т | о | л | о | г | и | ч | е | с | к | и | | и | д | е | а | л | и | з | и | р | о | в | а | т | ь | | м | е | т | а | м | о | р | ф | и | ч | е | с | к | и | е | | а | б | с | т | р | а | к | ц | и | и | 19 | 0 | 20 | 16 | 25 | 12 | 10 | 0 | 9 | 18 | 6 | 15 | 10 | 33 | 0 | 2 | 1 | 15 | 1 | 13 | 30 | 15 | 16 | 11 | 0 | 31 | 18 | 21 | 5 | 10 | 24 | 10 | 10 | -1 | 0 | 12 | 1 | 8 | 5 | 29 | 11 | 0 | 10 | 15 | 5 | 10 | 3 | 10 | 5 | 21 | 21 | 14 | 0 | 3 | 29 | 26 | 6 | 5 | 26 | 10 | 11 | 0 | 10 | 9 | 0 | 19 | 22 | 6 | 18 | 29 | 0 | 31 | 14 | 2 | 18 | 10 | 16 | 15 | 1 | 13 | 30 | 15 | 16 | 4 | 16 | 0 | 18 | 1 | 9 | 3 | 10 | 20 | 10 | 33 | 0 | 15 | 6 | 0 | 19 | 17 | 16 | 19 | 16 | 2 | 6 | 15 | 0 | 17 | 1 | 20 | 16 | 13 | 16 | 4 | 10 | 25…
answers question: http://stackoverflow.com/q/20776123
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31074973
has text: do you wish to display only dates greater than the start date in your date picker? or do you wish to validate upon selection?
type: AnswerComment
comment on: http://stackoverflow.com/a/20739100
type: Comment
score: 0

http://stackoverflow.com/a/20721599
has comment: http://stackoverflow.com/comment/31043765
has body: You shouldn't be using a for-loop for this. JTextField has built in callbacks for text changes with DocumentListener: tf.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { // text was changed jl2.setText("Letters Used: " + tf.getText()); } public void removeUpdate(DocumentEvent e) {} // text was deleted public void insertUpdate(DocumentEvent e) {} // text was inserted }); Update: If you want to only respond on Enter presses, you can use an ActionListener which is called on Enter presses: jl2.setText("Letters Used: "); tf.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ jl2.setText(jl2.getText() + tf.getText()); } }); Note: Actually, ActionEvent is triggered by the system's look and feel "accept" action. In most cases, this is the enter key.
upvote count: 5
has comment: http://stackoverflow.com/comment/36311756
score: 5
answers question: http://stackoverflow.com/q/20721557
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20721557
has comment: http://stackoverflow.com/comment/31045435
type: Answer

http://stackoverflow.com/comment/31239915
type: QuestionComment
has text: my matrix should like something like [[population1, 4.23, 9.98, 15, 3.23, 9.98, 29], [population2, 20, 6.5, 13, 1.23, 2.98]] but what i get in this case is [[population2, 20, 6.5, 13, 1.23, 2.98], [population2, 20, 6.5, 13, 1.23, 2.98]]
comment on: http://stackoverflow.com/q/20830304
score: 0
type: Comment

http://stackoverflow.com/a/20781330
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20780990
downvote count: 0
has body: In first case if you can use joins it will be better. Here IO time is also less. for individual fetch you have to write code again(reusable for individual use is less) In secone case IO time is more. for individual fetch you can use the same code again(re usability is there for individual use) In your scenario first one is good. But you can get better performance by using joins, using stored procedures,using connection poolings
upvote count: 2

http://stackoverflow.com/a/20817904
answers question: http://stackoverflow.com/q/20817588
has comment: http://stackoverflow.com/comment/31219106
score: 0
has body: Copying file from one location to another has nothing to do with formats, codecs etc. Solution: Add Apache Commons IO library to your project. Add one line of code: FileUtils.copyFile(src, dst);
type: Answer

http://stackoverflow.com/comment/31266905
type: Comment
has text: Have you put a break point after your loop to make sure it actually is getting there and not just stopping the whole program? Is it possible that your code hits an error while copying documents, which is why it stops?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20845223

http://stackoverflow.com/comment/31272600
type: AnswerComment
has text: Instead of object - (MyObject obj) is there a way I can get the ArrayList or save the ArrayList
type: Comment
comment on: http://stackoverflow.com/a/20848025
score: 0

http://stackoverflow.com/comment/31244006
has text: I figured out the problem. I had it print the numbers after each time and it made me realize that if `itsSmallNumber` always adds `itsGuess` when its low eventually it COULD reach a value higher than `itsLargeNumber` to counter this I just had `itsLowNumber` become equal to `itsGuess` whenever `itsGuess` is lower than `itsSecretNumber`
comment on: http://stackoverflow.com/q/20832276
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20835110
has comment: http://stackoverflow.com/comment/31249321
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31248905
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: annotations
type: Question
score: 3
has body: I am doing a web application, in which I want to validate two fields on the JSP form. In the registration form I have so many fields. In that I want to validate password and confirm password fields. Below is my code: Action Class: @Length(min = 6, max = 20) @Column(name = "PERSON_PASSWORD", nullable = false, length = 20) public String getPassword() { return password; } @Length(min = 6, max = 20) @Column(name = "PERSON_CONFORMPASSWORD", nullable = false, length = 20) public String getConformPassword() { return conformPassword; } Now, how can I validate the two fields containing the same data?
has answer: http://stackoverflow.com/a/20845823
has answer: http://stackoverflow.com/a/20835312
has comment: http://stackoverflow.com/comment/31249277
tagged with: struts2
has comment: http://stackoverflow.com/comment/31248717
answer count: 3
has title: How can I validate two fields like password and confirm password in Struts 2?
has comment: http://stackoverflow.com/comment/31250986
tagged with: validation
downvote count: 0
has answer: http://stackoverflow.com/a/20835210
has comment: http://stackoverflow.com/comment/31248982
favorite count: 0
has comment: http://stackoverflow.com/comment/31250553

c++
tags question: http://stackoverflow.com/q/20681571
tags question: http://stackoverflow.com/q/20763611
tags question: http://stackoverflow.com/q/20684505
tags question: http://stackoverflow.com/q/20785264
tags question: http://stackoverflow.com/q/20708857
tags question: http://stackoverflow.com/q/20772486
tags question: http://stackoverflow.com/q/20830535
tags question: http://stackoverflow.com/q/20841693
tags question: http://stackoverflow.com/q/20765900
tags question: http://stackoverflow.com/q/20723228
type: Tag
tags question: http://stackoverflow.com/q/20759529
tags question: http://stackoverflow.com/q/20798594
tags question: http://stackoverflow.com/q/20734527
tags question: http://stackoverflow.com/q/20789213
tags question: http://stackoverflow.com/q/20776810
tags question: http://stackoverflow.com/q/20733044
tags question: http://stackoverflow.com/q/20696108
tags question: http://stackoverflow.com/q/20820900
tags question: http://stackoverflow.com/q/20764963
tags question: http://stackoverflow.com/q/20784765
tags question: http://stackoverflow.com/q/20712897
tags question: http://stackoverflow.com/q/20754675
tags question: http://stackoverflow.com/q/20831324
tags question: http://stackoverflow.com/q/20716853
tags question: http://stackoverflow.com/q/20749173
tags question: http://stackoverflow.com/q/20829860
tags question: http://stackoverflow.com/q/20777511
tags question: http://stackoverflow.com/q/20815475
tags question: http://stackoverflow.com/q/20720186
tags question: http://stackoverflow.com/q/20790001
tags question: http://stackoverflow.com/q/20697968
tags question: http://stackoverflow.com/q/20829091
tags question: http://stackoverflow.com/q/20791688
tags question: http://stackoverflow.com/q/20694164
tags question: http://stackoverflow.com/q/20721044
tags question: http://stackoverflow.com/q/20766045
tags question: http://stackoverflow.com/q/20727319
tags question: http://stackoverflow.com/q/20819004
tags question: http://stackoverflow.com/q/20763259
tags question: http://stackoverflow.com/q/20848263
tags question: http://stackoverflow.com/q/20723072
tag name: c++
tags question: http://stackoverflow.com/q/20729919
tags question: http://stackoverflow.com/q/20790381
tags question: http://stackoverflow.com/q/20765744
tags question: http://stackoverflow.com/q/20776835
tags question: http://stackoverflow.com/q/20830673
tags question: http://stackoverflow.com/q/20716985

http://stackoverflow.com/q/20704086
has answer: http://stackoverflow.com/a/20706340
tagged with: initialization
favorite count: 0
possible better answer: http://stackoverflow.com/a/20753902
has answer: http://stackoverflow.com/a/20704220
accepted answer: http://stackoverflow.com/a/20704220
has comment: http://stackoverflow.com/comment/31010396
answer count: 5
has answer: http://stackoverflow.com/a/20829168
score: 13
tagged with: spring
linked to: http://stackoverflow.com/q/18682486
has body: When I starts to run my spring application my tomcat , the ContextRefreshedEvent fires twice. Please see the StackTrace. Dec 20, 2013 6:07:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:SpringValidations' did not find a matching property. Dec 20, 2013 6:07:56 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\jre6\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:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;F:\sub\svn\bin;%DERBY_HOME%\bin;D:\Lal\Lab\SW\apache-maven-3.0.4/bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_25\bin;;F:\Eclipse\sts-2.9.2.RELEASE; Dec 20, 2013 6:07:56 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Dec 20, 2013 6:07:56 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 289 ms Dec 20, 2013 6:07:56 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Dec 20, 2013 6:07:56 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.16 Dec 20, 2013 6:07:56 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(F:\anand\Spring_Training\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\SpringValidations\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class Dec 20, 2013 6:07:56 PM org.apache.catalina.core.StandardContext addApplicatio…
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31014010
tagged with: web-applications
has comment: http://stackoverflow.com/comment/31014395
has title: Spring - application Initialized twice?
type: Question
has answer: http://stackoverflow.com/a/20753902
has answer: http://stackoverflow.com/a/20778179
upvote count: 13
has comment: http://stackoverflow.com/comment/31079745

vlookup
tag name: vlookup
tags question: http://stackoverflow.com/q/20838937
type: Tag

http://stackoverflow.com/a/54495856
type: Answer
upvote count: 1
has body: execution() matches join points that are method executions. This is the only designator that actually performs matches. All other designators (supported by Spring AOP) only limit those matches. Note that Spring supports only a subset of designators available in AspectJ (Spring AOP is proxy-based). AspectJ pointcut designators that are supported in Spring are: args() and @args(), target() and @target(), within() and @within(), execution(), this(), @annotation
answers question: http://stackoverflow.com/q/20816780
score: 1
downvote count: 0

http://stackoverflow.com/comment/31019398
type: Comment
has text: Okay, so the volatile tip from Tim solved half the problem. The other half was solved when I realized that NET_SO_TIMEOUT=0 meant that the loop hung forever on the line that receives the packet. I set NET_SO_TIMEOUT=500, and then within 500 ms of the time I call stopListening(), the execution would actually reach the loop condition (!stopflag). Duh. Thanks guys
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20707145

http://stackoverflow.com/comment/31249311
score: 1
comment on: http://stackoverflow.com/q/20835651
type: Comment
type: QuestionComment
has text: you need to parse and show or just want to show from predefined strings in different languages

http://stackoverflow.com/q/20730196
tagged with: android
tagged with: android-intent
has answer: http://stackoverflow.com/a/20730203
tagged with: java
has body: I feel very stupid about this, watched multiple Tutorials and Stackoverflow questions, but still can't fix it. I'm writing a very simple Android mp3 Stream listener. I want to use a Sevice so the Stream can be running in the Background. But i can't start a Service: 12-22 08:42:58.738: W/dalvikvm(1701): threadid=1: thread exiting with uncaught exception (group=0xb3aa2ba8) 12-22 08:42:58.788: E/AndroidRuntime(1701): FATAL EXCEPTION: main 12-22 08:42:58.788: E/AndroidRuntime(1701): Process: com.wankoradio, PID: 1701 12-22 08:42:58.788: E/AndroidRuntime(1701): java.lang.RuntimeException: Unable to instantiate service com.wankoradio.MediaPlayerService: java.lang.NullPointerException 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2556) 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.app.ActivityThread.access$1800(ActivityThread.java:135) 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.os.Handler.dispatchMessage(Handler.java:102) 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.os.Looper.loop(Looper.java:136) 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.app.ActivityThread.main(ActivityThread.java:5017) 12-22 08:42:58.788: E/AndroidRuntime(1701): at java.lang.reflect.Method.invokeNative(Native Method) 12-22 08:42:58.788: E/AndroidRuntime(1701): at java.lang.reflect.Method.invoke(Method.java:515) 12-22 08:42:58.788: E/AndroidRuntime(1701): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 12-22 08:42:58.788: E/AndroidRuntime(1701): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 12-22 08:42:58.788: E/AndroidRuntime(1701): at dalvik.system.NativeStart.main(Native Method) 12-22 08:42:58.788: E/AndroidRuntime(1701): Caused by: java.lang.NullPointerException 12-22 08:42:58.788: E/AndroidRuntime(1701): at android.content.C…
has title: Android: Unable to instantiate service Java.NullPointerException
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/20730203
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/31087954
type: Comment
type: QuestionComment
score: 1
has text: @LokiSinclair : android allows to have several users on a device starting from 4.2. The question is to how to target a specific user when installing an application.
comment on: http://stackoverflow.com/q/20746422

http://stackoverflow.com/q/20849667
has body: I am following this page in the official documentation. I also downloaded hadoop 2.2.0 and placed it under $HOME/opt. Now I have this file structure: $ ls -1 ~/opt/hadoop-2.2.0/ LICENSE.txt NOTICE.txt README.txt bin/ etc/ include/ lib/ libexec/ sbin/ share/ $ ls -1 ~/opt/hadoop-2.2.0/share/hadoop/ common/ hdfs/ httpfs/ mapreduce/ tools/ yarn/ In the page I mentioned above, there is this paragraph: Assuming you have installed hadoop-common/hadoop-hdfs and exported $HADOOP_COMMON_HOME/$HADOOP_HDFS_HOME, untar hadoop mapreduce tarball and set environment variable $HADOOP_MAPRED_HOME to the untarred directory. Set $HADOOP_YARN_HOME the same as $HADOOP_MAPRED_HOME. So, my question is, given my file structure, how should I set up the hadoop environment variables ($HADOOP_COMMON_HOME, $HADOOP_HDFS_HOME, $HADOOP_YARN_HOME, etc)? Thank you very much.
score: 6
has answer: http://stackoverflow.com/a/20850049
upvote count: 6
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/20850049
downvote count: 0
has title: How to set up hadoop environment variables
answer count: 1
tagged with: macos
favorite count: 0

http://stackoverflow.com/comment/31245384
score: 0
type: Comment
has text: Maybe this [Stack Overflow Convo](http://stackoverflow.com/questions/19623563/where-does-java-reference-variable-stored) will get you a little bit closer.
type: QuestionComment
comment on: http://stackoverflow.com/q/20833147

sql
tags question: http://stackoverflow.com/q/20681678
tags question: http://stackoverflow.com/q/20829403
tags question: http://stackoverflow.com/q/20688325
tags question: http://stackoverflow.com/q/20690966
tags question: http://stackoverflow.com/q/20743473
tags question: http://stackoverflow.com/q/20714322
tags question: http://stackoverflow.com/q/20736449
tags question: http://stackoverflow.com/q/20769536
tags question: http://stackoverflow.com/q/20699511
tags question: http://stackoverflow.com/q/20805617
tags question: http://stackoverflow.com/q/20802875
tags question: http://stackoverflow.com/q/20789207
tags question: http://stackoverflow.com/q/20687238
tags question: http://stackoverflow.com/q/20812119
tags question: http://stackoverflow.com/q/20744691
tags question: http://stackoverflow.com/q/20835992
tags question: http://stackoverflow.com/q/20697825
tags question: http://stackoverflow.com/q/20771486
tags question: http://stackoverflow.com/q/20818300
tags question: http://stackoverflow.com/q/20703229
tags question: http://stackoverflow.com/q/20703856
tags question: http://stackoverflow.com/q/20728461
tags question: http://stackoverflow.com/q/20706871
tags question: http://stackoverflow.com/q/20779704
tags question: http://stackoverflow.com/q/20704589
tags question: http://stackoverflow.com/q/20748449
tags question: http://stackoverflow.com/q/20731563
tags question: http://stackoverflow.com/q/20719514
tags question: http://stackoverflow.com/q/20798072
tags question: http://stackoverflow.com/q/20820193
tags question: http://stackoverflow.com/q/20754706
tags question: http://stackoverflow.com/q/20719877
tags question: http://stackoverflow.com/q/20684962
tags question: http://stackoverflow.com/q/20687051
tags question: http://stackoverflow.com/q/20848291
tag name: sql
tags question: http://stackoverflow.com/q/20717425
type: Tag
tags question: http://stackoverflow.com/q/20744054
tags question: http://stackoverflow.com/q/20705127
tags question: http://stackoverflow.com/q/20819753
tags question: http://stackoverflow.com/q/20700363
tags question: http://stackoverflow.com/q/20739150
tags question: http://stackoverflow.com/q/20837502
tags question: http://stackoverflow.com/q/20685677
tags question: http://stackoverflow.com/q/20729339
tags question: http://stackoverflow.com/q/20708693
tags question: http://stackoverflow.com/q/20753250
tags question: http://stackoverflow.com/q/20723711
tags question: http://stackoverflow.com/q/20707524
tags question: http://stackoverflow.com/q/20725181
tags question: http://stackoverflow.com/q/20753143
tags question: http://stackoverflow.com/q/20767670
tags question: http://stackoverflow.com/q/20823864
tags question: http://stackoverflow.com/q/20693045
tags question: http://stackoverflow.com/q/20726076
tags question: http://stackoverflow.com/q/20700058
tags question: http://stackoverflow.com/q/20798178
tags question: http://stackoverflow.com/q/20842422
tags question: http://stackoverflow.com/q/20830437
tags question: http://stackoverflow.com/q/20753647
tags question: http://stackoverflow.com/q/20819872
tags question: http://stackoverflow.com/q/20698316
tags question: http://stackoverflow.com/q/20679355
tags question: http://stackoverflow.com/q/20802499
tags question: http://stackoverflow.com/q/20756883
tags question: http://stackoverflow.com/q/20815183
tags question: http://stackoverflow.com/q/20769343
tags question: http://stackoverflow.com/q/20705807
tags question: http://stackoverflow.com/q/20785216
tags question: http://stackoverflow.com/q/20692921
tags question: http://stackoverflow.com/q/20759556
tags question: http://stackoverflow.com/q/20836652
tags question: http://stackoverflow.com/q/20679474
tags question: http://stackoverflow.com/q/20738634
tags question: http://stackoverflow.com/q/20773185
tags question: http://stackoverflow.com/q/20849389
tags question: http://stackoverflow.com/q/20746439
tags question: http://stackoverflow.com/q/20833853
tags question: http://stackoverflow.com/q/20759015

http://stackoverflow.com/comment/31002393
type: QuestionComment
has text: I'm having 45 records in my data base. I want to fetch each time 10 records by calling the service to the DB.
comment on: http://stackoverflow.com/q/20698280
score: 0
type: Comment

http://stackoverflow.com/q/20723419
tagged with: java
has title: moving focus over sequential editText controls in android
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/31046299
upvote count: 1
tagged with: layout
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I have 4 editText I want the user to set one digit in each of them sequentially. how would you suggest enumerating the controls? Is there any attribute I can override which will save the next editText control's id?
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/a/21283549
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/20796484
answers question: http://stackoverflow.com/q/20796484
type: AcceptedAnswer
downvote count: 0
has body: Unfortunately, there is no way to start two threads at the same time. Let me explain better: first of all, the sequence thread1.Start(); and thread2.Start(); is executed with thread1 first and, after that, thread2. It means only that thread thread1 is scheduled before thread 2, not actually started. The two methods take fractions of second each one, so the fact that they are in sequence cannot be seen by a human observer. More, Java threads are scheduled, ie. assigned to be eventually executed. Even if you have a multi-core CPU, you are not sure that 1) the threads run in parallel (other system processes may interfere) and 2) the threads both start just after the Start() method is called. but you can run multiple threads in this way.. new Thread(thread1).start(); new Thread(thread2).start();

http://stackoverflow.com/a/56730943
answers question: http://stackoverflow.com/q/20740444
score: 0
has body: public class LuhnAlgorithm { /** * Returns true if given card number is valid * * @param cardNum Card number * @return true if card number is valid else false */ private static boolean checkLuhn(String cardNum) { int cardlength = cardNum.length(); int evenSum = 0, oddSum = 0, sum; for (int i = cardlength - 1; i &gt;= 0; i--) { System.out.println(cardNum.charAt(i)); int digit = Character.getNumericValue(cardNum.charAt(i)); if (i % 2 == 0) { int multiplyByTwo = digit * 2; if (multiplyByTwo &gt; 9) { /* Add two digits to handle cases that make two digits after doubling */ String mul = String.valueOf(multiplyByTwo); multiplyByTwo = Character.getNumericValue(mul.charAt(0)) + Character.getNumericValue(mul.charAt(1)); } evenSum += multiplyByTwo; } else { oddSum += digit; } } sum = evenSum + oddSum; if (sum % 10 == 0) { System.out.println("valid card"); return true; } else { System.out.println("invalid card"); return false; } } public static void main(String[] args) { String cardNum = "8112189875"; System.out.println(checkLuhn(cardNum)); } } Hope it may works.
type: Answer

http://stackoverflow.com/a/20752091
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20752062
answers question: http://stackoverflow.com/q/20752062
type: AcceptedAnswer
downvote count: 0
has body: There are two gets and one compare inside of the if statement itself: if (list.get(inner).compareTo(list.get(inner + 1)) &gt; 0)
type: Answer
score: 2

http://stackoverflow.com/a/20822689
upvote count: 3
has body: I would store an array of Rectangles and find out which one contains the point when clicked. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ChessBoard extends JPanel { public static final int SIZE = 400; public static final int COUNT = 8; public static final int TILE_SIZE = SIZE / COUNT; public static final Color RED = Color.RED; public static final Color BLUE = Color.BLUE; public static Tile[][] tiles; static { ChessBoard c = new ChessBoard(); tiles = new Tile[COUNT][COUNT]; for (int i = 0; i &lt; COUNT; i++) { for (int j = 0; j &lt; COUNT; j++) { tiles[i][j] = c.new Tile(i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE); } } } public static void main(String[] args) { JFrame f = new JFrame(); ChessBoard c = new ChessBoard(); f.setTitle("Chessboard Tile Click"); f.setContentPane(c); f.pack(); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } public ChessBoard() { setPreferredSize(new Dimension(SIZE, SIZE)); this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { Point p = e.getPoint(); for (int i = 0; i &lt; COUNT; i++) { for (int j = 0; j &lt; COUNT; j++) { Rectangle tile = tiles[i][j]; if (tile.contains(p)) { JOptionPane.showMessageDialog(null, String.format("Clicked Tile: %s", tile)); break; } } } } }); } @Override protected void paintComponent(Graphics g) { boolean flip = false; for (int i = 0; i &lt; COUNT; i++) { for (int j = 0; j &lt; COUNT; j++) { Rectangle tile = tiles[i][j]; g.setColor((flip = !flip) ? BLUE : RED); g.fillRect(tile.x, tile.y, TILE_SIZE, TILE_SIZE); g.setColor(Color.WHITE); g.drawString(tile.toString(), tile.x + (TILE_SIZE / 2) - 8, tile.y + (TILE_SIZE / 2) + 6); } flip = !flip; } } private class Tile extends Rectangle { public Tile(int x, int y, int width, int height) { super(x, y, width, height); } @Override public String toString() { return String.format("%c%d", 'A' + x / TILE_SIZE, COUNT - y / TILE_SIZE); } } }
answers question: http://stackoverflow.com/q/20822274
score: 3
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31225243

http://stackoverflow.com/comment/31121697
type: AnswerComment
type: Comment
has text: V-X, I can grasp the core of it now.
comment on: http://stackoverflow.com/a/20729761
score: 0

http://stackoverflow.com/a/20793749
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/20793687
has comment: http://stackoverflow.com/comment/31172535
answers question: http://stackoverflow.com/q/20793687
type: AcceptedAnswer
has body: Seems like you don't really need to wait until the thread is done to continue, the way I see it you only need to be notified once it's done, the simplest approach for it would be passing a "callback listener" object to the thread, and execute it when done, this will let you know that you are ready to continue, OR a better approacch would be an AsyncTask which will allow you to do everything in background and when done you can use the onPostExecute method, hope this helps. This is the way you create and add a callback to be notified when your thread has completed: //Create your callback listener interface... public interface MyThreadListener{ public void threadFinished(); } //This is the method that runs some functionality in a separate thread public void executeTaskInSeparateThread(final MyThreadListener listener){ new Thread(new Runnable() { @Override public void run() { // DO your long task here... //Notify when done before leaving run method... listener.threadFinished(); } }).start(); } //Use it like this //Create the implementation of the listener you want (this is something like what you usually do for buttons or any other android listener) MyThreadListener listener = new MyThreadListener() { @Override public void threadFinished() { //Do whatever you want when notified... //NOTE: This method will be called on a separated thread too, you cannot modify views... } }; executeTaskInSeparateThread(listener); Once the thread completed it will execute the listener and will let you know is done... Regards!
downvote count: 0
score: 6

http://stackoverflow.com/q/20698947
tagged with: java
has title: Netty Connections in TIME_WAIT
type: Question
answer count: 1
downvote count: 0
has body: I have created a netty server and client, which is using a Connection Factory build over DBCP, to maintain a pool of active connections. To make the connections alive, I am using keepAlive. However, I have noticed that the sockets are increasing at a rapid rate beyond the channel pool size, because all of them are in a TIME_WAIT state. What am I doing wrong? Is there any implementation of Channel Pool of Netty.
tagged with: sockets
tagged with: netty
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/20699184
score: 1

http://stackoverflow.com/comment/31118328
has text: I have no idea about this, my last attempt, are you using 2 step login ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20758032

http://stackoverflow.com/q/20735205
has comment: http://stackoverflow.com/comment/31076039
has answer: http://stackoverflow.com/a/42016608
has answer: http://stackoverflow.com/a/43984625
has answer: http://stackoverflow.com/a/62968345
score: 115
has answer: http://stackoverflow.com/a/35762868
has answer: http://stackoverflow.com/a/49445024
has answer: http://stackoverflow.com/a/41303121
has answer: http://stackoverflow.com/a/35095876
downvote count: 0
has answer: http://stackoverflow.com/a/51039038
has answer: http://stackoverflow.com/a/46378977
has answer: http://stackoverflow.com/a/48155534
tagged with: tomcat
has answer: http://stackoverflow.com/a/33466220
has comment: http://stackoverflow.com/comment/71673444
has answer: http://stackoverflow.com/a/42402475
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/543439
has answer: http://stackoverflow.com/a/66560206
answer count: 26
has comment: http://stackoverflow.com/comment/57393581
has answer: http://stackoverflow.com/a/61498242
possible better answer: http://stackoverflow.com/a/37651109
has answer: http://stackoverflow.com/a/56794188
upvote count: 115
favorite count: 0
has comment: http://stackoverflow.com/comment/31074439
has answer: http://stackoverflow.com/a/36964785
has answer: http://stackoverflow.com/a/37651109
type: Question
has answer: http://stackoverflow.com/a/43303371
has answer: http://stackoverflow.com/a/20751638
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/46251084
has answer: http://stackoverflow.com/a/59624483
has answer: http://stackoverflow.com/a/57277531
linked to: http://stackoverflow.com/q/646649
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/46198749
has body: I have this error launching my spring application: java -jar target/gs-serving-web-content-0.1.0.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v0.5.0.M6) 2013-12-23 00:23:09.466 INFO 19252 --- [ main] hello.Application : Starting Application on mbp-de-antoine.home with PID 19252 (/Users/antoine/Documents/workspace-sts-3.4.0.RELEASE/springapp/target/gs-serving-web-content-0.1.0.jar started by antoine) 2013-12-23 00:23:09.511 INFO 19252 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@24024c39: startup date [Mon Dec 23 00:23:09 CET 2013]; root of context hierarchy 2013-12-23 00:23:10.910 INFO 19252 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2013-12-23 00:23:10.910 INFO 19252 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.42 2013-12-23 00:23:11.045 INFO 19252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2013-12-23 00:23:11.046 INFO 19252 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1537 ms 2013-12-23 00:23:11.274 INFO 19252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet' 2013-12-23 00:23:11.274 INFO 19252 --- [ost-startStop-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started 2013-12-23 00:23:11.409 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2013-12-23 00:23:11.634 INFO 19252 --- [ost-startStop…
has answer: http://stackoverflow.com/a/40120681
accepted answer: http://stackoverflow.com/a/20751638
has answer: http://stackoverflow.com/a/49625888
tagged with: java
has title: Launching Spring application Address already in use
has answer: http://stackoverflow.com/a/62605726

http://stackoverflow.com/q/20810798
type: Question
has comment: http://stackoverflow.com/comment/31203103
answer count: 2
score: -2
has answer: http://stackoverflow.com/a/20810838
has body: I was wondering how I can make a 'timer' start when a JButton is clicked. I have looked around to see if there was answer relevant to my situation and I couldn't find one. Here is a code example from my previous question: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class GreenRects extends JPanel { private static final int SCREEN_WIDTH = 500; private static final int SCREEN_HEIGHT = 500; private static final int OFFSET = 100; private static final int SIZE = 20; private static final int INC = 5; int[] xPoints = new int[5]; public GreenRects() { int x = 0; for (int i = 0; i &lt; xPoints.length; i++) { xPoints[i] = x; x += OFFSET; } Timer timer = new Timer(50, new ActionListener() { public void actionPerformed(ActionEvent e) { for (int i = 0; i &lt; xPoints.length; i++) { if (xPoints[i] + INC &lt; SCREEN_WIDTH) { xPoints[i] += INC; } else { xPoints[i] = 0; } } repaint(); } }); timer.start(); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.red); g.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); g.setColor(Color.green); for (int i = 0; i &lt; xPoints.length; i++) { g.fillRect(xPoints[i], 0, SIZE, SIZE); } } public Dimension getPreferredSize() { return new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT); } public static void createAndShowGui() { JFrame frame = new JFrame(); frame.add(new GreenRects()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
possible better answer: http://stackoverflow.com/a/20810845
has answer: http://stackoverflow.com/a/20810845
has comment: http://stackoverflow.com/comment/31203003
favorite count: 0
accepted answer: http://stackoverflow.com/a/20810838
has comment: http://stackoverflow.com/comment/31203067
tagged with: swing
tagged with: jbutton
has title: Starting Timer with JButton
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31203298
tagged with: java
downvote count: 3
upvote count: 1

http://stackoverflow.com/a/20751646
type: Answer
answers question: http://stackoverflow.com/q/20751618
downvote count: 0
score: 5
has body: Is there a way in Java to check if HashMap value belongs to a specific key ? Just get the value for the specific key using get(), if it is not null then your map contains it.
upvote count: 5

http://stackoverflow.com/a/20815936
has comment: http://stackoverflow.com/comment/31213887
downvote count: 0
answers question: http://stackoverflow.com/q/20815879
has body: try this public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener{ String[] items = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; boolean app_started = true; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Spinner spinner1 = (Spinner) findViewById(R.id.spinner1); spinner1.setOnItemSelectedListener(this); ArrayAdapter AA = new ArrayAdapter(this, android.R.layout.simple_spinner_item, items); AA.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(AA); } @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { String selectedItem = parent.getItemAtPosition(position).toString(); if(!app_started ) { if(selectedItem.equals("Item 1")) { Toast.makeText(getApplicationContext(), "Item 1", Toast.LENGTH_LONG).show(); } String selectedItem2 = parent.getItemAtPosition(position).toString(); if(selectedItem.equals("Item 2")) { Toast.makeText(getApplicationContext(), "Item 2", Toast.LENGTH_LONG).show(); } String selectedItem3 = parent.getItemAtPosition(position).toString(); if(selectedItem.equals("Item 3")) { Toast.makeText(getApplicationContext(), "Item 3", Toast.LENGTH_LONG).show(); } String selectedItem4 = parent.getItemAtPosition(position).toString(); if(selectedItem.equals("Item 4")) { Toast.makeText(getApplicationContext(), "Item 4", Toast.LENGTH_LONG).show(); } String selectedItem5 = parent.getItemAtPosition(position).toString(); if(selectedItem.equals("Item 5")) { Toast.makeText(getApplicationContext(), "Item 5", Toast.LENGTH_LONG).show(); } } app_started = false; } @Override public void onNothingSelected(AdapterView parent) { } }
accepted answer of: http://stackoverflow.com/q/20815879
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/31213918

http://stackoverflow.com/comment/31039078
type: AnswerComment
has text: Is there any way to modify my for loops to give the same result?
type: Comment
comment on: http://stackoverflow.com/a/20719535
score: 0

http://stackoverflow.com/q/20817383
has comment: http://stackoverflow.com/comment/31215200
type: AnsweredQuestion
tagged with: java
type: Question
has title: url.openstream() or urlconnection.getinputstream() raise nullpointerexception on valid URL
has body: For an android application I am trying to change an URL of an XML because of a new server, but the content is the same. I used to do this: InputSource ins = new InputSource(rssUrl.openStream()); This used to work and for a few days still does, while the old URL is available on on the old server. But when i change the URL of the XML I get an NullPointerException on the row above. I am sure rssUrl is not null, I printed the value of it an is just the working URL. I validated the XMl and the XML is valid, but this doesn't really matter because the problem is raised before the parsing starts. One of the things I tried was something like this: Urlconnection urlConnection= rssUrl.openurlconnection(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); inputsource ins = new inputsource(in); but this raised an nullpointerexception as well. I read some things about downgrading my Java to 6 (currently i am using 7). But i don't really feel like it and can't imagine why it would work. edit: I tried downgrading to java se 6 but didn't work. Does anyone know how this error is possible and how to resolve it? stack: 12-28 22:14:53.635: W/System.err(6949): java.lang.NullPointerException 12-28 22:14:53.725: W/System.err(6949): at libcore.net.http.HttpConnection$Address.hashCode(HttpConnection.java:343) 12-28 22:14:53.725: W/System.err(6949): at java.util.HashMap.get(HashMap.java:298) 12-28 22:14:53.725: W/System.err(6949): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:67) 12-28 22:14:53.725: W/System.err(6949): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 12-28 22:14:53.725: W/System.err(6949): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308) 12-28 22:14:53.725: W/System.err(6949): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303) 12-28 22:14:53.735: W/System.err(6949): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282) 12-28 22:14:53.735: W/System.err(6949): at lib…
has answer: http://stackoverflow.com/a/20819666
accepted answer: http://stackoverflow.com/a/20819666
score: 0
answer count: 1
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/15557355
tagged with: android

http://stackoverflow.com/q/20699064
tagged with: plugin-architecture
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: plugins
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: Plugin based development core internal architecture in java
type: Question
has body: I have found below styles for developing plugin 1:java.util.ServiceLoader Working Style:Lookup in META-INF/services and get injected service Provide Abstract class to other implementor 2:java.net.URLClassLoader Working Style:Load a required class from a jar file and getinstance . Provide a interface to other implementor 3: Load from property file InputStream in =this.getClass().getClassLoader() .getResourceAsStream("packageName/config.properties"); Working Style 3: Load class name from property file which implements the provided interface Provide a interface to other implementor Sample code for 3 public interface PluginInterface { void performYourOperation(); }; public class PluginImpl implements PluginInterface { void performYourOperation() { //perform all operation what plugin is inteneded to do } Main Loader: InputStream in =this.getClass().getClassLoader() .getResourceAsStream("packageName/config.properties"); configProp.load(in ); String factoryClass = (String) configProp .get("plugin.factory.class"); Class&lt;?&gt; factory = Class.forName(factoryClass); PluginInterface factory=(PluginInterface) factory.newInstance(); factoryq.performYourOperation(); }; I have found 3 ways for own plugin implementation style . Is there any other ways besides above mentioned one . Is maven and jenkins and other its core level has the same style Or They have some more advance way ? Do any one have good idea for it. Please dont suggest to use this framework and that , i want to learn and understand the core internal working style.Thank You

http://stackoverflow.com/comment/31012939
type: AnswerComment
comment on: http://stackoverflow.com/a/20705121
type: Comment
has text: My pleasure. I'm here to help.
score: 0

http://stackoverflow.com/a/20718935
has body: The fastest way to archieve this with Java is to use NIO. You can directly map the file into memory by using a MappedByteBuffer. FileChannel channel = FileChannel.open(Paths.get("/path/to/zip"), StandardOpenOption.READ); MappedByteBuffer buffer = channel.map(MapMode.READ_ONLY, 0, channel.size()); Now buffer contains a memory mapped region of your whole file. You can do whatever you want with it, for example pass an offset and a length to a thread. I don't know which zip lib supports that, but apparently you have something like that already. FYI, I tested a bit with a 50 mb single file archive and it took less than 200ms on average to read it with a usual ZipInputStream- I think that you are trying to optimize pretty much nothing here.
upvote count: 3
has comment: http://stackoverflow.com/comment/31041618
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31038231
has comment: http://stackoverflow.com/comment/31045019
type: Answer
has comment: http://stackoverflow.com/comment/31038408
has comment: http://stackoverflow.com/comment/31038181
score: 3
answers question: http://stackoverflow.com/q/20717897
downvote count: 0
has comment: http://stackoverflow.com/comment/31038264
accepted answer of: http://stackoverflow.com/q/20717897
has comment: http://stackoverflow.com/comment/31038553

http://stackoverflow.com/q/20845561
has body: I opened the class file in notepad. copied the content of it and pasted in another notepad and saved it at with the same class name with the ".class" extention. then I tried to run that new class file and got the errors as. Exception in thread "main" java.lang.UnsupportedClassVersionError: print : Unsupported major.minor version 8242.8224 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source)
has answer: http://stackoverflow.com/a/20845592
tagged with: java
has comment: http://stackoverflow.com/comment/31267847
type: Question
has title: how to run a class file created by user not created by copiler
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31370163
linked to: http://stackoverflow.com/q/10382929
has comment: http://stackoverflow.com/comment/31370101
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20845619

http://stackoverflow.com/q/20774119
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/20775139
type: Question
has title: Java custom annotation
answer count: 2
tagged with: jpa
has body: I want create a custom annotation to validate an attribute in my ManagedBean for exemple @StartWithUpperCase public @interface StartWithUpperCase{ // } and im manegedBean class i use my annotation like : public class myBean implements java.io.Serializable{ @StartWithUpperCase @NotNull private name; } how I can do it.
favorite count: 0
upvote count: 3
tagged with: jpa-2.0
tagged with: annotations
tagged with: managed-bean
has answer: http://stackoverflow.com/a/20775927
accepted answer: http://stackoverflow.com/a/20775927
possible better answer: http://stackoverflow.com/a/20775139
type: AnsweredQuestion

http://stackoverflow.com/q/20720187
has title: Confusion over Java HashMap createEntry method
type: AnsweredQuestion
downvote count: 0
has body: I'm trying to understand the inner implementation of HashMap in Java. I have a confusion with the 'createEntry' method. void createEntry(int hash, K key, V value, int bucketIndex) { Entry&lt;K,V&gt; e = table[bucketIndex]; table[bucketIndex] = new Entry&lt;&gt;(hash, key, value, e); size++; } it creates an entry object 'e' and then it puts it to another entry object and stores it into the bucket[bucketindex] and it also stores the key and value. I am not able to understand the purpose of creation of the Entry object 'e' here. Could someone please explain. Regards
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/31041217
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31040165
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31040156
has answer: http://stackoverflow.com/a/20720196
accepted answer: http://stackoverflow.com/a/20720196

http://stackoverflow.com/comment/31035371
type: Comment
type: QuestionComment
has text: Not any single exception raised........ I am trying to see DB log.....
comment on: http://stackoverflow.com/q/20716757
score: 0

http://stackoverflow.com/comment/31235902
type: Comment
type: QuestionComment
has text: Please show how you create the `conn` object. It should connect to the other URL that Parthiv suggested.
score: 0
comment on: http://stackoverflow.com/q/20794411

http://stackoverflow.com/q/20787841
has body: I'm learning Spring (for Java) and intend to be able to deploy multiple spring java mvc web projects to amazon AWS cloud servers. Every spring tutorial I've seen includes the step of manually adding a bunch of spring jar files to the build path for each new project that is created. Wouldn't there be a way to simply run a single script on my dev box (and another script on my server), which would simply retrieve a zipfile of all spring jars, and unpackage them into a standard java library path, so that I wouldn't have to worry about performing those steps for each new project I create? My objective would be to create new spring projects that will have all spring dependancies resolved simply via the import statements.
answer count: 1
has comment: http://stackoverflow.com/comment/31161169
score: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/20787917
has title: Can java default library path simply be updated with Spring jars to avoid per project configuration?
tagged with: java
type: Question

http://stackoverflow.com/comment/31208310
comment on: http://stackoverflow.com/a/20796579
type: AnswerComment
has text: Thanks. I'm trying to compile on Ubuntu 12.04 but still it complains that the option `-G` isn't recognized by `ld` and that it can't find `-lmail` and `-ljava`. At least it compiles now, but the linker still fails.
score: 0
type: Comment

http://stackoverflow.com/comment/31244346
score: 0
has text: The post I attached below seems to indicate that apps should still be able to send and receive sms's as long as the user does not change the default sms app.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20832037

http://stackoverflow.com/comment/31560006
type: Comment
has text: **correction** my initial t matrix where I'm setting the values, I didn't set up as a sparse matrix, but I think I should. Right now I'm just creating a regular zero matrix: `AMatrix t = ZeroMatrix.create(n, n).clone();`
comment on: http://stackoverflow.com/a/20783858
score: 0
type: AnswerComment

http://stackoverflow.com/q/20824136
has answer: http://stackoverflow.com/a/20824887
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/31228804
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/31227885
tagged with: secret-key
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/31228215
tagged with: file
has title: Convert String to Secret key in java
type: Question
answer count: 1
downvote count: 3
has body: I have encrypted my file using DES algorithm and Stored tat DES Secretkey into database converting it into String. Now i want to Convert that String to Secretkey. Here is the code. secret_key = KeyGenerator.getInstance("DES").generateKey(); alogrithm_specs = new IvParameterSpec(initialization_vector); // set encryption mode ... encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding"); encrypt.init(Cipher.ENCRYPT_MODE, secret_key, alogrithm_specs); //out.print("actual secret_key:"+secret_key); String keyString = encoder.encode(secret_key.getEncoded()); //out.print("keyString:"+keyString); byte[] encodedKey = decoder.decodeBuffer(keyString); //out.print("byte[]:"+encodedKey); secret_key= new SecretKeySpec(encodedKey,0,encodedKey.length, "DES"); //out.print("after encode &amp; decode secret_key:"+secret_key); Above code will convert String into key as below: actual secret_key: 'com.sun.crypto.provider.DESKey@1807c' keyString:hvsCa0XcXhY= byte[]:[B@7c91fe after encode &amp; decode secret_key:'javax.crypto.spec.SecretKeySpec@1807c` I want to Store that Secretkey into database by converting the key into String. Then while decrypting i want convert that String back to Key.
has comment: http://stackoverflow.com/comment/31228262

http://stackoverflow.com/comment/31216652
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20817665
has text: @S.N Its not about code. It is that I can not get the idea of the rules. Lets start from the beginning. You have 2 players and one matrix. First player removes last row, so matrix became [1 2], then second player removes last column so matrix become [1]. Now, who wins ?

http://stackoverflow.com/comment/31234666
score: 1
has text: If your production environment is on a different network from the live one, then they might have a different SMTP server. And SMTP servers usually don't like processing email from foreign networks. Its called RELAYING and they prohibit that in order to control SPAM.
comment on: http://stackoverflow.com/a/20827158
type: Comment
type: AnswerComment

http://stackoverflow.com/a/20807759
type: Answer
accepted answer of: http://stackoverflow.com/q/20807669
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/31197568
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20807669
has body: You're getting a NullReferenceException on the line containing tvEmail.setText(...); swapping your conditional blocks to check EMAIL for null vs. not isn't going to change things, since EMAIL isn't getting involved on the line causing the error. You need to look at tvEmail, because that is what's being null at the time your error occurs.

http://stackoverflow.com/comment/31121323
has text: What's the expected output?
type: QuestionComment
comment on: http://stackoverflow.com/q/20765118
score: 0
type: Comment

http://stackoverflow.com/comment/31003945
type: Comment
has text: also [this post](http://stackoverflow.com/a/2251863/1140338) here suggests using the ProcessBuilder.
score: 0
comment on: http://stackoverflow.com/a/20700258
type: AnswerComment

http://stackoverflow.com/comment/31134807
type: AnswerComment
comment on: http://stackoverflow.com/a/20772382
score: 0
type: Comment
has text: Using otto you're doing the same thing, but if you want you can send intents to your own activity/fragment from the receiver and pass info about internet state.

http://stackoverflow.com/comment/30985175
has text: You create a Thread using a class that implement the Runnable interface, this interface has a method called run() that's where you put the code or the call to execute. Once created the thread you need to call the start() method to run the Runnable :D. Thread t = new Thread(Runnable) --> then --> t.start()
type: Comment
comment on: http://stackoverflow.com/a/20688663
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31219635
score: 0
type: Comment
type: QuestionComment
has text: What is the structure inside the Test\src folder? Is javatuples-1.2 a jar?
comment on: http://stackoverflow.com/q/20819435

http://stackoverflow.com/a/20739934
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20739346
has body: 1) Code in PersonDAO inside if throws NullPointerException if (pendingcount == 0) { PersonBean pbb = null; //assign null reference pbb.setDate("0"); //setting value to null reference throws NPE listdateperson.add(pbb); } 2) Missing to assign object reference PersonBean pbbb = null; while (rs.next()) { PersonBean = new PersonBean(); //how can you assign object reference to class PersonBean? It must be pbbb = new PersonBean(); You are using PreparedStatement, then use place holder(?) for passing the parameter to query, this will Prevent SQL injection See also PreparedStatement java docs
answers question: http://stackoverflow.com/q/20739346
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/20740444
has answer: http://stackoverflow.com/a/37516428
type: Question
has comment: http://stackoverflow.com/comment/31077231
has answer: http://stackoverflow.com/a/27326507
has comment: http://stackoverflow.com/comment/31077445
tagged with: java
upvote count: 11
has answer: http://stackoverflow.com/a/20740984
tagged with: luhn
has answer: http://stackoverflow.com/a/22789579
tagged with: validation
tagged with: credit-card
has title: Check Credit Card Validity using Luhn Algorithm
tagged with: arrays
has answer: http://stackoverflow.com/a/20725826
has answer: http://stackoverflow.com/a/56731034
answer count: 13
has comment: http://stackoverflow.com/comment/31050904
has answer: http://stackoverflow.com/a/48972159
linked to: http://stackoverflow.com/q/5376972
has comment: http://stackoverflow.com/comment/31077366
favorite count: 0
linked to: http://stackoverflow.com/q/37352477
downvote count: 0
has answer: http://stackoverflow.com/a/56730943
has answer: http://stackoverflow.com/a/20740650
has answer: http://stackoverflow.com/a/73377355
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32232932
score: 11
has body: I tried to check the validation of credit card using Luhn algorithm, which works as the following steps: Double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number. 2 * 2 = 4 2 * 2 = 4 4 * 2 = 8 1 * 2 = 2 6 * 2 = 12 (1 + 2 = 3) 5 * 2 = 10 (1 + 0 = 1) 8 * 2 = 16 (1 + 6 = 7) 4 * 2 = 8 Now add all single-digit numbers from Step 1. 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37 Add all digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 Sum the results from Step 2 and Step 3. 37 + 38 = 75 If the result from Step 4 is divisible by 10, the card number is valid; otherwise, it is invalid. For example, the number 4388576018402626 is invalid, but the number 4388576018410707 is valid. Simply, my program always displays valid for everything that I input. Even if it's a valid number and the result of sumOfOddPlace and sumOfDoubleEvenPlace methods are equal to zero. Any help is appreciated. import java.util.Scanner; public class CreditCardValidation { public static void main(String[] args) { Scanner in = new Scanner(System.in); int count = 0; long array[] = new long [16]; do { count = 0; array = new long [16]; System.out.print("Enter your Credit Card Number : "); long number = in.nextLong(); for (int i = 0; number != 0; i++) { array[i] = number % 10; number = number / 10; count++; } } while(count &lt; 13); if ((array[count - 1] == 4) || (array[count - 1] == 5) || (array[count - 1] == 3 &amp;&amp; array[count - 2] == 7)){ if (isValid(array) == true) { System.out.println("\n The Credit Card Number is Valid. "); } else { System.out.println("\n The Credit Card Number is Invalid. "); } } else{ System.out.println("\n The Credit Card Number is Invalid. "); } } public static boolean isValid(long[] array) { int total = sumOfDoubleEvenPlace(array) + sumOfOddPlace(array); if ((total % 10 == 0)) { for (int i=0; i&lt; array.length; i++){ System.out.println(array[i]);}…
has answer: http://stackoverflow.com/a/50321538
has answer: http://stackoverflow.com/a/46791656
has comment: http://stackoverflow.com/comment/31076989

http://stackoverflow.com/q/20837164
has answer: http://stackoverflow.com/a/20837339
has body: In the Start Class I define two objects and pass information as arguments to these objects constructors I than create two instance variables in the Person Class and instantiate in the constrcutor the two variables why am I not able to call the getName() method from class A? How would I call the getName() method from class A()? public class Start { public static void main(String[] args) { A objectA = new A("John"); B objectB = new B(24); Person a = new Person(objectA, objectB); a.getAge(); } } public class Person&lt;A, B&gt; { A aa; B bb; Person(A aa, B bb) { this.aa = aa; this.bb = bb; } public void getAge() { System.out.println(this.aa.getClass().getName()); System.out.println(this.bb.getClass().getName()); System.out.println(this.aa.getName()); } } public class A { public String name; public A(String name) { this.name = name; } String getName() { return this.name; } }
has answer: http://stackoverflow.com/a/20837305
accepted answer: http://stackoverflow.com/a/20837305
has comment: http://stackoverflow.com/comment/31252094
type: AnsweredQuestion
tagged with: java
has title: Calling a method from a subclass
type: Question
has comment: http://stackoverflow.com/comment/31252143
has answer: http://stackoverflow.com/a/20837803
possible better answer: http://stackoverflow.com/a/20837199
answer count: 6
has answer: http://stackoverflow.com/a/20837199
has answer: http://stackoverflow.com/a/20837303
score: 0
has answer: http://stackoverflow.com/a/20837713

http://stackoverflow.com/comment/31330071
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20739232
type: AnswerComment
has text: i had forgot to add the connection pool configuration in my xml...was that the problem..? i have posted my cfg.xml above with thw required modificationj..but i am getting some weird exception...i need help..

http://stackoverflow.com/comment/30999421
type: Comment
type: QuestionComment
has text: @Anubhab, I dont know how to use annotation and inject AmericasDataSource(datasource, refer from spring xml) into 'amerdao'(instance of DeactivationService class) and inject EMEADataSource(datasource, refer from spring xml) into emeadao(instance of DeactivationService class).
comment on: http://stackoverflow.com/q/20697183
score: 0

http://stackoverflow.com/a/20925378
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20818489
accepted answer of: http://stackoverflow.com/q/20818489
score: 0
has body: Since this is a simple program it doesn't need to be as most efficient possible so I end up using an answer posted here that, for some reason, was deleted. Like this: button.setFont(button.getFont().deriveFont((float)(button.getWidth()/2))); in formComponentResized.

http://stackoverflow.com/a/20839296
type: Answer
answers question: http://stackoverflow.com/q/20838106
upvote count: 3
score: 3
has body: Your program could also be read as: name attribute of a creature is not the same as name attribute of giraffe. It's just that they have the same spelling ! Well, your examples also points to certain nitty-gitty of data hiding. Any use of the derived class member name will always refer to the member defined as part of the derived class. To refer to the base class member, you must qualify it with the keyword super. public class Base { protected String s = "Hello Base"; public void get() { System.out.println("Base string:" + s); } public static void main(String[] args) { Base b = new Base(); b.get(); Derived d = new Derived(); d.get(); ((Base) d).get(); Base der = new Derived(); der.get(); } } class Derived extends Base { protected String s = "Hello Derived"; @Override public void get() { System.out.println("Derived String: " + s); } } Output of the Program: Base string:Hello Base Derived String: Hello Derived Derived String: Hello Derived Derived String: Hello Derived
downvote count: 0

http://stackoverflow.com/q/20685501
downvote count: 0
linked to: http://stackoverflow.com/q/6438178
favorite count: 0
has answer: http://stackoverflow.com/a/20686553
tagged with: io
type: AnsweredQuestion
tagged with: cxf
upvote count: 3
has comment: http://stackoverflow.com/comment/30980150
tagged with: java
has title: Saving outbound messages in CXF interceptor
has comment: http://stackoverflow.com/comment/30977328
type: Question
has body: I have an extremely hard problem for me with CXF, which I'm trying to solve (unsuccessfully) for more than a month. I'd read lots of similar questions, but nothing could help me. First of all, let me introduce part of the code, which I use to save the outbound messages: public void handleMessage(SoapMessage message) throws Fault { OutputStream os = message.getContent(OutputStream.class); CacheAndWriteOutputStream cwos = new CacheAndWriteOutputStream(os); message.setContent(OutputStream.class, cwos); cwos.registerCallback(new LoggingOutCallBack()); } class LoggingOutCallBack implements CachedOutputStreamCallback { public void onClose (CachedOutputStream cos) { try { String result = IOUtils.toString(cos.getInputStream()); } catch (Exception e) { LogFactory.getLog(SwcFinalResponseInterceptor.class).error(ExceptionUtils.getStackTrace(e)); } } public void onFlush (CachedOutputStream arg) { } } I use the PRE_STREAM phase. This approach is mentioned in lots of places (for example, here), but it causes some rare errors. I have approximately 20000 requests a day, so, say, for 200 large requests this approach fails - for one of the further requests I get Stream closed error. 2013-12-19 15:37:47,902 [WARN ] org.apache.cxf.common.logging.LogUtils.doLog(LogUtils.java:400) 5880162-Interceptor for {http://service.ws.swc.comtech/}FrequentFlyerServiceWsService has thrown exception, unwinding now 5880163-org.apache.cxf.interceptor.Fault: Stream closed 5880164- at org.apache.cxf.interceptor.LoggingInInterceptor.logging(LoggingInInterceptor.java:144) 5880165- at org.apache.cxf.interceptor.LoggingInInterceptor.handleMessage(LoggingInInterceptor.java:73) I'm absolutely sure that is because of this line in my code: cos.getInputStream() I've tested lots of times without this only line, and everything worked correct, but when I add this line, errors appear immediately. I suppose that's because CXF stores stream data for large streams not in memory but in some temporary file. It was describe…
accepted answer: http://stackoverflow.com/a/20686553
score: 3
linked to: http://stackoverflow.com/q/6915428
linked to: http://stackoverflow.com/q/5313041
answer count: 1

http://stackoverflow.com/a/20739641
score: 1
answers question: http://stackoverflow.com/q/20739605
downvote count: 0
has comment: http://stackoverflow.com/comment/31076056
type: Answer
upvote count: 1
has body: You are catching the Exception. So it will not transfer back the control to the calling function unless entire function is executed. If you want to skip the LOG.info("Out Side Exception . . . Before Returning "); statement you can do catch (Exception e) { LOG.info("IN Exception!!"); throw e; } And about when ever the throw is called, it simply stops further execution in the same class and return the control back from where this class's function was called... Yes only if you do not catch it. You catch an Exception if you intent to do something with it which includes logging it and rethrowing.

http://stackoverflow.com/comment/31280853
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20740236
type: Comment
has text: That was the first alternative that i had suggested you. You are welcome :)

http://stackoverflow.com/comment/31214705
has text: The greater than .5 is just a 50/50 random chance of it being a boy or a girl. Math.random() returns a double between 0 and 1
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20811277
type: AnswerComment

serialization
tags question: http://stackoverflow.com/q/20847711
tags question: http://stackoverflow.com/q/20777620
tags question: http://stackoverflow.com/q/20801029
tags question: http://stackoverflow.com/q/20755523
tags question: http://stackoverflow.com/q/20700530
tags question: http://stackoverflow.com/q/20799763
tags question: http://stackoverflow.com/q/20787858
tags question: http://stackoverflow.com/q/20825462
tags question: http://stackoverflow.com/q/20719196
tags question: http://stackoverflow.com/q/20732144
tags question: http://stackoverflow.com/q/20791861
tags question: http://stackoverflow.com/q/20713107
tags question: http://stackoverflow.com/q/20684719
tag name: serialization
tags question: http://stackoverflow.com/q/20692586
tags question: http://stackoverflow.com/q/20686037
tags question: http://stackoverflow.com/q/20744546
tags question: http://stackoverflow.com/q/20748792
tags question: http://stackoverflow.com/q/20841731
tags question: http://stackoverflow.com/q/20683086
tags question: http://stackoverflow.com/q/20698836
type: Tag
tags question: http://stackoverflow.com/q/20732677
tags question: http://stackoverflow.com/q/20775826
tags question: http://stackoverflow.com/q/20843221
tags question: http://stackoverflow.com/q/20725508
tags question: http://stackoverflow.com/q/20701082
tags question: http://stackoverflow.com/q/20843899
tags question: http://stackoverflow.com/q/20752143

http://stackoverflow.com/q/20732328
tagged with: java
has answer: http://stackoverflow.com/a/79233225
tagged with: ejb
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20739137
upvote count: 4
answer count: 3
has title: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory
downvote count: 0
has comment: http://stackoverflow.com/comment/31062823
has comment: http://stackoverflow.com/comment/31063342
favorite count: 0
has comment: http://stackoverflow.com/comment/31063390
has comment: http://stackoverflow.com/comment/31063048
type: Question
has comment: http://stackoverflow.com/comment/31063585
has answer: http://stackoverflow.com/a/20732863
has body: Here this my code: SpeakerRemote.java package test; import javax.ejb.Remote; @Remote public interface SpeakerRemote { String sayAPhrase( String phrase ); } SpeakerBean.java package test; import javax.ejb.Stateless; @Stateless public class SpeakerBean implements SpeakerRemote { @Override public String sayAPhrase( String phrase ){ return "Speaker Service:\t" + phrase; } } I assembled it with maven. Here I show you invoking part: Invoker.java import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.Properties; public class Invoker { public static InitialContext getContext() throws NamingException { final Properties properties = new Properties(); properties.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" ); properties.put( Context.PROVIDER_URL, "jnp://127.0.0.1:1099" ); return new InitialContext( properties ); } } Main.java import test.SpeakerRemote; import javax.naming.InitialContext; import javax.naming.NamingException; public class Main { public static void main( String... args ) { try { InitialContext context = Invoker.getContext(); SpeakerRemote speaker = ( SpeakerRemote ) context.lookup( "SpeakerBean/remote" ); System.out.println( speaker.sayAPhrase( "Hello, World!" ) ); } catch ( NamingException e ) { e.printStackTrace(); } } } Having started this app I received this exception: "Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]" Please help me, because I really need to understand it! P.S. I use jboss 7.1.1 Final + EJB 3.1 + Maven 3.1.1 + Java 1.7 + Win7
tagged with: maven
has comment: http://stackoverflow.com/comment/31063155
score: 4
has comment: http://stackoverflow.com/comment/31063260

http://stackoverflow.com/q/20762001
has answer: http://stackoverflow.com/a/25118544
accepted answer: http://stackoverflow.com/a/25118544
has comment: http://stackoverflow.com/comment/31115664
tagged with: java
tagged with: seekbar
has answer: http://stackoverflow.com/a/54109992
has answer: http://stackoverflow.com/a/20762045
has answer: http://stackoverflow.com/a/53893455
has answer: http://stackoverflow.com/a/78901621
possible better answer: http://stackoverflow.com/a/20762136
has answer: http://stackoverflow.com/a/66276735
has title: How to set seekbar min and max value
has answer: http://stackoverflow.com/a/52350712
has answer: http://stackoverflow.com/a/23534952
has answer: http://stackoverflow.com/a/48861159
downvote count: 0
has comment: http://stackoverflow.com/comment/31115516
has answer: http://stackoverflow.com/a/38589845
answer count: 16
favorite count: 0
has answer: http://stackoverflow.com/a/34167542
has answer: http://stackoverflow.com/a/45711977
has body: I have a seekbar and trying to set the value from 60 to 180 for one and 40 to 190 for the second one in step of 1. sb1 = (SeekBar) findViewById(R.id.progresss); sb1.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub //int inVal = Integer.parseInt(String.valueOf(seekBar.getProgress())); //inVal =+ 70; //Toast.makeText(getApplicationContext(), String.valueOf(inVal),Toast.LENGTH_LONG).show(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { // TODO Auto-generated method stub progress =+ 70; Toast.makeText(getApplicationContext(), String.valueOf(progress),Toast.LENGTH_LONG).show(); } }); is not working. Any idea how to fix it?
upvote count: 52
tagged with: android
linked to: http://stackoverflow.com/q/3490951
has comment: http://stackoverflow.com/comment/31116304
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20762136
score: 52
has answer: http://stackoverflow.com/a/53892285
has answer: http://stackoverflow.com/a/20762048
has answer: http://stackoverflow.com/a/29209156
type: Question

http://stackoverflow.com/a/20713590
answers question: http://stackoverflow.com/q/20713341
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The following code public static void main(String[] args) { MyObject original = new MyObject(); Gson gson = new Gson(); String payload = gson.toJson(original); // generate json System.out.println(payload); MyObject recreated = gson.fromJson(payload, MyObject.class); // parse json System.out.println(recreated.myString); } static class MyObject { public String myString = "{\"payload\":\"test\"}"; } prints {"myString":"{\"payload\":\"test\"}"} {"payload":"test"} So I don't see what you're worried about. I get no errors. How can I prevent gson to try to parse value of my variable? Do you want the value of myString in the generated json or not?

http://stackoverflow.com/a/20694528
upvote count: 1
has body: I think java.util.EnumMap may be what you're looking for. You can use Enum#valueOf to look up the enum value from the given String, like Sam Yonnou mentioned.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20680377
type: Answer

http://stackoverflow.com/q/20817856
has title: How does a float assign with a Float?
has answer: http://stackoverflow.com/a/20817879
type: UnansweredQuestion
has body: Float is an object, float is a variable. And how to a float can assign with a Float. Thank you! Float F = new Float(3); float f = F;
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31216274
has answer: http://stackoverflow.com/a/20817882
has comment: http://stackoverflow.com/comment/31216181
answer count: 2
linked to: http://stackoverflow.com/q/1570416
favorite count: 0
score: 0

http://stackoverflow.com/q/20788447
type: Question
tagged with: java
has body: I'm building a java program that reads a file from Remax.com containing ids from around 300 properties. I parses the html file of (www.remax.pt/(id)) and then writes some image URLs (found in the HTML page) into another file. It works well, but hangs in the middle of the process. Sometimes it writes 15 properties, sometimes 30 and sometimes 4. It seems random. I can't figure out when and why it hangs. It's probably something with the connection maybe? Here's my code, more or less: try { //initializing variables reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputdir), "UTF-8")); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(ouputDir)), "UTF-8")); String line = ""; int nProperty = 1; //reading Property id while ((line = reader.readLine()) != null) { id = line; //opening a connection to the property page, so i can grab the html and the images. URLConnection spoof = new URL("http://www.remax.pt/" + id).openConnection(); spoof.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; H010818)"); System.out.println(" Downloading photos from property " + nProperty + " - " + id); //getting an input stream to read the page InputStream in = spoof.getInputStream(); try { InputStreamReader inR = new InputStreamReader(in); BufferedReader buf = new BufferedReader(inR); // searching the html page for the images i want while ((lineaux = buf.readLine()) != null) { if (lineaux.contains(".jpg")) { Pattern p = Pattern.compile("www.remax.pt/.*?.jpg"); Matcher m = p.matcher(lineaux); int i = 0; int principal = 0; String link = null; while (m.find()) { writer.write(m.group()); writer.newLine(); System.out.println("\t Downloading Photo " + i); } } } } finally { in.close(); } nProperty++; } } catch (FileNotFoundException e) { System.out.println("File Not Found"); e.printStackTrace(); } finally { try { writer.close(); reader.close(); } catch (Exception exp) { } } Then again, the code works. It's doing exactly what I…
has comment: http://stackoverflow.com/comment/31163197
answer count: 1
has comment: http://stackoverflow.com/comment/31162895
has answer: http://stackoverflow.com/a/20789767
has comment: http://stackoverflow.com/comment/31162446
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31162416
score: 0
has title: Getting HTML page with java hangs
accepted answer: http://stackoverflow.com/a/20789767

http://stackoverflow.com/q/20784469
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20784895
tagged with: java
type: Question
has title: Send file over socket (with threading on server-side) - not working
score: 0
has body: I have a Client-Server programm. The Client-programm sends a file to the server and the server receives the file. my problem is, that the file is not really receiving on the server...I't creates a file.txt in the server-directory, but it is empty...(yes i'm sure that ne file.txt in the client-directory is not empty ;) ) I think the problem is the while-loop in Client.java, because it is never embarrassed.... For the future i implements now on the server side one thread per receiving file. The client-programm: package controller; public class Main { public static void main(String[] args) { new Controller(); } } - package controller; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.net.Socket; import java.net.UnknownHostException; public class Controller { public Controller() { try { sendFileToServer(); } catch (IOException e) { e.printStackTrace(); } } public void sendFileToServer() throws UnknownHostException, IOException { Socket socket = null; String host = "localhost"; socket = new Socket(host, 5555); String filename = "file.txt"; File file = new File(filename); OutputStream outText = socket.getOutputStream(); PrintStream outTextP = new PrintStream(outText); outTextP.println(filename); long filesize = file.length(); byte[] bytes = new byte[(int) filesize]; FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream()); int count; System.out.println("Start sending file..."); while ((count = bis.read(bytes)) &gt; 0) { System.out.println("count: " + count); out.write(bytes, 0, count); } System.out.println("Finish!"); out.flush(); out.close(); fis.close(); bis.close(); socket.close(); } } - The server-programm: import java.io.IOException; public class Main { public static void m…

http://stackoverflow.com/comment/31267118
has text: Showing the exception message and first few lines of the traceback would be helpful (and is often an requirement to get anyone to look at your problem at all).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20845239

http://stackoverflow.com/q/20830701
has answer: http://stackoverflow.com/a/20831071
favorite count: 0
has answer: http://stackoverflow.com/a/20831118
tagged with: android
linked to: http://stackoverflow.com/q/151777
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20831118
has comment: http://stackoverflow.com/comment/31241046
tagged with: super
has title: super.onCreate() changes my variables
upvote count: 1
has comment: http://stackoverflow.com/comment/31240925
has comment: http://stackoverflow.com/comment/31240916
type: Question
has body: I've recently started Android programming and have run into many problems, but have been able to solve all except this one. For the sake of simplicity, I'll try to sum up what is happening. I have a MainActivity, which has a static ArrayList I go into a sub-activity, where I change the value of the ArrayList of MainActivity I leave the sub-activity, entering MainActivity I check the value of this ArrayList, and it now contains null values Putting Logcat statements before and after the super.oncreate() call in MainActivity.onCreate(), I can see that some part of super.onCreate() changes the previous correct values in the ArrayList to null. In case it is important, this static ArrayList contains custom (serializable) objects, each of which contains an ArrayList of custom (serializable) objects whose values themselves are null. If that's confusing, I'll try to represent it in pseudo-code: static ArrayList&lt;CustomObject&gt; CustomObject{ ArrayList&lt;OtherCustomObject&gt; //values of this ArrayList become null } Of course if more information is needed, I will try to provide as much as I can.
has comment: http://stackoverflow.com/comment/31240914
tagged with: oncreate
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31241013
answer count: 2
tagged with: null
has comment: http://stackoverflow.com/comment/31240961
downvote count: 0
possible better answer: http://stackoverflow.com/a/20831071

http://stackoverflow.com/q/20751008
downvote count: 1
tagged with: java
has title: ImageView setScaleType not working
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20751278
has comment: http://stackoverflow.com/comment/31096516
favorite count: 0
has body: I have an ImageView and I want to to scale CENTER_CROP. If I set the image src and scale type in XML it works great. But I need to set the image in code. The following fails to scale correctly. Instead of center cropping it stretches the image to fill the width. imageView.setBackgroundResource(R.drawable.my_image); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); I tried reordering these lines and I tried leaving out the setScaleType and leaving that to the XML. Neither helps.
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/32813240
accepted answer: http://stackoverflow.com/a/20751278
has answer: http://stackoverflow.com/a/32813240
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/31096546

http://stackoverflow.com/comment/31125948
type: Comment
has text: I need to keep adding text to the place where the text should be displayed. So I call append(). But I'm not sure if it's good to keep calling setText() on JTextPane.
comment on: http://stackoverflow.com/a/20767575
type: AnswerComment
score: 0

http://stackoverflow.com/a/20734596
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31067098
has body: What if you commit the edit to the JFormattedTextField on focus lost? @Override public void focusLost(FocusEvent e) { try { if (field.isEditValid()) { field.commitEdit(); } } catch (ParseException e1) { e1.printStackTrace(); } field.setBackground(Color.WHITE); System.out.println(String.valueOf((Long) field.getValue())); }
accepted answer of: http://stackoverflow.com/q/20734217
answers question: http://stackoverflow.com/q/20734217
upvote count: 3
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/31067048

http://stackoverflow.com/comment/31271171
comment on: http://stackoverflow.com/q/20847144
score: 0
type: Comment
has text: Hah, touching on the call vs invoke debate that rages. As I understand it you, to "invoke" requires an "invocant", a class or object. Ex: Object.getClass(). While a "call" just refers to simple function or subroutine call. Simply "sendMessage()" in your case. This debate get pretty lengthy esp in diff langs, checkout this discussion here: http://english.stackexchange.com/questions/59045/call-vs-invoke-informatics-context
type: QuestionComment

http://stackoverflow.com/a/20848081
score: 1
upvote count: 1
has body: Found my error. And it was as easy as frustrating… the h:form enctype="multipart/form-data" needs an id. I need the enctype for uploading files. And then the form has to have an id… Two pages helped me finding this bug: "7. If a parent of the with the UICommand button is been rendered/updated by an ajax request beforehand, then the first action will always fail." (commandButton/commandLink/ajax action/listener method not invoked or input value not updated) and this example of using file upload: http://jsflive.wordpress.com/2013/04/23/jsf22-file-upload/ It's difficult find such tiny errors if the code is not your own…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20826701
type: Answer
answers question: http://stackoverflow.com/q/20826701

http://stackoverflow.com/comment/31053828
comment on: http://stackoverflow.com/a/20727431
type: AnswerComment
score: 0
has text: I am still getting the no matches found exception after changing to your example pattern. :(
type: Comment

abstract-methods
tags question: http://stackoverflow.com/q/20755258
type: Tag
tag name: abstract-methods

http://stackoverflow.com/q/20827210
has title: Two applications need to export and import a single file which needs to include data and images, best file type?
tagged with: file-type
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20828131
linked to: http://stackoverflow.com/q/3211156
has comment: http://stackoverflow.com/comment/31233589
has body: I'm making two Java applications one to collect data, another to use it. The one collecting will be importing a file from the other which will include data and images and will be decrypted. I'm unsure what filetype to use. So far all of the data is in XML and works great but I need the images and was hoping not to have to rely on giving all the images in a folder with a path reference. Ideas?
answer count: 4
has answer: http://stackoverflow.com/a/20827371
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/5232445
type: Question
has answer: http://stackoverflow.com/a/20827693
has answer: http://stackoverflow.com/a/20827317
accepted answer: http://stackoverflow.com/a/20827317
possible better answer: http://stackoverflow.com/a/20827371
upvote count: 1

http://stackoverflow.com/q/20689411
has comment: http://stackoverflow.com/comment/30985134
has answer: http://stackoverflow.com/a/20690048
type: Question
tagged with: graphics
has title: Graphics painting strategy(performance)
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/30985218
possible better answer: http://stackoverflow.com/a/20690048
has comment: http://stackoverflow.com/comment/30985678
has comment: http://stackoverflow.com/comment/30986619
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/30987917
favorite count: 0
has comment: http://stackoverflow.com/comment/30988390
score: 2
has body: In my game I have a gamepanel which draws my map layers: 'ground/buildings/objects layer', then player sprite, then enemies/npcs/mobs, then 'above layer(tiles to draw above player)'. This was working great and running smoothly. I then started to work on a minimap JInternalFrame. It actually looks great for what I need but I am concerned with performance. After adding the minimap I noted some slowdown of painting. My biggest resolution supports a map of: else if (scrnsize.width &gt;= 1440 &amp;&amp; scrnsize.height &gt;= 1024){ //large&amp;wide //45x29(32x32px tiles) //1440, 1024 Basically my question is, is there a better way I can do this(than below code) or methods I can call for offscreen buffer or something? This is the Minimap code. As you can see I have logic in the paintComponent to not redraw unless the refreshMinimap == true(the player moves or dies). This helped get rid of most noticable lag, but I still am noticing some. Any help would be super appreciated. public MinimapGamePanel() { super(); logger.addAppender(GUILog4JFileHelper.fileAppender); gamePanelImage = new BufferedImage(32 * MyClient.xTiles, 32 * MyClient.yTiles, BufferedImage.TYPE_INT_ARGB); setLayout(new BorderLayout()); setBorder(BorderFactory.createLineBorder(Color.black)); } public void paintComponent(Graphics g) { logger.trace("begin: REPAINTNG..."); g2 = (Graphics2D)g; //map if (refreshMinimap){ RefreshMinimap(); refreshMinimap = false; } g2.drawImage(gamePanelImage, 0, 0, null); g2.dispose(); logger.trace("end: REPAINTNG..."); } private void RefreshMinimap() { logger.trace("Map drawing started."); int count = (int) ((MyClient.characterX - (MyClient.xTiles*1.5)) + ((MyClient.characterY - (MyClient.yTiles*2)) * MyClient.mapWidth)); for (int x = 0; x &lt; MyClient.xTiles*3; x++){ for (int y = 0; y &lt; MyClient.yTiles*4; y++){ if (count &gt; -1 &amp;&amp; count &lt; (MyClient.mapWidth * MyClient.mapHeight)){ if (!MyClient.groundLayer[count].equals("0")){ //don't draw full transparent tiles …
downvote count: 0
has answer: http://stackoverflow.com/a/20690730
accepted answer: http://stackoverflow.com/a/20690730

http://stackoverflow.com/comment/31214062
comment on: http://stackoverflow.com/q/20816800
type: Comment
type: QuestionComment
score: 2
has text: What errors do you get? I can't answer the question when all you say is "It doesn't work".

http://stackoverflow.com/q/20832604
tagged with: memory
score: 0
answer count: 2
has body: I was wondering if I create a static object and pass it as a value to another object, if that object copies the object or I just have a reference... I want to create a single image and share it among other objects of the same class, like this: In Player.class: BufferedImage image = new BufferedImage(); Animation animation1 = new Animation(image, 1, 2); Animation animation2 = new Animation(image, 3, 6); Animation animation3 = new Animation(image, 5, 10); in Animation.class: private BufferedImage img; public Animation(BufferedImage image, int frame, int maxframes){ this.img = image; } I want each animation to be individual, but use the same image, but I was wondering if inside they get copied (the image, so i have 2 in memory) or they are just gettin referenced. I dont want to create 100 animations with 100 images, but just 1 image and 100 animations. NOTE: The classes are just to make my point. They are not real.
tagged with: static
possible better answer: http://stackoverflow.com/a/20832638
tagged with: reference
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20832660
has answer: http://stackoverflow.com/a/20832638
type: Question
has title: Static object reference inside an object gets copied?
tagged with: java
has answer: http://stackoverflow.com/a/20832660
has comment: http://stackoverflow.com/comment/31244199

http://stackoverflow.com/comment/31003962
type: QuestionComment
has text: http://stackoverflow.com/a/994339/2006839
comment on: http://stackoverflow.com/q/20700388
score: 0
type: Comment

http://stackoverflow.com/comment/31053612
type: QuestionComment
comment on: http://stackoverflow.com/q/20727329
has text: Which Parser is this?
score: 0
type: Comment

http://stackoverflow.com/comment/31183588
comment on: http://stackoverflow.com/q/20800346
score: 0
type: Comment
type: QuestionComment
has text: Triggers may helpful to you? Have you tried with that?

http://stackoverflow.com/q/20823729
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/20823733
accepted answer: http://stackoverflow.com/a/20823733
answer count: 1
tagged with: sorting
has comment: http://stackoverflow.com/comment/31227031
favorite count: 0
has comment: http://stackoverflow.com/comment/31285029
has title: Sort Files in FAT32 without copy them again
has body: I wrote a little program that uses comparators to copy files on a FAT32 drive in the order I want. E.g. alphabetical or smallest file first. (Thanks to Java 7) But if I add new files to the FAT32 drive, all files need to be sorted and copied again, to ensure a correct order. Is there a way to manipulate the FAT32 table with java? Or another easy solution to sort files without copying? I am new in the programing world, so I am happy the program works at all. :)
score: 2

http://stackoverflow.com/a/20696229
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/30997465
has body: When you launch the app in the emulator, MainActivityTest coming up because your AndroidManifest has: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> If you want to launch LoginActivity by default, use <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Else, if you want to display LoginActivity as the first activity based on some conditions, then In android manifest, keep MainActivityTest as the default activity In MainActivityTest->onCreate, check the condition and if condition is true, launch LoginActivity
downvote count: 0
has comment: http://stackoverflow.com/comment/30997348
answers question: http://stackoverflow.com/q/20696000

http://stackoverflow.com/q/20756137
has title: Search filter for filtering custom listview elements
has comment: http://stackoverflow.com/comment/31105844
has answer: http://stackoverflow.com/a/20756205
has comment: http://stackoverflow.com/comment/31106449
upvote count: 3
has answer: http://stackoverflow.com/a/20756260
type: AnsweredQuestion
tagged with: android-filter
tagged with: java
possible better answer: http://stackoverflow.com/a/20756251
downvote count: 3
has comment: http://stackoverflow.com/comment/31105781
has comment: http://stackoverflow.com/comment/31106232
has comment: http://stackoverflow.com/comment/31106048
has body: What i have done :: I am able to implement displaying data through JSON from webservice and populating it into listview I have implemented search-filter to search the elements based on text view What i have problem:: Ill post a series of snapshots explaining my problem Snapshot1 :: i have the listview showing series of elements in list Snapshot2:: Now when i type carl, my names are filtered and only matching result is shown Snapshot3:: Now remove all the things in search bar ..... I should get the display as shown in snapshot1 which is not happening Overall:: what happening is once its filtered i can't use it for another try ... i have to recompile whole project again ListOfContacts.java public class ListOfContacts extends Activity { // Declare Variables JSONObject jsonobject; JSONArray jsonarray; ListView listview; ListViewAdapter adapter; ProgressDialog mProgressDialog; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist; static String NAME = "rank"; static String FLAG = "flag"; EditText mEditText; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from listview_main.xml setContentView(R.layout.listview_main); // Locate the listview in listview_main.xml listview = (ListView) findViewById(R.id.listview); mEditText = (EditText) findViewById(R.id.inputSearch); // Execute DownloadJSON AsyncTask new DownloadJSON().execute(); } // DownloadJSON AsyncTask class DownloadJSON extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); // Create a progressdialog mProgressDialog = new ProgressDialog(ListOfContacts.this); // Set progressdialog title //mProgressDialog.setTitle("Fetching the information"); // Set progressdialog message mProgressDialog.setMessage("Loading..."); mProgressDialog.setIndeterminate(false); // Show progressdialog mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { // Create an array arraylist = new ArrayList&…
has answer: http://stackoverflow.com/a/20756251
accepted answer: http://stackoverflow.com/a/20756205
type: Question
has comment: http://stackoverflow.com/comment/31105722
has comment: http://stackoverflow.com/comment/31106013
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/31106190
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/20756232
answer count: 4

http://stackoverflow.com/a/20807224
score: 1
upvote count: 1
has body: It's giving you no output because you're regular expression is incorrect. You need to remove the beginning .* and place either a capturing or non-capturing group around your Negative Lookahead and reconstruct the ending .* so that the dot . is placed before your last parenthesis and the quantifier * is placed after the last parenthesis before the $ anchor. You need to use the m modifier (multi-line) causing the ^ and $ anchors to match the beginning/end of each line. And I added the use of the i modifier for case-insensitive matching. String functions = "(?im)^(?:(?!(?:catch|if|while|try|return|finally|new|throw)).)*$"; Regular expression: (?im) set flags for this block (case-insensitive) (with ^ and $ matching start and end of line) ^ the beginning of a "line" (?: group, but do not capture (0 or more times) (?! look ahead to see if there is not: (?: group, but do not capture: catch 'catch' | OR if 'if' | OR while 'while' | OR try 'try' | OR return 'return' | OR finally 'finally' | OR new 'new' | OR throw 'throw' ) end of grouping ) end of look-ahead . any character except \n )* end of grouping $ before an optional \n, and the end of a "line" See Working demo
downvote count: 0
answers question: http://stackoverflow.com/q/20806993
type: Answer

http://stackoverflow.com/comment/31224760
type: AnswerComment
comment on: http://stackoverflow.com/a/20822330
has text: @user3141193 "Getting the color of a pixel" is certainly possible if you explain *where the hell the pixel is*. Is it in an array? In a `java.awt.BufferedImage`? On a Swing component? On an AWT component? On a JavaFX component? On an Android component? In some other program on the screen? On a texture loaded into the GPU? In a picture file on disk? On a web page? That matters and you didn't explain it at all. But yes it's an awful thing to want to do in this case.
score: 0
type: Comment

http://stackoverflow.com/comment/31046851
comment on: http://stackoverflow.com/a/20723444
has text: Charset ysb = Charset.defaultCharset(); Charset charset = Charset.forName(ysb.displayName()); always returns false
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20817588
has title: Java copying an ogg file to another file
score: 0
answer count: 3
tagged with: file-io
has comment: http://stackoverflow.com/comment/31219123
tagged with: directory
has comment: http://stackoverflow.com/comment/31217128
has answer: http://stackoverflow.com/a/20817825
tagged with: ogg
has body: This is my first time asking a question but I hope I can get an answer. I am trying to copy an existing resource (ogg file) to another directory. I have had success with reading the file as an AudioInputStream and playing the file, but I cannot figure out how to write the file to another location. I am using vorbisspi, tritonus, jorbis, and jogg. (they all came with the vorbisspi library). Can someone please provide an example of a code to write an ogg file to another directory starting with the reading of the file as a resource? If you use any libraries, please specify. Thanks for your help.
possible better answer: http://stackoverflow.com/a/20817893
has answer: http://stackoverflow.com/a/20817893
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20817825
tagged with: file
linked to: http://stackoverflow.com/q/106770
has answer: http://stackoverflow.com/a/20817904
type: Question
has comment: http://stackoverflow.com/comment/31215687

http://stackoverflow.com/comment/31006856
has text: Just a correction about leap seconds. The second can never accept the value 61 - this was an old mistake of an early posix version, meanwhile corrected. Otherwise the difference between UT1 and UTC could be more than 0.9s which is not allowed in UTC norm. This error is still existing in javadoc of java.util.Date, unfortunately.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20693309
type: Comment

http://stackoverflow.com/q/20845554
tagged with: java
has answer: http://stackoverflow.com/a/25972344
type: Question
has answer: http://stackoverflow.com/a/20950197
linked to: http://stackoverflow.com/q/4587397
has comment: http://stackoverflow.com/comment/31267939
has comment: http://stackoverflow.com/comment/31267515
upvote count: 2
tagged with: jstl
duplicate of: http://stackoverflow.com/q/1463597
has comment: http://stackoverflow.com/comment/31267657
has comment: http://stackoverflow.com/comment/75615174
has comment: http://stackoverflow.com/comment/31267733
has title: How to check if list is empty using jstl
tagged with: jsp
has answer: http://stackoverflow.com/a/20845740
favorite count: 0
has body: I have defined a list collection in my servlet as following: List<BookingRecord> list = getLast24(); req.setAttribute("records", list); Then in JSP, I want to do following algorithm using jstl. If list is not empty, do XXXX, otherwise do YYYY. I did something like this: <c:when test="${not empty records}"> id hotel room guest id start date end date <c:forEach items="${records}" var="record"> <tr<c:if test="${record.endDate != null }"> style="background-color: gainsboro"</c:if>> ${record.id} ${record.hotelName} ${record.roomNumber} ${record.personId} <fmt:formatDate value="${record.startDate}" pattern="yyyy-MM-dd HH:mm"/> <fmt:formatDate value="${record.endDate}" pattern="yyyy-MM-dd HH:mm"/> <c:if test="${record.endDate == null }"> </c:if> </c:forEach> </c:when> <c:otherwise> 目前24小时内，没有订房 </c:otherwise> But the tomcat gave me exception at <c:when test="${not empty records}"> I appreciate if someone could help me out.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20845696
tagged with: http://stackoverflow.com/tag/html
answer count: 4
linked to: http://stackoverflow.com/q/1463597
score: 2
downvote count: 0

http://stackoverflow.com/comment/31241105
comment on: http://stackoverflow.com/q/20830673
score: 0
type: Comment
type: QuestionComment
has text: Why are you globally enabling debug? Unless you want the behavior you're seeing (e.g. during development), set the apache libraries to `info` if not `warn` or `error`.

c#
tags question: http://stackoverflow.com/q/20691262
tags question: http://stackoverflow.com/q/20760359
tags question: http://stackoverflow.com/q/20742257
tags question: http://stackoverflow.com/q/20839242
tag name: c#
tags question: http://stackoverflow.com/q/20789825
tags question: http://stackoverflow.com/q/20727319
tags question: http://stackoverflow.com/q/20750576
tags question: http://stackoverflow.com/q/20849263
tags question: http://stackoverflow.com/q/20776835
tags question: http://stackoverflow.com/q/20703222
tags question: http://stackoverflow.com/q/20835760
tags question: http://stackoverflow.com/q/20797060
tags question: http://stackoverflow.com/q/20830480
tags question: http://stackoverflow.com/q/20682654
type: Tag
tags question: http://stackoverflow.com/q/20732306
tags question: http://stackoverflow.com/q/20732809
tags question: http://stackoverflow.com/q/20764963
tags question: http://stackoverflow.com/q/20809171

http://stackoverflow.com/comment/31045433
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20722796
has text: You need to import the `onItemSelectedListener` like this: `import android.widget.AdapterView.OnItemSelectedListener;` where all of your other imports are. Also, post your new code.

http://stackoverflow.com/comment/31271588
type: QuestionComment
score: 1
has text: What is the question?
comment on: http://stackoverflow.com/q/20847550
type: Comment

http://stackoverflow.com/q/20841966
has title: Other method in thread executing before run method in java
tagged with: java
has body: In my program I am calling the thread to do some job but the other method of thread class executes before the run method. public class Verify extends JFrame implements Runnable { long Local_cid; String local_path; static boolean isIntialised=false; JProgressBar bar; final static ArrayList&lt;Long&gt; ContactList=new ArrayList&lt;&gt;(); final static ArrayList&lt;Long&gt; Scanned=new ArrayList&lt;&gt;(); static boolean flag=true; static boolean Duplicate_flag=true; boolean[] flags=new boolean[6]; public Verify(long ID,String path) { Local_cid=ID; local_path=path; } public boolean[] Return_Flag() { System.err.println("Verify Id"); return flags; } public void dispose_Frame() { System.err.println("Executing First"); dispose(); } @Override public void run() { System.err.println("This should Executed First"); } } When I call this thread via start call the output is as follows: Verify Id Executing First This should Executed First
type: Question
has answer: http://stackoverflow.com/a/20842004
has answer: http://stackoverflow.com/a/20842295
has comment: http://stackoverflow.com/comment/31260864
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31268189
has comment: http://stackoverflow.com/comment/31260811
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31261012

http://stackoverflow.com/comment/31134924
has text: Please read the question to the end. I correctly wrote and read the file (using debug in eclipse). But problem occurs with gson when using jar.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20772796

http://stackoverflow.com/q/20761179
score: -4
has body: How can i remove error from import com.googlecode.javacv.cpp.opencv_core.IplImage? Here i am trying to access my webcam for taking some snapshots and i have found the code somewhere but the imports are giving me error what to do as i don't know the api of these imports. import com.googlecode.javacv.CanvasFrame; import com.googlecode.javacv.FrameGrabber; import com.googlecode.javacv.VideoInputFrameGrabber; import com.googlecode.javacv.cpp.opencv_core.IplImage; public class Wbcm implements Runnable { IplImage image; CanvasFrame canvas = new CanvasFrame("Web Cam"); public Wbcm() { canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); } @Override public void run() { FrameGrabber grabber = new VideoInputFrameGrabber(0); int i=0; try { grabber.start(); IplImage img; while (true) { img = grabber.grab(); if (img != null) { cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise cvSaveImage((i++)+"-capture.jpg", img); // show image on window canvas.showImage(img); } //Thread.sleep(INTERVAL); } } catch (Exception e) { } } }
has comment: http://stackoverflow.com/comment/31114263
has comment: http://stackoverflow.com/comment/31114129
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20761357
has comment: http://stackoverflow.com/comment/31114066
answer count: 1
has comment: http://stackoverflow.com/comment/31114153
has answer: http://stackoverflow.com/a/20761357
has title: Rectify the error on the import statement
has comment: http://stackoverflow.com/comment/31114184
has comment: http://stackoverflow.com/comment/31114022
has comment: http://stackoverflow.com/comment/31114363
upvote count: 3
downvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/31114043

runtimeexception
tags question: http://stackoverflow.com/q/20781120
type: Tag
tag name: runtimeexception

http://stackoverflow.com/a/20722860
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20722796
accepted answer of: http://stackoverflow.com/q/20722796
has body: Set an onItemSelectedListener, then check if it is that item. For example: Spinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { String selectedValue = arg0.getItemAtPosition(arg2).toString(); if(selectedValue.equals("add")){ // add item to spinner } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } }); You need to import onItemSelectedListener like this: import android.widget.AdapterView.OnItemSelectedListener;
type: Answer

http://stackoverflow.com/comment/31112574
has text: With the GUI and database i have no problem. I am curious about the real time interaction and synchronization with other users. should i call an sql query after each second or something??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20757371
type: Comment

http://stackoverflow.com/q/20831885
has title: Stateless Objects good practice or not
has comment: http://stackoverflow.com/comment/31242952
has comment: http://stackoverflow.com/comment/31242854
tagged with: java
downvote count: 1
possible better answer: http://stackoverflow.com/a/20832214
type: Question
has comment: http://stackoverflow.com/comment/31242825
tagged with: stateless
has comment: http://stackoverflow.com/comment/31243292
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/20832214
tagged with: oop
has comment: http://stackoverflow.com/comment/31242767
has answer: http://stackoverflow.com/a/20832293
upvote count: 5
has comment: http://stackoverflow.com/comment/31242861
has comment: http://stackoverflow.com/comment/31242847
score: 4
has body: This is my understanding about stateless objects:Any object created from class that doesn't have class variables is a stateless object. My question is when should we write stateless classes. Is it a good habit to have stateless objects.
tagged with: class
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/20832293
has comment: http://stackoverflow.com/comment/31262511

http://stackoverflow.com/comment/31063747
comment on: http://stackoverflow.com/q/20732341
type: Comment
type: QuestionComment
has text: update your post with the code of selecting the selectedproduct ...
score: 0

http://stackoverflow.com/a/26923334
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20832711
downvote count: 0
has body: you can use something like this Path path = new Path(uri[0].getPath().toString()); if (fileSystem.exists(path)) { FSDataInputStream dataInputStream = fileSystem.open(path); byte[] data = new byte[1024]; while (dataInputStream.read(data) &gt; 0) { //do your stuff here } dataInputStream.close(); }
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20832711

android
tags question: http://stackoverflow.com/q/20724618
tags question: http://stackoverflow.com/q/20762350
tags question: http://stackoverflow.com/q/20844650
tags question: http://stackoverflow.com/q/20819226
tags question: http://stackoverflow.com/q/20839032
tags question: http://stackoverflow.com/q/20823936
tags question: http://stackoverflow.com/q/20839819
tags question: http://stackoverflow.com/q/20738984
tags question: http://stackoverflow.com/q/20756115
tags question: http://stackoverflow.com/q/20733785
tags question: http://stackoverflow.com/q/20812703
tags question: http://stackoverflow.com/q/20743109
tags question: http://stackoverflow.com/q/20790200
tags question: http://stackoverflow.com/q/20726904
tags question: http://stackoverflow.com/q/20702166
tags question: http://stackoverflow.com/q/20763064
tags question: http://stackoverflow.com/q/20829718
tags question: http://stackoverflow.com/q/20848642
tags question: http://stackoverflow.com/q/20806590
tags question: http://stackoverflow.com/q/20761886
tags question: http://stackoverflow.com/q/20722415
tags question: http://stackoverflow.com/q/20775111
tags question: http://stackoverflow.com/q/20839021
tags question: http://stackoverflow.com/q/20799841
tags question: http://stackoverflow.com/q/20745440
tags question: http://stackoverflow.com/q/20705773
tags question: http://stackoverflow.com/q/20814886
tags question: http://stackoverflow.com/q/20734593
tags question: http://stackoverflow.com/q/20813828
tags question: http://stackoverflow.com/q/20752666
tags question: http://stackoverflow.com/q/20710986
tags question: http://stackoverflow.com/q/20732865
tags question: http://stackoverflow.com/q/20730790
tags question: http://stackoverflow.com/q/20816540
tags question: http://stackoverflow.com/q/20821311
tags question: http://stackoverflow.com/q/20834393
tags question: http://stackoverflow.com/q/20682619
tags question: http://stackoverflow.com/q/20751959
tags question: http://stackoverflow.com/q/20737385
tags question: http://stackoverflow.com/q/20821109
tags question: http://stackoverflow.com/q/20789512
tags question: http://stackoverflow.com/q/20744737
tags question: http://stackoverflow.com/q/20693191
tags question: http://stackoverflow.com/q/20829825
tags question: http://stackoverflow.com/q/20800385
tags question: http://stackoverflow.com/q/20749677
tags question: http://stackoverflow.com/q/20808284
tags question: http://stackoverflow.com/q/20714015
tags question: http://stackoverflow.com/q/20680356
tags question: http://stackoverflow.com/q/20705346
tags question: http://stackoverflow.com/q/20815879
tags question: http://stackoverflow.com/q/20817187
tags question: http://stackoverflow.com/q/20790971
tags question: http://stackoverflow.com/q/20719695
tags question: http://stackoverflow.com/q/20825747
tags question: http://stackoverflow.com/q/20707821
tags question: http://stackoverflow.com/q/20767191
tags question: http://stackoverflow.com/q/20694884
tags question: http://stackoverflow.com/q/20837270
tags question: http://stackoverflow.com/q/20738193
tags question: http://stackoverflow.com/q/20835298
tags question: http://stackoverflow.com/q/20707383
tags question: http://stackoverflow.com/q/20749928
tags question: http://stackoverflow.com/q/20740882
tags question: http://stackoverflow.com/q/20824273
tags question: http://stackoverflow.com/q/20721276
tags question: http://stackoverflow.com/q/20718777
tags question: http://stackoverflow.com/q/20779010
tags question: http://stackoverflow.com/q/20824634
tags question: http://stackoverflow.com/q/20811807
tags question: http://stackoverflow.com/q/20737844
tags question: http://stackoverflow.com/q/20789835
tags question: http://stackoverflow.com/q/20794685
tags question: http://stackoverflow.com/q/20769908
tags question: http://stackoverflow.com/q/20840665
tags question: http://stackoverflow.com/q/20754864
tags question: http://stackoverflow.com/q/20819365
tags question: http://stackoverflow.com/q/20836458
tags question: http://stackoverflow.com/q/20723419
tags question: http://stackoverflow.com/q/20746007

http://stackoverflow.com/a/50135534
has comment: http://stackoverflow.com/comment/116346067
has body: Instead of the JSON document, you can update the ObjectMapper object like below : ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
type: Answer
score: 115
downvote count: 0
upvote count: 115
answers question: http://stackoverflow.com/q/20837856

http://stackoverflow.com/q/20781588
downvote count: 0
possible better answer: http://stackoverflow.com/a/20781768
answer count: 6
has answer: http://stackoverflow.com/a/20781768
has answer: http://stackoverflow.com/a/20784150
has answer: http://stackoverflow.com/a/20785295
favorite count: 0
has body: I have a mysql database created on a raspberry pi, I want to access it through a java application running on a laptop in the same local network. I tried connecting that same application with another database on another computer on the network and it worked. I don't know why it isn't working with the RPI. i connect through the following command: String URL = "jdbc:mysql://192.168.11.157/DB_name"; try { connection = DriverManager.getConnection(URL, USER, PASSWORD); } catch (SQLException e) { e.printStackTrace(); } However, an exception is thrown and ERROR: Unable to Connect to Database. is printed to the console. Edit: Knowing that: * I can access the database through a local app running on the same raspberry pi (i used @local). * Can Successfully ping &amp; SSH with the raspberry pi, even run the program mentioned in the previous point through the SSH and it works fine. The stack trace: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:358) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2526) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2311) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:834) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newIns…
has answer: http://stackoverflow.com/a/20781792
upvote count: 1
linked to: http://stackoverflow.com/q/10845703
has title: Connecting to a Remote Database through Java
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4569956
score: 1
has answer: http://stackoverflow.com/a/20781707
accepted answer: http://stackoverflow.com/a/20785295
tagged with: java
tagged with: database
tagged with: mysql
has answer: http://stackoverflow.com/a/20781761
has comment: http://stackoverflow.com/comment/31150384
type: Question
has comment: http://stackoverflow.com/comment/31150369
tagged with: raspberry-pi

http://stackoverflow.com/q/20795923
has body: I'm trying to create a Chatroom using SMACK API for java programmatically for a Java Application. It doesn't show any error but no rooms are getting created. Following is the code : MultiUserChat oMultiUserChat = new MultiUserChat(connection,"test_open_house@example.com"); try { oMultiUserChat.create("test_open_house"); oMultiUserChat.sendRegistrationForm(new Form(Form.TYPE_SUBMIT)); oMultiUserChat.join("example"); } catch (XMPPException e) { e.printStackTrace(); } Using this The chat room isn't getting created. Connection is established succesfully.
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21508920
type: UnansweredQuestion
has title: how to create chat room using smack API in java programatically
tagged with: smack
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/20812703
answer count: 2
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/20813137
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21329013
has title: Can't find org.gradle.api.artifacts.result.ResolvedModuleVersionResult when apply Android plugin in Gradle
tagged with: java
accepted answer: http://stackoverflow.com/a/20813137
tagged with: gradle
possible better answer: http://stackoverflow.com/a/21329013
type: Question
linked to: http://stackoverflow.com/q/3987683
has comment: http://stackoverflow.com/comment/32063506
has body: When I upgrade gradle to 1.10 in my Ubuntu 12.04, I can't build android gradle project, tell me Could not create plugin of type 'AppPlugin', debug message is like: 15:35:52.069 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: org/gradle/api/artifacts/result/ResolvedModuleVersionResult 15:35:52.073 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.AppPlugin.$getStaticMetaClass(AppPlugin.groovy) 15:35:52.077 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.BasePlugin.&lt;init&gt;(BasePlugin.groovy:1627) 15:35:52.101 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.AppPlugin.&lt;init&gt;(AppPlugin.groovy:73) 15:35:52.105 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62) 15:35:52.123 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:67) 15:35:52.132 [ERROR] [org.gradle.BuildExceptionReporter] ... 43 more 15:35:52.135 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.ClassNotFoundException: org.gradle.api.artifacts.result.ResolvedModuleVersionResult 15:35:52.157 [ERROR] [org.gradle.BuildExceptionReporter] ... 48 more Anybody can tell me how to fix this? or jsut Gradle 1.10 have some problems?
upvote count: 12
score: 12

http://stackoverflow.com/comment/31269981
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20843469
type: Comment
has text: Yes, You can copy from your old project

http://stackoverflow.com/comment/31207668
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20782172
type: Comment
has text: Nothing has changed. Calling getInputStream() or getOutputStream() multiple times on a Socket has always returned the same object, as you now agree, and therefore cannot possibly cause concerns with GC, as you stated in your original answer, which you have now altered, and which was never true. You can't have it both ways.

http://stackoverflow.com/comment/30995763
type: QuestionComment
has text: You will need to debug. Here are some ideas for what might be wrong, each of which you should test: Not calling this method. Calling it with a different value. Silently catching the exception before it gets to the code intended to handle it.
type: Comment
comment on: http://stackoverflow.com/q/20695329
score: 0

http://stackoverflow.com/a/20696462
score: 0
has comment: http://stackoverflow.com/comment/30998711
has body: The reason is that your Default charset is not UTF-8 and the bytes for your special char are -61 -66 (Not ascii) Try System.out.println(new String (bdata, "UTF-8")); Example byte[] str = "EUR100011510þGBP100011200þGBP100011250þGBP100011500þGB".getBytes(); try { System.out.println(new String (str, "UTF-8")); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); }
has comment: http://stackoverflow.com/comment/30997795
has comment: http://stackoverflow.com/comment/30998158
has comment: http://stackoverflow.com/comment/30998732
type: Answer
has comment: http://stackoverflow.com/comment/30998105
has comment: http://stackoverflow.com/comment/30997996
has comment: http://stackoverflow.com/comment/30998806
has comment: http://stackoverflow.com/comment/30997855
answers question: http://stackoverflow.com/q/20696367

http://stackoverflow.com/a/20756195
has comment: http://stackoverflow.com/comment/31106530
downvote count: 0
answers question: http://stackoverflow.com/q/20756115
type: Answer
upvote count: 1
score: 1
has body: You need to define RadioButton like below- &lt;RadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/moon_radio" android:button="@android:color/transparent" android:checked="true" android:text="RadioButton1" /&gt; Setting your radioButton background will serve your purpose if you set android:button="@android:color/transparent".

http://stackoverflow.com/q/20699752
has title: data/data/package/files/myfile.txt is not copied to apk file
has body: I followed This thread and copied "MyFile.txt" file to data/data/package/files/ through DDMS>File Explorer and hit run. The emulator displays the content of file, but, when I copy apk and run on device, it throws an exception java.io.FileNotFoundException: data/data/package/files/myfile.txt failed ENOENT. Is it because data/data/package/files/myfile.txt is not copied to apk file? I tried res/raw/myfile.txt it works well. Also, if there is any way to read a file which is in the root? Thanx.
has answer: http://stackoverflow.com/a/20699887
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20699887
score: 0
tagged with: android
tagged with: read-write
answer count: 1

http://stackoverflow.com/q/20799131
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20799235
score: 6
tagged with: swing
tagged with: jbutton
has answer: http://stackoverflow.com/a/20799375
has comment: http://stackoverflow.com/comment/31181921
has comment: http://stackoverflow.com/comment/31181931
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31181760
has answer: http://stackoverflow.com/a/20799220
has comment: http://stackoverflow.com/comment/31181644
upvote count: 6
has answer: http://stackoverflow.com/a/20799356
answer count: 6
tagged with: awt
has comment: http://stackoverflow.com/comment/31181826
has answer: http://stackoverflow.com/a/61441040
has answer: http://stackoverflow.com/a/20799556
has comment: http://stackoverflow.com/comment/31181875
has comment: http://stackoverflow.com/comment/31181930
has title: How can I check that JButton is pressed? If the isEnable() is not work?
has comment: http://stackoverflow.com/comment/31181785
favorite count: 0
has body: How can I check that JButton is pressed? I know that there is a method that its name is "isEnabled" So I try to write a code to test. this code have 2 Jbuttons which are "Add" Button and "Checkout" button. the code will show the "Add button is pressed" message when I press "Checkout" button after I press "Add" button but If the "Add" Button is not pressed before the "Checkout" Button is pressed, the code will show the "Add Button is not pressed" message. Here the code: final JButton btnAdd = new JButton("Add"); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); panel.add(btnAdd); JButton btnConfirm = new JButton("Check Out"); btnConfirm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (btnAdd.isEnabled()) { System.out.println("Add Button is pressed"); } if (!btnAdd.isEnabled()) { System.out.println("Add Button is not pressed"); } } }); When I run this code,the code give only the " Add button is pressed" although I didn't press the "Add" Button. Why does it occur like that?

http://stackoverflow.com/q/20783819
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20784004
upvote count: 0
has title: Passing object as parameter for constructor
favorite count: 0
has body: I have 3 classes. These classes are Class1, Parent and Child. I'm having some trouble to figure out how to write a constructor I need for my Child class. public Class1 { private String firstName; private String lastName; public Class1() { firstName=""; lastName=""; } public Class1(String firstName, String lastName) { this.firstName=firstName; this.lastName=lastName; } //Methods and stuff } public Parent { private Class1 class1; private double number; public Parent(); { class1=new Class1(); number=0; } public Parent(Class1 c, double n) { Class1=c; number=n; } //Methods and stuff } public Child extends Parent { private String string; private Boolean boolean; public Child(Class1 class1, double n, String s, Boolean b) { //Don't know how to get the Class1 part to work //Don't know how to get the double to work string=s; boolean=b; //Methods and stuff } I don't know how to write the code so that I can get my constructor to take the arguments like this: new Child(new Class1("String", "String"), 10, "String", true); I hope this helps clarify what my problem is.
has comment: http://stackoverflow.com/comment/31154031
tagged with: constructor
has answer: http://stackoverflow.com/a/20784002
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31154077
score: -3
accepted answer: http://stackoverflow.com/a/20784002
possible better answer: http://stackoverflow.com/a/20784004

http://stackoverflow.com/comment/30998300
has text: "SoundButton 38 Cannot Be Resolved" is the error I get if I use your code. Why did the first 37 work but then 38 onward doesnt?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20696891
type: AnswerComment

swing
tags question: http://stackoverflow.com/q/20828564
tags question: http://stackoverflow.com/q/20683502
tags question: http://stackoverflow.com/q/20694226
tags question: http://stackoverflow.com/q/20839667
tags question: http://stackoverflow.com/q/20783892
tags question: http://stackoverflow.com/q/20693046
tags question: http://stackoverflow.com/q/20840762
tags question: http://stackoverflow.com/q/20847711
tags question: http://stackoverflow.com/q/20693141
tags question: http://stackoverflow.com/q/20681352
tags question: http://stackoverflow.com/q/20832462
tags question: http://stackoverflow.com/q/20695014
tags question: http://stackoverflow.com/q/20708749
tags question: http://stackoverflow.com/q/20728833
tags question: http://stackoverflow.com/q/20826493
tags question: http://stackoverflow.com/q/20827906
tags question: http://stackoverflow.com/q/20743051
tags question: http://stackoverflow.com/q/20752722
tags question: http://stackoverflow.com/q/20846958
tags question: http://stackoverflow.com/q/20839146
tags question: http://stackoverflow.com/q/20729475
tags question: http://stackoverflow.com/q/20754474
tags question: http://stackoverflow.com/q/20680482
tags question: http://stackoverflow.com/q/20695310
tags question: http://stackoverflow.com/q/20811234
tags question: http://stackoverflow.com/q/20785044
tags question: http://stackoverflow.com/q/20753873
tags question: http://stackoverflow.com/q/20740148
tags question: http://stackoverflow.com/q/20718322
tags question: http://stackoverflow.com/q/20819295
tags question: http://stackoverflow.com/q/20750708
tags question: http://stackoverflow.com/q/20725505
tags question: http://stackoverflow.com/q/20687139
tags question: http://stackoverflow.com/q/20837785
tags question: http://stackoverflow.com/q/20787800
tags question: http://stackoverflow.com/q/20771635
tags question: http://stackoverflow.com/q/20747848
tags question: http://stackoverflow.com/q/20768551
tags question: http://stackoverflow.com/q/20697402
tags question: http://stackoverflow.com/q/20801710
tags question: http://stackoverflow.com/q/20789768
tags question: http://stackoverflow.com/q/20799131
tags question: http://stackoverflow.com/q/20830437
tags question: http://stackoverflow.com/q/20748173
tags question: http://stackoverflow.com/q/20820554
tags question: http://stackoverflow.com/q/20811873
tags question: http://stackoverflow.com/q/20702860
tags question: http://stackoverflow.com/q/20721091
tags question: http://stackoverflow.com/q/20840918
tags question: http://stackoverflow.com/q/20738888
tags question: http://stackoverflow.com/q/20768138
tags question: http://stackoverflow.com/q/20745355
tags question: http://stackoverflow.com/q/20706952
tags question: http://stackoverflow.com/q/20831867
tags question: http://stackoverflow.com/q/20827880
tags question: http://stackoverflow.com/q/20692540
tags question: http://stackoverflow.com/q/20839177
tags question: http://stackoverflow.com/q/20688938
tags question: http://stackoverflow.com/q/20794285
tags question: http://stackoverflow.com/q/20735603
tags question: http://stackoverflow.com/q/20811842
tags question: http://stackoverflow.com/q/20705848
tags question: http://stackoverflow.com/q/20731938
tags question: http://stackoverflow.com/q/20776505
tags question: http://stackoverflow.com/q/20741712
tags question: http://stackoverflow.com/q/20841972
tags question: http://stackoverflow.com/q/20737651
tags question: http://stackoverflow.com/q/20807047
tags question: http://stackoverflow.com/q/20728230
tags question: http://stackoverflow.com/q/20745580
tags question: http://stackoverflow.com/q/20780437
tags question: http://stackoverflow.com/q/20831078
tags question: http://stackoverflow.com/q/20776480
tags question: http://stackoverflow.com/q/20824847
tags question: http://stackoverflow.com/q/20749483
tags question: http://stackoverflow.com/q/20712988
tags question: http://stackoverflow.com/q/20723127
tags question: http://stackoverflow.com/q/20732858
tags question: http://stackoverflow.com/q/20731458
tags question: http://stackoverflow.com/q/20799814

http://stackoverflow.com/comment/31024517
comment on: http://stackoverflow.com/a/20711458
type: Comment
has text: @Cruncher I am testing it on my computer :) Take OP's code and try what we're discussing.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31218967
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20819295
has text: Ok i made keyTyped and keyReleased pulic
score: 0

http://stackoverflow.com/comment/31099152
comment on: http://stackoverflow.com/q/20752341
has text: How can i edit this code , from your point of view it seems i didn't understand this combobox concept . Can you make some suggestions to use it properly ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/61632066
has body: As mentioned above the following would solve the problem: mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); However in my case the provider did this [0..1] or [0..*] serialization rather as a bug and I could not enforce fixing. On the other hand it did not want to impact my strict mapper for all other cases which needs to be validated strictly. So I did a Jackson NASTY HACK (which should not be copied in general ;-) ), especially because my SingleOrListElement had only few properties to patch: @JsonProperty(value = "SingleOrListElement", access = JsonProperty.Access.WRITE_ONLY) private Object singleOrListElement; public List&lt;SingleOrListElement&gt; patch(Object singleOrListElement) { if (singleOrListElement instanceof List) { return (ArrayList&lt;SingleOrListElement&gt;) singleOrListElement; } else { LinkedHashMap map = (LinkedHashMap) singleOrListElement; return Collections.singletonList(SingletonList.builder() .property1((String) map.get("p1")) .property2((Integer) map.get("p2")) .build()); }
upvote count: 5
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20837856

http://stackoverflow.com/comment/31125865
type: Comment
comment on: http://stackoverflow.com/a/20766943
score: 0
type: AnswerComment
has text: @alkis I remain interested as to why you can't use interceptors. Yes, the default ones might not be right, but using your own should be possible and they will be then able to plug into whatever mechanisms you want. (Alas, the CXF documentation is much less clear than it used to be…)

http://stackoverflow.com/comment/31214889
has text: Since there are two size options, popupmenu.xml and styles.xml, check editing in both. If not then try first in popupmenu.xml only and then in styles.xml only. Have you written the code yourself or are you referring from somewhere?
type: Comment
comment on: http://stackoverflow.com/q/20817026
score: 0
type: QuestionComment

http://stackoverflow.com/comment/131368185
comment on: http://stackoverflow.com/a/20748698
score: 0
type: AnswerComment
has text: case android.R.id.home: //PreferenceActivity.this.onBackPressed(); was exactly what I was looking for tho! Thanks!
type: Comment

http://stackoverflow.com/q/20735040
has answer: http://stackoverflow.com/a/20742624
tagged with: java-3d
has comment: http://stackoverflow.com/comment/31067838
score: 0
has comment: http://stackoverflow.com/comment/31068047
has comment: http://stackoverflow.com/comment/64512330
has comment: http://stackoverflow.com/comment/31080171
type: Question
tagged with: java
has title: Java 3D renders on vnc, not on monitor
tagged with: raspberry-pi
has body: I have a program using Java3D that I'm running on a Raspberry Pi. I've been running the Pi on my network and accessing it through VNC via another machine whilst I ironed out a few kinks in my program. I now have it running, albeit a bit slowly, and wanted to try it in its eventual use case, by plugging the Pi into a monitor and running it standalone. However, when I run the Pi on a monitor, the program will not start, and prints out the following error: Canvas3D_createNewContext: couldn't make current DefaultRenderingErrorListener.errorOccurred: CONTEXT_CREATION_ERROR: Renderer: Error creating Canvas3D graphics context graphicsDevice = X11GraphicsDevice[screen=0] canvas = javax.media.j3d.Canvas3D[canvas0,0,0,252x231] I don't know much about the rendering process in linux, but if anyone could suggest what might be different between what VNC does and what a normal X11 server does that could cause problems I'd be grateful. I'm using Oracle Java 1.7.0_40 with Java 3D 1.5 on the latest release of Raspbian. Thanks for reading.
answer count: 1
has comment: http://stackoverflow.com/comment/31067818
type: UnansweredQuestion

http://stackoverflow.com/comment/31078422
has text: I did find other products that work on port 5005 and are fingerprinting devices, so maybe there is some sort of known protocol, however I cannot locate one
comment on: http://stackoverflow.com/q/20732928
score: 0
type: Comment
type: QuestionComment

recursion
type: Tag
tags question: http://stackoverflow.com/q/20740634
tags question: http://stackoverflow.com/q/20766837
tag name: recursion
tags question: http://stackoverflow.com/q/20750479
tags question: http://stackoverflow.com/q/20710946
tags question: http://stackoverflow.com/q/20841300
tags question: http://stackoverflow.com/q/20719363
tags question: http://stackoverflow.com/q/20816358
tags question: http://stackoverflow.com/q/20826786
tags question: http://stackoverflow.com/q/20760072
tags question: http://stackoverflow.com/q/20731226
tags question: http://stackoverflow.com/q/20827649
tags question: http://stackoverflow.com/q/20760062
tags question: http://stackoverflow.com/q/20830145

http://stackoverflow.com/comment/31239947
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20828251
has text: You don't need to pass the MainActivityReference, nor should you. Simply add addPageChangeListener() and removePageChangeListener() methods to the Fragment, then call addPageChangeListener(this) from the Activity.

http://stackoverflow.com/q/20706534
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20706958
type: Question
has body: I found a library which allows an app to wrap text around an image - however once implemented it changed the size of my text - how can the text size be increase when using this library? android:textSize= has no impact on the text size. Neither does: FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv); ((FlowTextView) findViewById(R.id.titleTv)).setTextSize(20); https://code.google.com/p/android-flowtextview/ Example: &lt;com.pagesuite.flowtext.FlowTextView android:id="@+id/titleTv" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5dp" android:text="" android:textSize="20sp" &gt;
linked to: http://stackoverflow.com/q/20913058
possible better answer: http://stackoverflow.com/a/20706942
has answer: http://stackoverflow.com/a/20706942
answer count: 3
upvote count: 1
tagged with: textview
accepted answer: http://stackoverflow.com/a/20707040
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: android-library
tagged with: android
has answer: http://stackoverflow.com/a/20707040
has title: Unable to Set Text Size Using FlowTextView

http://stackoverflow.com/q/20723818
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/20731810
accepted answer: http://stackoverflow.com/a/20731810
type: Question
has title: Tomcat 8 Examples: Missing Configuration Step
has comment: http://stackoverflow.com/comment/31060128
has comment: http://stackoverflow.com/comment/31060031
answer count: 1
downvote count: 0
tagged with: websocket
has body: I'm trying to set up the "Echo" websocket example on Tomcat 8. I believe I am missing the step where you tell tomcat about the websocket classes. Here's what I have done: Created a new dynamic web project in Eclipse, added maven, and linked tomcat 8 runtimes Copied EchoAnotation.java, EchoEndpoint.java, ExamplesConfig.java, and echo.xhtml into the project. Started the app. When I start the app, I can navigate to the echo.xhtml file, but no matter what url I enter, I can't seem to figure out how to get to web sockets--I always get 404. Putting breakpoints in the constructors, it looks like the websocket classes aren't being loaded. Normally you set up the class configuration in web.xml or some other framework config, but I couldn't find a matching configuration in the examples web.xml on the Tomcat8 SVN (or any other xml.) Any insight on how this is done? Thanks! Source Code EchoAnotation.java, EchoEndpoint.java, ExamplesConfig.java Location: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/ http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo Echo.xhtml location: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/websocket/ Example web.xml location: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/ My web.xml: <?xml version="1.0" encoding="UTF-8"?> index.html
tagged with: tomcat8
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31060047

http://stackoverflow.com/q/20705184
accepted answer: http://stackoverflow.com/a/20705414
has answer: http://stackoverflow.com/a/20705267
has answer: http://stackoverflow.com/a/20705266
has answer: http://stackoverflow.com/a/20827330
favorite count: 0
has comment: http://stackoverflow.com/comment/31012733
has answer: http://stackoverflow.com/a/20705277
answer count: 12
has answer: http://stackoverflow.com/a/25106070
has answer: http://stackoverflow.com/a/45391145
linked to: http://stackoverflow.com/q/14923455
has comment: http://stackoverflow.com/comment/31020253
linked to: http://stackoverflow.com/q/5700911
score: 4
has answer: http://stackoverflow.com/a/34434914
has comment: http://stackoverflow.com/comment/31012467
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31012505
has comment: http://stackoverflow.com/comment/31012611
tagged with: java
has body: How to find whether a number is odd or even, without using if condition or ternary operators in Java? This question is given by my teacher. He also give me a hint that it is possible by using a bitwise operator.
has answer: http://stackoverflow.com/a/20705325
tagged with: bitwise-operators
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20705275
has comment: http://stackoverflow.com/comment/31020211
has answer: http://stackoverflow.com/a/20705414
upvote count: 5
has comment: http://stackoverflow.com/comment/31053492
has answer: http://stackoverflow.com/a/20706012
has answer: http://stackoverflow.com/a/44521660
possible better answer: http://stackoverflow.com/a/20705267
has title: Determine whether number is odd or even without using conditional code

http://stackoverflow.com/q/20723078
type: Question
has comment: http://stackoverflow.com/comment/31045541
has answer: http://stackoverflow.com/a/20723144
has answer: http://stackoverflow.com/a/20723151
linked to: http://stackoverflow.com/q/5277881
possible better answer: http://stackoverflow.com/a/20723088
tagged with: variables
favorite count: 0
has body: Have a look at this code Integer x = 5; Integer y = 2; Integer xy = x+y; System.out.println("xy = " + xy); // outputs: 7 System.out.println("xy2 = " + xy2); // outputs: 7 x++; System.out.println("xy = " + xy); // outputs: 7 System.out.println("xy2 = " + xy2); // outputs: 7 How can I get the code to output 8 without using a method that calculates it for you?
has title: Java, how to pass by reference
has comment: http://stackoverflow.com/comment/31056926
has comment: http://stackoverflow.com/comment/31045801
answer count: 4
has comment: http://stackoverflow.com/comment/31045605
score: 2
has comment: http://stackoverflow.com/comment/31069262
has comment: http://stackoverflow.com/comment/31045610
has answer: http://stackoverflow.com/a/20723088
has comment: http://stackoverflow.com/comment/31045748
has comment: http://stackoverflow.com/comment/31045676
tagged with: pass-by-reference
has answer: http://stackoverflow.com/a/20723120
downvote count: 1
accepted answer: http://stackoverflow.com/a/20723120
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31045650
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31045579
has comment: http://stackoverflow.com/comment/31045585

http://stackoverflow.com/q/20817250
type: Question
has answer: http://stackoverflow.com/a/20817672
answer count: 1
tagged with: jsp
tagged with: struts2
has title: sending JSON from java server to jsp client with Action (without doGet/doPost)
has comment: http://stackoverflow.com/comment/31215909
has body: My problem is that I'm trying to send a JSON object from my Action java class to my jsp. here is my code : JAVA action : public String test(){ JSONObject json = new JSONObject(); json.put("msg", "yeah"); // what to do here? return SUCCESS; } JSP : &lt;script&gt; $('#test').click(function() { $.ajax({ type : 'POST', url : 'test.action', dataType : "json", timeout : 3000, success : function(json) { var obj = $.parseJSON(json); alert(obj.msg); }, error : function() { alert("error"); } }); }); &lt;/script&gt; [...] &lt;s:submit key="test" name="test" id="test"&gt;&lt;/s:submit&gt; I found several answers on that on the web but none who answered exactly on what I want. What may I change to makes it word properly? Thanks! EDIT : yes I'm using struts, and it's in this way that I'd like to send a json to my jsp.
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/31231370
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31215036

http://stackoverflow.com/q/20729932
answer count: 1
tagged with: side-scroller
has title: 2D Camera translations
type: AnsweredQuestion
tagged with: 2d
tagged with: opengl
tagged with: java
has answer: http://stackoverflow.com/a/20732089
has body: I'm using OpenGL. For my tiles, I'm using a display list and I'm just using immediate more for my player (for now). When I move the player, I want to center him in the center of the window, but allow him to jump around on the y axis and not have the camera follow him. But the problem is, is that I can't figure out how to center the player in the viewport! Here is the player update method: public void update() { if (Keyboard.isKeyDown(Keyboard.KEY_D)) { World.scrollx -= Constants.scrollSpeed; setCurrentSprite(Sprite.PLAYER_RIGHT); } if (Keyboard.isKeyDown(Keyboard.KEY_A)) { World.scrollx += Constants.scrollSpeed; setCurrentSprite(Sprite.PLAYER_LEFT); } move((Constants.WIDTH) / 2 + -World.scrollx, getY()); } World.scrollx and World.scrolly are variables that I increase/decrease to move the tiles. move() is just a method that sets the player position, nothing else. I render the player at his current coordinates like this: public void render() { glBegin(GL_QUADS); Shape.renderSprite(getX(), getY(), getCurrentSprite()); glEnd(); } Shape.renderSprite is this: public static void renderSprite(float x, float y, Sprite sprite){ glTexCoord2f(sprite.x, sprite.y + Spritesheet.tiles.uniformSize()); glVertex2f(x, y); glTexCoord2f(sprite.x + Spritesheet.tiles.uniformSize() , sprite.y + Spritesheet.tiles.uniformSize()); glVertex2f(x + Constants.PLAYER_WIDTH, y); glTexCoord2f(sprite.x + Spritesheet.tiles.uniformSize(), sprite.y); glVertex2f(x + Constants.PLAYER_WIDTH, y + Constants.PLAYER_HEIGHT); glTexCoord2f(sprite.x, sprite.y); glVertex2f(x, y + Constants.PLAYER_HEIGHT); } Pretty simple, I just render the quad at the current player's position. This is how I actually render everything: public void render(float scrollx, float scrolly) { Spritesheet.tiles.bind(); glPushMatrix(); glTranslatef(scrollx, scrolly, 0); glCallList(tileID); glPopMatrix(); player.render(); } This is the part I'm confused on. I translate the tiles according to the scrollx and scrolly variables, and then I rend…
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/20732089

http://stackoverflow.com/q/20804235
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20818254
accepted answer: http://stackoverflow.com/a/20818254
tagged with: java
type: Question
upvote count: 2
has body: I need to store some serverside values against a suspended request and I'm not sure how I should go about it. I'd like the attributes to be cleaned up when the suspended connection is no longer live on the client. I expected AtmosphereResource to have setAttribute(name,value) and getAttribute(name) methods but they don't exist. I've thought of three possible approaches: Use AtmosphereResource.getRequest().setAttribute(name,value) Provide my own AtmosphereResource implementation and add the methods there (backed by a concurrent map). Have some form of listener / interceptor that listens for create / destroy of AtmosphereResource and maintain my own serverside state using AtmosphereResource.uuid(). Questions: Are there any issues with using the request attributes of the suspended request? Will this work for all transport methods? Are there any examples of providing a custom AtmosphereResource implementation? If I provide my own AtmosphereResource implementation, will it live for the lifetime of the suspended request? Will this work for all transport methods (eg long-polling)? Is there a hook to get events for create / destroy? I've looked at AtmosphereInterceptor but can only see inspect and postInspect events. Is there a better solution to my problem?
answer count: 1
tagged with: websocket
favorite count: 0
tagged with: atmosphere
has title: Atmosphere - Storing attributes on the AtmosphereResource
downvote count: 0

http://stackoverflow.com/comment/31173713
has text: You can up-vote any of the below answers if they helped you and "mark as correct" the answer that gave you the best solution.
type: Comment
comment on: http://stackoverflow.com/q/20794222
score: 0
type: QuestionComment

http://stackoverflow.com/a/75158009
answers question: http://stackoverflow.com/q/20819468
type: Answer
score: 0
has body: The solution for me was to remove final from class definition. I got the same exception while using PreAuthorize annotation on some Rest Controllers. The problem was that the controller classes where defined as final and it caused such error.

http://stackoverflow.com/q/20769493
has answer: http://stackoverflow.com/a/20769680
accepted answer: http://stackoverflow.com/a/20769680
answer count: 1
has comment: http://stackoverflow.com/comment/31129782
has comment: http://stackoverflow.com/comment/31129770
favorite count: 0
has comment: http://stackoverflow.com/comment/31129752
score: 2
tagged with: hssf
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31130804
has comment: http://stackoverflow.com/comment/31129537
downvote count: 0
tagged with: java
has title: HSSF Reading Blank Cell getting Null Pointer Exception
has comment: http://stackoverflow.com/comment/31129549
type: Question
upvote count: 2
has body: I am working on the utility which dumps the excel sheet content to the database (postgres 9.2 in my case) , The application is working very smoothly when all the cells are filled but whenever i am trying to run my code on the excel sheet which is having empty cell it is giving me NULL POINTER EXCEPTION . Can any one help me......? code.... snips ... public ArrayList fillList(int colIndex, int id, List&lt;Cell&gt; cells, String path) { // OrderedMap errorMap=new LinkedMap(); String error = null; ArrayList&lt;String&gt; errorList = new ArrayList&lt;String&gt;(); // errorList=null; try { FileInputStream fileIn = new FileInputStream(path); POIFSFileSystem fs; fs = new POIFSFileSystem(fileIn); HSSFWorkbook filename = new HSSFWorkbook(fs); Cell number = null; HSSFSheet sheet = filename.getSheetAt(0); Row firstRow = sheet.getRow(0); int flag = 0; String errorValue = null; int columnNo = colIndex; if (columnNo != -1) { for (Row row : sheet) { if (row.getRowNum() != 0) { Cell c = row.getCell(columnNo); // row.getCell(arg0, arg1) // cells.add(c); System.out.println(c.getCellType()); if (c.getCellType() == Cell.CELL_TYPE_STRING &amp;&amp; (id == 2 || id == 3)) { cells.add(c); } else if (c.getCellType() == Cell.CELL_TYPE_NUMERIC &amp;&amp; id == 1) { String s = row.getCell(columnNo).toString(); double d = Double.parseDouble(s); String mob = Double.toString(d); Cell sc = row.createCell((short) 2); String text = NumberToTextConverter.toText(c .getNumericCellValue()); // System.out.println(text); sc.setCellValue(text); cells.add(sc); // Date date=c.getDateCellValue(); } else if (c.getCellType() == Cell.CELL_TYPE_NUMERIC &amp;&amp; id == 4) { String s = row.getCell(columnNo).toString(); double d = HSSFDateUtil.getExcelDate(c .getDateCellValue()); // String date = Double.toString(d); Cell sc = row.createCell((short) 2); String date = new SimpleDateFormat("dd-MM-yyyy") .format(c.getDateCellValue()); // System.out.println(text); sc.setCellValue(date); cells.add(sc); } else if (c.getCe…
has comment: http://stackoverflow.com/comment/31129856

http://stackoverflow.com/comment/31105767
has text: Is there any sample code in java to check the above scenario if yes please share
comment on: http://stackoverflow.com/a/20756070
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20819485
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20818886
score: 3
answers question: http://stackoverflow.com/q/20818886
has body: Actually, it's clear as day. You don't need the debugger to find the endless loop. Here are the key bits of code: int[] inputLetters = new int[25]; int[] wordLetters = new int[25]; while(entries &lt; anagrams.length) { .... if(inputLetters == wordLetters) { ...... entries++; } } } Analysis: You loop as long as entries, initially 0, is less than anagrams.length; you increment entries if inputLetters == wordLetters; but clearly, the inputLetters reference can never be equal to the wordLetters reference. Each refers to its own array; therefore you fail to ever increment entries; therefore you have an endless loop.
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/50023925
answers question: http://stackoverflow.com/q/20807066
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/98487622
has body: There is a generic XML validator that works with XML Schema v1.1, which uses xercesImpl-xsd11 2.12-beta-r1667115. The validator is available here as a Maven plugin, and here as an embeddable library.
score: 1
has comment: http://stackoverflow.com/comment/98524538
downvote count: 0

http://stackoverflow.com/a/20860785
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20764344
has body: I'm not sure you'll be able to do this in MongoDB with your document structure. The issue I ran into is around the parameters - I'm assuming you care about the order of the parameters (i.e. doSomething(String, int) is not the same as doSomething(int, String)), and the query operators to check all the values in an array treat the array as a set, so a) order agnostic and b) eliminates duplicates (so doSomething(String, String) matches doSomething(String)) (this is because I was using the $all keyword, see the documentation, especially the note at the bottom). I managed to get a large part of the query you wanted, however, which might point you in the right direction. { "$and" : [ //putting these in an "and" query means all parts have to match { "interfaces.methodInterfaces" : { "$elemMatch" : { "name" : "add"}} //this bit finds documents where the method name is "add" } , { "interfaces.methodInterfaces" : { "$elemMatch" : { "returnType" : "Integer"}} // This bit matches the return type } , { "interfaces.methodInterfaces.parameterTypes" : { "$all" : [ "Integer" , "Integer"]} //This *should* find you all documents where the parameter types matches this array. But it doesn't, as it treats it as a set } ]} If you're querying via the Java driver, this looks like: BasicDBObject findMethodByName = new BasicDBObject("interfaces.methodInterfaces", new BasicDBObject("$elemMatch", new BasicDBObject("name", "add"))); BasicDBObject findMethodByReturn = new BasicDBObject("interfaces.methodInterfaces", new BasicDBObject("$elemMatch", new BasicDBObject("returnType", "Integer"))); BasicDBObject findMethodByParams = new BasicDBObject("interfaces.methodInterfaces.parameterTypes", new BasicDBObject("$all", asList("Integer", "Integer"))); BasicDBObject query = new BasicDBObject("$and", asList(findMethodByName, findMethodByReturn, findMethodByParams)); DBCursor found = collection.find(query); I haven't included matching the class name, as this didn't seem to be the tricky part - just build…
has comment: http://stackoverflow.com/comment/31361065

http://stackoverflow.com/comment/31205442
comment on: http://stackoverflow.com/q/20811180
type: QuestionComment
score: 0
has text: At the mouse up event once you have moved the piece are you calling the legalMove function? In the tutorial, after you compute the final position in mouseReleased you should only place the piece in the new position if legalMove returns true. If you need more help then please share the working code on someplace like github so we can take a look.
type: Comment

http://stackoverflow.com/comment/31192865
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20805383
score: 0
has text: possible duplicate of [How to use the toString method in Java?](http://stackoverflow.com/questions/3615721/how-to-use-the-tostring-method-in-java)

http://stackoverflow.com/a/20714414
type: Answer
has body: TextView myTextView= (TextView)findViewById(R.id.myTextView); myText = myText + "\nYour car model is: " a.getcarType(); myText = myText + "\nYour car year is: " a.getcaryear(); ... //myTextView.append(myText); myTextView.setText(myText);
score: -1
downvote count: 2
upvote count: 1
answers question: http://stackoverflow.com/q/20714266

http://stackoverflow.com/q/20724273
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/20724560
has title: Non-stop Garbage Collection in 2D surfaceview animation
type: Question
downvote count: 0
has body: I'm having an issue where the system GC is being called incessantly when running my 2D animation, and I'm not sure why. Everything I've read has suggested avoiding creating bitmaps in the onDraw() method, which I am not doing, but I still have GC being called about once per second, which is seriously impacting usability on lower-end devices. The code is very long, so I won't post it all here, but basically, there's a thread that calls _surfaceHolder.lockCanvas(null), then postInvalidate, resulting in onDraw() being called, followed by _surfaceHolder.unlockCanvasAndPost(_canvas). My onDraw() method has several iterations of _canvas.drawCircle(...), _canvas.drawBitmap(...) (drawing a bitmap that was created once when the SurfaceView was created), and a lot of numeric calculations involving Math.pow(...). The application uses several (10+) Double ArrayLists which it reads and writes to several times in each onDraw() routine. Can anyone shed some light on why GC is being called so often and what I could do to help? Am I simply calculating too much and shouldn't expect higher framerates? EDIT: It's worth mentioning that this issue persists even when I comment out all bitmap drawing and the FPS decreases steadily over time, the longer the animation has been running.
tagged with: surfaceview
tagged with: android
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20724560
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/31048680
has comment: http://stackoverflow.com/comment/31047986
type: AnsweredQuestion

http://stackoverflow.com/comment/31173508
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20782210
has text: Either @DateTimeFormat(pattern="dd/MM/yyyy hh:mm a") or @DateTimeFormat(pattern="MM/dd/yyyy hh:mm a"), I always got the same output "01/10/2013 03:05 AM"

http://stackoverflow.com/q/20755922
has answer: http://stackoverflow.com/a/20756025
type: Question
has comment: http://stackoverflow.com/comment/31109484
answer count: 2
has body: I have an JDBC utility class which hold the Resultset,Statement and Connection instances as global references.This class has basic two methods like 'execute'(has some parameters) and 'close' and inside execute, above instances are created and assigned and finally returns the created Resultset. And the 'close' method closes all the opened connections for Resultset,Statement and Connections simply like this. public void close() { if (rs != null) { try { rs.close(); } catch (SQLException sqlEx) { sqlEx.printStackTrace(); } } if (stmt != null) { try { stmt.close(); } catch (SQLException sqlEx) { sqlEx.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException sqlEx) { sqlEx.printStackTrace(); } } } And my client application I create an instance of utility and get the resultset like below. ResultSet rs = dbutil.execute(strQuery,values); and if I close the Resultset using rs.close and again using dbutil.close() in my client application, will it occur some connection leak or memory leaks? what will happen if I use only rs.close() in my client? Are there any possibilities for making connection leaks there? thanks in advance
score: 0
has title: Query about Connection leaks with Utility class
accepted answer: http://stackoverflow.com/a/20756025
tagged with: connection-leaks
has comment: http://stackoverflow.com/comment/31107809
has comment: http://stackoverflow.com/comment/31105496
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20756252
tagged with: java
has answer: http://stackoverflow.com/a/20756252

http://stackoverflow.com/comment/31002189
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20698792
has text: First tell us what does not work and what you have tried so far.

http://stackoverflow.com/comment/31175076
has text: Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20795411

http://stackoverflow.com/q/20690598
type: Question
has comment: http://stackoverflow.com/comment/30986894
has answer: http://stackoverflow.com/a/20690644
score: -1
tagged with: date
linked to: http://stackoverflow.com/q/999172
answer count: 1
downvote count: 1
tagged with: string
has title: changing date to european style java
duplicate of: http://stackoverflow.com/q/999172
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30986896
upvote count: 0
tagged with: java
has body: I have a question on how to display the date into european style, like from 4/4/2013 to 4 - 4 - 2013. How can I fix this? Any help will be greatly appreciated. When I run my program I get this: run: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 47 at java.lang.String.substring(String.java:1907) at Testing1.convertDate(Testing1.java:7) at Testing1.main(Testing1.java:14) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) Below is my code: Testing1.java: public class Testing1{ public static String convertDate(String amerDate){ String month = amerDate.substring(0, '/'); String date = amerDate.substring('/', '/'); int year = amerDate.indexOf("\4d"); return date + " - " + month + " - " + year; } public static void main(String args[]){ String date = "4/4/2013"; date = convertDate(date); System.out.println(date); } }
tagged with: formatting

http://stackoverflow.com/a/20787656
type: AcceptedAnswer
has body: It's not necessary to use Ebean, I have used mybatis as persistence provider, but in order to save the user and login without problem you should use the same hashing algorithm. the hashing algorithm is used to store the password. to use your custom persistence provider like JPA or whatever you want, you should implement the Authentication Provider interfaces, see UsernamePasswordAuthProvider in the example project for more details. Focus ,especially, on "signupUser" and "loginUser" methods. I have modified play-authenticate to support Login/password instead of email/password identityId. see Modified version of Play-Authenticate. Cheers.
score: 0
accepted answer of: http://stackoverflow.com/q/20780649
type: Answer
answers question: http://stackoverflow.com/q/20780649

http://stackoverflow.com/comment/31113699
has text: Ok, I've created a new user, gave him all privileges, flushed all privileges, restarted db server, tried to connect to db with my app localy with new user account - same problem. Tried to connect with this user via mysql command -OK
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20760848

http://stackoverflow.com/q/20808541
tagged with: android-edittext
has title: Creating editText beneath drawable programmatically
score: 0
has comment: http://stackoverflow.com/comment/31198852
has body: I have an editText: @+id/editText1 which I'd like to instantiate beneath R.drawable.sqwhite after my onClick method My problem is the drawable isn't created via XML - and I'm not sure exactly how to get my editText1 to appear directly beneath R.drawable.sqwhite JAVA: public void onClickAddImage(View v) { addNewImageToScreen(); } public void addNewImageToScreen() { int resourceId = R.drawable.sqwhite; addNewTextToScreen(); int m = mImageCount % 3; if (m == 1) resourceId = R.drawable.sqdrk; else if (m == 2) resourceId = R.drawable.sqwhite; addNewImageToScreen(resourceId); } private void addNewTextToScreen() { // TODO Auto-generated method stub et.setVisibility(View.VISIBLE); if (isErase) { tx.setText(et.getText().toString()); } else { tx.setText(""); et.setVisibility(View.GONE); } isErase = !isErase; } public void addNewImageToScreen(int resourceId) { if (mLastNewCell != null) mLastNewCell.setVisibility(View.GONE); et.setVisibility(View.VISIBLE); FrameLayout imageHolder = (FrameLayout) findViewById(R.id.image_source_frame); if (imageHolder != null) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, Gravity.CENTER); ImageCell newView = new ImageCell(this); newView.setImageResource(resourceId); imageHolder.addView(newView, lp); newView.mEmpty = false; newView.mCellNumber = -1; mLastNewCell = newView; mImageCount++; // Have this activity listen to touch and click events for the view. newView.setOnClickListener(this); newView.setOnLongClickListener(this); newView.setOnTouchListener(this); } } XML: <?xml version="1.0" encoding="utf-8"?> <com.example.project.DragLayer xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" android:id="@+id/drag_layer" android:layout_width="fill_parent" android:layout_height="fill_parent" > <GridView android:id="@+id/image_grid_view" android:layout_width="wrap_content" android:layout_height="fill_parent" …
linked to: http://stackoverflow.com/q/20913058
has comment: http://stackoverflow.com/comment/31199174
has comment: http://stackoverflow.com/comment/31397098
tagged with: android-drawable
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31198876
has comment: http://stackoverflow.com/comment/31343559
has comment: http://stackoverflow.com/comment/31199151
answer count: 0
has comment: http://stackoverflow.com/comment/31198920
has comment: http://stackoverflow.com/comment/31199027
has comment: http://stackoverflow.com/comment/31199205
has comment: http://stackoverflow.com/comment/31198955
type: Question
has comment: http://stackoverflow.com/comment/31199109
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/31128319
type: Comment
has text: You do know this question is kind of open ended and would have different answers right?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20768738

http://stackoverflow.com/a/20732094
accepted answer of: http://stackoverflow.com/q/20731679
upvote count: 3
has body: "However it is only printing once. Any tips on why?" setText will only set the text once. So all you're doing in the loop is setting the text over and over. Here is a suggestion. Concatenate the Strings in the loop, then set the text. Like this: String line = ""; for(int m = 0; m&lt;length[l]; m++) { line += "__ "; l++; } jl3.setText(line); " Also, if you have any tips on better organizing my code that would be appreciated. " Try Code Review for this.
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20731679
type: Answer

http://stackoverflow.com/q/20840153
tagged with: spring
has comment: http://stackoverflow.com/comment/31257700
tagged with: spring-mvc
answer count: 0
has comment: http://stackoverflow.com/comment/31258949
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31257421
has comment: http://stackoverflow.com/comment/31257547
type: Question
has comment: http://stackoverflow.com/comment/31257341
has comment: http://stackoverflow.com/comment/31258206
has body: I have a controller (Scoped: session), an autowired service (Scoped: session) and a component ("A") used by the service (Scoped: request)). The flow at each request is expected to be like this: 1) Request Arrives at Controller 2) Controller has an injected service whose method is called 3) Service has an injected component A, and the method of that is called has a custom PreAuthorize expression evaluating a boolean returned by the method of the injected component A. 4) In successful PreAuthorize (doesn't throw access denied and it goes ahead) I populate a member variable of bean A. 5) The service method is executed which uses bean A's set member variables' value. I get the member variable's value same each time a request is made. Basically, it's the value which was there on the first request. I change it on every PreAuthorize.. and if i debug and see what's happening, it does get changed, but when I access the bean at the service where the component is autowired, I get the old value. So I printed the object.toString for the bean A (which is request scoped) in the service. I should get different values on each fresh request. But I'm getting the same value all the time. What am i doing wrong? Is this standard/correct behavior for a component which is request scoped? The following scenario works perfectly, as in i get changed values because i get updated values in the same object which is session scoped: Controller (Scoped: session), Service( Scoped: session), Component (Scoped: session).. Edit Similarly, if all 3 are scoped request, i get different toString values for the beans. Edit 2 Thinking a bit about this, is the same Component bean being returned as it is a member of the Session scoped Service/Controller? I tried Controller (session), Service (request) and Component (request), and i get the same object.toString at the Session for the autowired component. The PreAuthorize accesses the correct bean as it is not accessing the instance of the one which is autowired…
score: 0
has title: Spring Request Scoped Bean Exists In Subsequent Request
has comment: http://stackoverflow.com/comment/31258494
has comment: http://stackoverflow.com/comment/31258300
has comment: http://stackoverflow.com/comment/31257313
tagged with: spring-security

http://stackoverflow.com/a/20680556
answers question: http://stackoverflow.com/q/20679799
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20679799
has body: I guess, you have to implement your own FileFilter. Something like this: class CustomDirectoryFilter implements FileFilter { private String allowedFileName = "testFolder"; @Override public boolean accept(File pathname) { if (pathname.isDirectory()) { File[] subFiles = pathName.listFiles(); for (File file : subFiles){ if (file.getName().equals(allowedFileName)){ return true; } } } return false; } } Explanation: for each file from C:\myHomeDirectory test if given file is directory. If it is, get array of all files in it and test, if any of these files contains your file. If such file found, allow the directory to be part of myDirectories I have no chance to test if this example code compiles now, but I hope it helps you to get your solution.
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20694549
accepted answer: http://stackoverflow.com/a/20694593
has title: Queue modulus in en-queue and de-queue method?
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/30994217
type: Question
has answer: http://stackoverflow.com/a/20694593
tagged with: queue
has comment: http://stackoverflow.com/comment/30994197
upvote count: 1
answer count: 1
favorite count: 0
has body: So I have this code I need to analyze and learn from it, about how bounded queue works, here it is: class Queue&lt;T&gt; { // bounded private T[] seq; // the sequence private int size = 0; // size of sequence private int head = 0; private int tail = 0; // front and rear Queue(int n) { // n&gt;0 seq = (T[])(new Object[n]); } Queue(){ this(10000);} // = seq=(T[])(new Object[10000]); boolean isEmpty() { return size==0;} boolean enq(T t) { if (size&lt;seq.length) { seq[tail] = t; tail = (tail+1)%seq.length; size++; return true; } else return false; } T deq() { if (isEmpty()) return null; else { T temp = seq[head]; head = (head+1)%seq.length; size--; return temp; } } } So everything is okay, but I don't understand why in the name of god is there a modulus (%) operation in the enq(T t) method and deq() method...
type: AnsweredQuestion

reflection
tags question: http://stackoverflow.com/q/20817425
tags question: http://stackoverflow.com/q/20815978
tags question: http://stackoverflow.com/q/20693711
tags question: http://stackoverflow.com/q/20804791
tags question: http://stackoverflow.com/q/20705109
tags question: http://stackoverflow.com/q/20817033
tags question: http://stackoverflow.com/q/20773850
tags question: http://stackoverflow.com/q/20784062
tags question: http://stackoverflow.com/q/20706391
type: Tag
tags question: http://stackoverflow.com/q/20738583
tags question: http://stackoverflow.com/q/20735079
tags question: http://stackoverflow.com/q/20787664
tags question: http://stackoverflow.com/q/20710762
tags question: http://stackoverflow.com/q/20686252
tags question: http://stackoverflow.com/q/20704618
tags question: http://stackoverflow.com/q/20708995
tags question: http://stackoverflow.com/q/20844756
tag name: reflection
tags question: http://stackoverflow.com/q/20803032
tags question: http://stackoverflow.com/q/20731952
tags question: http://stackoverflow.com/q/20843722

http://stackoverflow.com/comment/31268431
type: QuestionComment
has text: "get()" is giving me a NPE (it doesn't make it to "get", the try/catch surrounding it takes me to the catch, which is a NPE)
score: 0
comment on: http://stackoverflow.com/q/20845223
type: Comment

http://stackoverflow.com/q/20838507
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/20840383
has comment: http://stackoverflow.com/comment/31256775
has body: I made a post four days back on this same forum seeking for a solution, but I have been checking for any solutions but in vain. I'm really stack as I can't continue mastering JSP which is a very big parcel for my 2014 plan of web programming. I'm new to JSP and database access ... so I'm requesting for your help. The problem: I have a simple my MySQL database and have designed a JSP page to display extracted data from the database. I tried and tested it via the command line and yes, the data is perfectly extracted. However the returning JSP page displays an empty html table with the four column headers ,with something similar to the one below: SELECT * from Employees; ID Age First Name Last Name Below is the database info: database - 'EMP'. table - 'Employees'. Columns; id; age; first; last. data; 100; 28; Zaid; Khan. password - 'password' Below is the JSP code: <%@ page import="java.io.*, java.util.*, java.sql.*" %> <%@ page import="javax.servlet.http.*, javax.servlet.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> SELECT operation SELECT * from Employees; Emp ID Age First Name Last Name <c:forEach var="row" items="${result.rows}"> <c:out value="${row.id}"/> <c:out value="${row.age}"/> <c:out value="${row.first}"/> <c:out value="${row.last}"/> </c:forEach> However I'm suspicious with the code below (I extracted the code form the JSP program code), as when i try to close the gaps before and after the double colons (:) of the custom tags I receive a run time error message. <sql : setDataSource <sql : query dataSource Below is the root folder and classpath: JSP page: C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\jsp pages\RegName.jsp CLASSPATH: C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jsp-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jstl-1.2.jar;C:\glassfish3\jdk\jre\lib;C:\Program Files (x86)\MySQL\MySQL Connector J\mysql-c…
has title: I'm receiving an empty html/jsp table with no data extracted
has answer: http://stackoverflow.com/a/20839579
has comment: http://stackoverflow.com/comment/31256655
has answer: http://stackoverflow.com/a/20838690
upvote count: 2
tagged with: java
answer count: 3
tagged with: mysql
linked to: http://stackoverflow.com/q/20823448
has comment: http://stackoverflow.com/comment/31255945
type: UnansweredQuestion
score: 2
linked to: http://stackoverflow.com/q/20819753
downvote count: 0
tagged with: jsp
tagged with: tomcat

http://stackoverflow.com/a/20792945
answers question: http://stackoverflow.com/q/20781518
type: Answer
has body: You can use the jQuery Validation plugin for Grails. Probably the best option without writing something from scratch yourself.
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/31208856
comment on: http://stackoverflow.com/q/20813606
score: 0
type: Comment
type: QuestionComment
has text: @RakeshKR by abusing `catch`, he discards his own error, to make debugging harder.

http://stackoverflow.com/a/20818250
upvote count: 1
has comment: http://stackoverflow.com/comment/32256170
has body: You are trying to get the value from the number_input editText before even you fill in anything. Move number = Integer.parseInt(number_input.getText().toString()); inside setOnClickListener() so that you ask android to get the value only when you click the guess_button and thus there is a value in the editText. P.S. Make checks to ensure that the editText is not empty when guess_button is clicked otherwise you will get error again.
answers question: http://stackoverflow.com/q/20818013
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31224640
has comment: http://stackoverflow.com/comment/31224100
score: 1

http://stackoverflow.com/q/20804198
tagged with: toolkit
favorite count: 0
has body: I got three rather small questions so I'd like to ask them all in one thread here. 1- What does Toolkit.getDefaultToolkit().sync() mean? 2- What does g.dispose() do? (g is a Graphics object). 3- What does this: setDoubleBuffered(true) mean? All of the above happen in a class extending JPanel. Thanks
type: Question
tagged with: java
downvote count: 3
tagged with: swing
has answer: http://stackoverflow.com/a/20804342
answer count: 1
has title: What does "Toolkit.getDefaultToolkit().sync()" mean?
upvote count: 5
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31190608
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20804342

http://stackoverflow.com/a/20822544
accepted answer of: http://stackoverflow.com/q/20798652
type: Answer
has body: You need to import the signed CSR with the same alias as it had before when it was only a keypair.
score: 0
answers question: http://stackoverflow.com/q/20798652
type: AcceptedAnswer

http://stackoverflow.com/comment/31264862
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20813299
score: 1
has text: Tomorrow I will try it.

http://stackoverflow.com/q/20722835
tagged with: kill-process
tagged with: batch-file
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20723077
tagged with: java
type: Question
tagged with: xcopy
has title: Batch file process killed in Java: xcopy does not close
has answer: http://stackoverflow.com/a/20723281
has body: This seems like it should be fairly easy to solve, but I am not familiar enough with the use of batch files to solve it for myself. I have a Java method that creates a process builder and runs a batch file in the process. The batch file uses the xcopy command to copy one directory to another. While the batch file is running in the background, a Java window containing a JTextArea displays the output of the process (the directories being copied). The window also has a stop button, which calls the following code: stopped = true; backgroundTask.cancel(true); backgroundTask.done(); The done method looks like this: protected void done() { statusLabel.setText((this.getState()).toString() + " " + status); stopButton.setEnabled(false); bar.setIndeterminate(false); if(stopped == false){ JOptionPane.showMessageDialog(null, "Backup Complete."); closeWindow(); } else if (stopped == true){ JOptionPane.showMessageDialog(null, "Backup Cancelled."); closeWindow(); } } Now, in order to run the batch file in the background, I use the following code (initially suggested to me by trashgod): protected Integer doInBackground() throws IOException { try { ProcessBuilder pb = new ProcessBuilder(commands); pb.redirectErrorStream(true); Process p = pb.start(); String s; BufferedReader stdout = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((s = stdout.readLine()) != null &amp;&amp; !isCancelled()) { publish(s); } if (!isCancelled()) { status = p.waitFor(); } p.getInputStream().close(); p.getOutputStream().close(); p.getErrorStream().close(); p.destroy(); closeWindow(); } catch (IOException | InterruptedException ex) { ex.printStackTrace(System.err); } return status; } The issue I am having is this: When I run the program, the files copy just fine unless I press the stop button on the window in the foreground. When I do that it tells me the backup was cancelled (as it is supposed to), but it leaves three extra processes running which are visible in the task manager: My g…
has answer: http://stackoverflow.com/a/20722924
score: 0

http://stackoverflow.com/comment/31049653
comment on: http://stackoverflow.com/q/20724324
has text: >(ab(?[\w]*)|bs(?[\w]*))
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/36964785
upvote count: 30
type: Answer
score: 30
has comment: http://stackoverflow.com/comment/83306771
has body: Configure another port number(eg:8181) in /src/main/resources/application.properties server.port=8181
has comment: http://stackoverflow.com/comment/86425580
answers question: http://stackoverflow.com/q/20735205
downvote count: 0

http://stackoverflow.com/a/21023446
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20780883
answers question: http://stackoverflow.com/q/20780883
has body: I solve this problem. Problem was user. this user I using another application, that are running already. I created new user , and everything works fine
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/a/20843947
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20843730
type: Answer
has comment: http://stackoverflow.com/comment/31264370
upvote count: 4
answers question: http://stackoverflow.com/q/20843730
has comment: http://stackoverflow.com/comment/31264438
score: 4
has body: setVisible should go at the end. You're currently setting visible to true, and then adding a panel. mainwindow.setVisible(true); mainwindow.add(new gameWindow()); Put setVisible at the end after setDeaultCLoseOperation
type: AcceptedAnswer

http://stackoverflow.com/q/20815412
has body: I'm developing an SOAP Service in Java but i encountered this error: WARNING: Mismatch between Java model and WSDL model found, For wsdl operation {http://database.unitn.it/}isLoginOkay,There is no matching wsdl fault with detail QName {http://interfaces.database.unitn.it/}Exception com.sun.xml.internal.ws.spi.db.DatabindingException: Unknown JAXBContext implementation: class com.sun.xml.bind.v2.runtime.JAXBContextImpl at com.sun.xml.internal.ws.spi.db.BindingContextFactory.getJAXBFactory(BindingContextFactory.j ava:192) at com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:134) at com.sun.xml.internal.ws.message.jaxb.JAXBMessage.create(JAXBMessage.java:152) at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:241) at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:224) at com.sun.xml.internal.ws.wsdl.PayloadQNameBasedOperationFinder.getWSDLOperationMapping(PayloadQNameBasedOperationFinder.java:143) at com.sun.xml.internal.ws.wsdl.OperationDispatcher.getWSDLOperationMapping(OperationDispatcher.java:82) at com.sun.xml.internal.ws.api.message.Packet.getWSDLOperationMapping(Packet.java:285) at com.sun.xml.internal.ws.api.message.Message.getOperation(Message.java:284) at com.sun.xml.internal.ws.api.message.Message.getOperation(Message.java:302) at com.sun.xml.internal.ws.api.message.Message.isOneWay(Message.java:379) ... I am working with java 1.8 and everything run on localhost. The wsdl seams to work fine. I do not know what the problem could be. I tried a lot to solve the problem but I have not four no one thread that talk about this problem. Please help. EDIT: Here the publisher: private static final String mUrl = "http://localhost:" + Ports.MASTER_DATABASE_SERVICE + "/database"; public static void launch() throws Exception { System.out.println("----Starting on ..." + mUrl); Endpoint.publish(mUrl, new Database()); System.out.println("----SOAP Ser…
has comment: http://stackoverflow.com/comment/31211522
type: UnansweredQuestion
tagged with: soap
has title: Soap Mismatch between Java model and WSDL model found
has comment: http://stackoverflow.com/comment/31211750
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/31216213
type: Question
linked to: http://stackoverflow.com/q/43721384
has comment: http://stackoverflow.com/comment/74518208
tagged with: wsdl
downvote count: 0
favorite count: 0

integer
tags question: http://stackoverflow.com/q/20695310
tags question: http://stackoverflow.com/q/20790746
tags question: http://stackoverflow.com/q/20794587
tags question: http://stackoverflow.com/q/20750346
tags question: http://stackoverflow.com/q/20758080
tags question: http://stackoverflow.com/q/20840540
tag name: integer
tags question: http://stackoverflow.com/q/20680482
type: Tag
tags question: http://stackoverflow.com/q/20731401

http://stackoverflow.com/comment/31153849
type: Comment
has text: you should research classification algorithms and choose which one fits your problem the best, the algorithms used to find out the number based on a given image sound similar to what you are trying to achieve, Good Luck.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20783141

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/20751036
tags question: http://stackoverflow.com/q/20727539
tags question: http://stackoverflow.com/q/20773436
tags question: http://stackoverflow.com/q/20746050
tags question: http://stackoverflow.com/q/20689411
tags question: http://stackoverflow.com/q/20712672
tags question: http://stackoverflow.com/q/20849509
tags question: http://stackoverflow.com/q/20748763
tags question: http://stackoverflow.com/q/20714320
type: Tag
tags question: http://stackoverflow.com/q/20720483
tags question: http://stackoverflow.com/q/20772114
tags question: http://stackoverflow.com/q/20693744
tags question: http://stackoverflow.com/q/20729269
tags question: http://stackoverflow.com/q/20776340
tags question: http://stackoverflow.com/q/20775287
tags question: http://stackoverflow.com/q/20819769
tags question: http://stackoverflow.com/q/20844144
tags question: http://stackoverflow.com/q/20695014
tags question: http://stackoverflow.com/q/20773197
tags question: http://stackoverflow.com/q/20777500
tags question: http://stackoverflow.com/q/20765667
tags question: http://stackoverflow.com/q/20748173
tags question: http://stackoverflow.com/q/20776505
tags question: http://stackoverflow.com/q/20823545
tags question: http://stackoverflow.com/q/20728833
tags question: http://stackoverflow.com/q/20784765
tags question: http://stackoverflow.com/q/20724618
tags question: http://stackoverflow.com/q/20827779
tags question: http://stackoverflow.com/q/20707114
tags question: http://stackoverflow.com/q/20809451
tags question: http://stackoverflow.com/q/20777361
tags question: http://stackoverflow.com/q/20719363

http://stackoverflow.com/a/25713878
has comment: http://stackoverflow.com/comment/44014063
downvote count: 0
answers question: http://stackoverflow.com/q/20704395
type: Answer
has body: I had the same problem - turns out the port used for the webserver was already in use. Did you try changing the port number in sonarqube-4.4\conf\sonar.properties sonar.web.port=9001 ?
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43432711

http://stackoverflow.com/a/20743963
answers question: http://stackoverflow.com/q/20743853
upvote count: 1
score: 1
has body: No, threads are not responsible for sockets. Sockets are not registered to threads, but to processes. Control of the sockets is left up to the process, but the operating system manages the sockets.
downvote count: 0
type: Answer

http://stackoverflow.com/q/20743120
has comment: http://stackoverflow.com/comment/31083662
accepted answer: http://stackoverflow.com/a/20743159
has comment: http://stackoverflow.com/comment/31081635
tagged with: inheritance
favorite count: 0
has body: How can we compile the below code without changing the class b? class a { public a(int x) { System.out.println(x); } } class b extends a { public b(int x) { //super(x); } }
possible better answer: http://stackoverflow.com/a/20743203
has comment: http://stackoverflow.com/comment/31082059
has comment: http://stackoverflow.com/comment/31082563
has title: How to make this inheritance work in Java?
upvote count: 1
has comment: http://stackoverflow.com/comment/31082840
has answer: http://stackoverflow.com/a/20743159
has comment: http://stackoverflow.com/comment/31082420
type: AnsweredQuestion
downvote count: 9
tagged with: java
has answer: http://stackoverflow.com/a/20743465
has comment: http://stackoverflow.com/comment/31082599
score: -8
has comment: http://stackoverflow.com/comment/31081625
type: Question
has answer: http://stackoverflow.com/a/20743203
answer count: 3

http://stackoverflow.com/comment/31136125
comment on: http://stackoverflow.com/q/20773398
type: Comment
type: QuestionComment
has text: Use a `JTable` for tabular data! Please use the correct spelling for words like 'you', 'your' & 'please'. This makes it easier for people to understand and help.
score: 0

http://stackoverflow.com/comment/31076494
type: QuestionComment
comment on: http://stackoverflow.com/q/20740122
has text: it's not incomplete. is Scala!
score: 0
type: Comment

http://stackoverflow.com/comment/31142677
type: Comment
has text: Good point, done that (that particular class hasn't changed but it is still better to point to the more current docs).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20777090

http://stackoverflow.com/comment/31047790
score: 1
type: QuestionComment
has text: @MohamedHemdan Well, what you tried next is not the solution.
comment on: http://stackoverflow.com/q/20724066
type: Comment

http://stackoverflow.com/a/20729130
answers question: http://stackoverflow.com/q/20728932
has body: The following pseudo code should help clarify your problem. I would invoke a function, for example reveal letter which I have defined below after each turn. public class Unscramble{ public static void main(String[] args){ char[] orig = args[0].toCharArray(); char[] shuffled = args[1].toCharArray(); int count = 0; while(count &lt; orig.length){ if(!(orig[count] == shuffled[count])) shuffled = revealLetter(shuffled,orig, count); count++; System.out.println(count + " " + new String(shuffled)); } } /* * Reveal letter * @param shuffled the shuffled array * @param original original char array * @param index index of letter to reveal */ public static char[] revealLetter(char[] shuffled, char[] original, int index){ shuffled[index] = original[index]; return shuffled; } }
score: 0
has comment: http://stackoverflow.com/comment/31056788
has comment: http://stackoverflow.com/comment/31056928
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20728932

http://stackoverflow.com/q/20761980
answer count: 2
has comment: http://stackoverflow.com/comment/31115422
downvote count: 0
tagged with: generics
favorite count: 0
possible better answer: http://stackoverflow.com/a/20762075
has answer: http://stackoverflow.com/a/20762075
has answer: http://stackoverflow.com/a/20762085
type: AnsweredQuestion
score: 2
tagged with: list
upvote count: 2
tagged with: java
has title: Generic type java.util.List inheritance
type: Question
has body: Lets say I've got two classes Person and Child. Child inherits from Person. I have also 2 other classes Class1 and Class2. Class1 has constructor with only one parameter - its a java.util.List of Person. Class2 has List of Child. I want to pass these childs to Class1 constructor. But I can't do it - Eclipse says that The constructor Class1(List&lt;Child&gt;) is undefined. I thought it would be possible because Child inherits from Person. What is the problem? SSCCE (not compilable) may looks like this: Somewhere in Class2 List&lt;Child&gt; childs = new ArrayList&lt;Child&gt;(); new Class1(childs); Class1 constructor public Class1(List&lt;Person&gt; persons) { //do nothing(); }
accepted answer: http://stackoverflow.com/a/20762085
tagged with: inheritance

http://stackoverflow.com/a/20887665
has comment: http://stackoverflow.com/comment/120660635
has comment: http://stackoverflow.com/comment/120667374
has comment: http://stackoverflow.com/comment/120669910
answers question: http://stackoverflow.com/q/20782268
upvote count: 1
has comment: http://stackoverflow.com/comment/120661890
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/120641129
type: Answer
has body: The first issue is the &lt;driver/&gt; tag is not a valid tag for a &lt;custom-handler/&gt;. The second issue is 7.1.1.Final will not allow log4j appenders to be defined as custom handlers. This would work with EAP 6.x (6.2 has all the bugs worked out), but without knowing much about how log4j implemented it's DB connection there could be potential issues with booting. For example the driver might not be on the CP yet so you might have to add an explicit module and dependency. You might be best to just create a simple java.util.logging.Handler or org.jboss.logmanager.ExtHandler to handle your DB logging. It should be fairly simple to do and wouldn't rely on log4j. You could just add the handler to an async-handler for performance.

exception
tags question: http://stackoverflow.com/q/20748083
tags question: http://stackoverflow.com/q/20805121
tags question: http://stackoverflow.com/q/20788396
tags question: http://stackoverflow.com/q/20814037
tags question: http://stackoverflow.com/q/20785373
tags question: http://stackoverflow.com/q/20751119
tags question: http://stackoverflow.com/q/20804063
tags question: http://stackoverflow.com/q/20681212
tags question: http://stackoverflow.com/q/20719891
tags question: http://stackoverflow.com/q/20780495
tags question: http://stackoverflow.com/q/20720549
tags question: http://stackoverflow.com/q/20699201
tags question: http://stackoverflow.com/q/20679295
tags question: http://stackoverflow.com/q/20793412
tags question: http://stackoverflow.com/q/20709120
tags question: http://stackoverflow.com/q/20838482
tags question: http://stackoverflow.com/q/20785578
tags question: http://stackoverflow.com/q/20762622
type: Tag
tags question: http://stackoverflow.com/q/20822395
tags question: http://stackoverflow.com/q/20814609
tags question: http://stackoverflow.com/q/20741916
tags question: http://stackoverflow.com/q/20739150
tags question: http://stackoverflow.com/q/20786995
tags question: http://stackoverflow.com/q/20781910
tags question: http://stackoverflow.com/q/20802541
tags question: http://stackoverflow.com/q/20739736
tags question: http://stackoverflow.com/q/20697132
tags question: http://stackoverflow.com/q/20773657
tags question: http://stackoverflow.com/q/20744275
tags question: http://stackoverflow.com/q/20744281
tags question: http://stackoverflow.com/q/20829802
tags question: http://stackoverflow.com/q/20832242
tags question: http://stackoverflow.com/q/20719685
tags question: http://stackoverflow.com/q/20701612
tags question: http://stackoverflow.com/q/20686750
tags question: http://stackoverflow.com/q/20726425
tags question: http://stackoverflow.com/q/20791532
tags question: http://stackoverflow.com/q/20761585
tags question: http://stackoverflow.com/q/20717270
tags question: http://stackoverflow.com/q/20693859
tags question: http://stackoverflow.com/q/20780471
tags question: http://stackoverflow.com/q/20769990
tags question: http://stackoverflow.com/q/20773185
tag name: exception
tags question: http://stackoverflow.com/q/20684514
tags question: http://stackoverflow.com/q/20794320
tags question: http://stackoverflow.com/q/20771102
tags question: http://stackoverflow.com/q/20723468
tags question: http://stackoverflow.com/q/20701816
tags question: http://stackoverflow.com/q/20732113
tags question: http://stackoverflow.com/q/20703607
tags question: http://stackoverflow.com/q/20801546
tags question: http://stackoverflow.com/q/20723408
tags question: http://stackoverflow.com/q/20824884
tags question: http://stackoverflow.com/q/20738768
tags question: http://stackoverflow.com/q/20689356
tags question: http://stackoverflow.com/q/20845239
tags question: http://stackoverflow.com/q/20840396

http://stackoverflow.com/a/20792752
has comment: http://stackoverflow.com/comment/31171367
answers question: http://stackoverflow.com/q/20792560
has comment: http://stackoverflow.com/comment/31171261
has comment: http://stackoverflow.com/comment/31171244
downvote count: 0
type: Answer
has body: Don't worry about suites yet. You'll know when you need them. I've only had to use them a handful of times, and I'm not entirely sold on their usefulness...but I leave that decision up to you. To the meat of your question - the conventional way with JUnit tests is to neither know nor depend on the order of execution of your tests; this ensures that your tests are not run-order dependent, and if they are, something is wrong with your tests* and validation. The main core concept behind unit tests is that they test a unit of code - as simple as a single function. If you're attempting to test five different things at once, your test is far too large, and should be broken out. If the method you're testing is monolithic in nature, and difficult to test, it should be refactored and broken out into different slices of responsibility. Tests that exercise a larger flow are better suited for integration-style tests, which tend to be written as unit tests, but aren't actually unit tests. I've not run into a scenario in which, if I knew that if a certain test failed, I could expect different behavior in the other tests. I've never thought that such a thing was necessary to be noted, since the only thing I care about in my unit test is how that unit of code behaves given a certain input. Keep your tests small and simple to understand; the test should only make one assertion about the result (or a general assertion of the state of your result). *: That's not to say that it's completely broken, but those sorts of tests should be fixed sooner rather than later.
score: 1
upvote count: 1

http://stackoverflow.com/comment/31012303
type: Comment
has text: you are not initializing your button, are you?
type: QuestionComment
comment on: http://stackoverflow.com/q/20705135
score: 0

http://stackoverflow.com/a/20726051
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20725006
has body: The xpath = //span[contains(.,'next')] used in your code, locates span with contents view more : next › ,but you need to click only on next ›.i.e., you need to click on the anchor tag which contains next ›. The below code will solve the issue. WebDriver driver = new FirefoxDriver(); driver.get("http://www.reddit.com/r/pics/"); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); WebElement element = driver.findElement(By .linkText("next ›")); element.click(); System.out.println(driver.getCurrentUrl());
downvote count: 0

http://stackoverflow.com/a/20752159
upvote count: 1
has comment: http://stackoverflow.com/comment/31098754
has body: You can always run your code in main thread by creating Handler on main looper: Handler handler= new Handler(Looper.getMainLooper()); Then just call handler.post(new Runnable( @Override public void run () { // code that should be running from UI Thread } ));
has comment: http://stackoverflow.com/comment/31098811
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20751959
has comment: http://stackoverflow.com/comment/31098866
type: Answer
answers question: http://stackoverflow.com/q/20751959
score: 1

http://stackoverflow.com/comment/30986497
type: Comment
has text: Let me explain in some words: For each activity, you need to declare it (the activity) in the manifest file. It's a kind of resume of your application, like a "list of students who need to be here every morning to say: "Don't forget me, I'm present today". U see?
comment on: http://stackoverflow.com/a/20690176
type: AnswerComment
score: 0

http://stackoverflow.com/q/20730790
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/20730863
tagged with: time
has answer: http://stackoverflow.com/a/21344726
has answer: http://stackoverflow.com/a/20730863
upvote count: 1
accepted answer: http://stackoverflow.com/a/20730841
tagged with: java
answer count: 3
has title: Get minutes of date using Joda-Time
tagged with: date
tagged with: jodatime
type: AnsweredQuestion
downvote count: 0
has body: Following zulu date string is given: 2013-12-18T23:41:54.959Z And I want to convert this to GMT and retrieve the minutes using Joda-Time. I build following method: public static int minutesFromDateString(final String s){ DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm").withZone(DateTimeZone.forID("Europe/Berlin")); DateTime dt = formatter.parseDateTime(s); Calendar calendar = Calendar.getInstance(); calendar.setTime(dt.toDate()); return calendar.get(Calendar.MINUTE); } However this returns an error: 12-22 16:04:11.940: E/AndroidRuntime(6433): java.lang.IllegalArgumentException: Invalid format: "2013-12-18T23:41:54.959Z" is malformed at "13-12-18T23:41:54.959Z" Any ideas whats wrong?
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/20730841

http://stackoverflow.com/a/20680098
has body: You've missed the last closing bracket ()) of this statement. System.out.println("The result of dividing is: " + (x/y); It should be: System.out.println("The result of dividing is: " + (x/y)); ↑ All the other stuff compiles for me.
accepted answer of: http://stackoverflow.com/q/20680042
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30967876
has comment: http://stackoverflow.com/comment/30967591
has comment: http://stackoverflow.com/comment/30967562
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/30967534
downvote count: 0
has comment: http://stackoverflow.com/comment/30967997
has comment: http://stackoverflow.com/comment/30967748
answers question: http://stackoverflow.com/q/20680042
upvote count: 6

http://stackoverflow.com/q/20700531
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31004219
tagged with: java
tagged with: android-intent
type: Question
linked to: http://stackoverflow.com/q/2224676
has comment: http://stackoverflow.com/comment/31007427
has title: Error in the ProgressDialog.dimiss method when called by AsyncTask
upvote count: 5
tagged with: listview
has answer: http://stackoverflow.com/a/20701419
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/31004544
has body: I use AsyncTask to get data from a server to build adapter for my listview. But if I use ProgressDialog inside my AsyncTask, I get an error. Code: File AsyncTaskSetAdapterListViewDetail.java public class AsyncTaskSetAdapterListViewDetail extends AsyncTask<Void, Void, List<Map<String, Object>>> { private final String query; private final Context ctx; private final ProgressDialog Loading; public final HashMap<String, Object> Data; private final View listv; public AsyncTaskSetAdapterListViewDetail(final String query, final Context ctx, View listv, HashMap<String, Object> Data) { this.query = query; this.ctx = ctx; this.Loading = new ProgressDialog(ctx); this.listv = listv; this.Data = Data; } @Override protected void onPreExecute(){ super.onPreExecute(); Loading.setMessage("Loading..."); Loading.setCancelable(false); Loading.show(); } @Override protected List<Map<String, Object>> doInBackground(final Void... voids) { List<Map<String, Object>> BrightCoveData = new ArrayList<Map<String, Object>>(); BrightCoveClient bcClient = new BrightCoveClient(); String QueryType = (String) Data.get("QueryType"); if(QueryType == "bccategory") { BrightCoveData = bcClient.QueryData(query, ctx); } else if(QueryType == "bcplaylist") { BrightCoveData = bcClient.QueryDataPlaylist(query, ctx); } return BrightCoveData; } @Override protected void onPostExecute(List<Map<String, Object>> result) { super.onPostExecute(result); String[] fromStr = (String[]) Data.get("StringFrom"); int[] toInt = (int[]) Data.get("ToInt"); String strClass = listv.getClass().toString(); String[] typeView = strClass.split("\\."); int resource = (Integer) Data.get("Resource"); String type = typeView[typeView.length - 1]; for (Map<String, Object> map : result) { String videoID = map.get("videoID").toString(); String name = map.get("title").toString(); String description = map.get("description").toString(); String duration = map.get("duration").toString(); if (!VideoFunctions.isVideoExisted(videoID)) { VideoFunctions.add…
has answer: http://stackoverflow.com/a/20700629
downvote count: 0
has comment: http://stackoverflow.com/comment/50361498
favorite count: 0

http://stackoverflow.com/a/20694902
has comment: http://stackoverflow.com/comment/30994853
has comment: http://stackoverflow.com/comment/30994783
answers question: http://stackoverflow.com/q/20694883
upvote count: 4
downvote count: 0
score: 4
type: Answer
has body: KeyEvents are only generated for the component that has focus. No component on your applet has focus, so not components can receive KeyEvents. Try something like: Component contentPane = getContentPane(); contentPane.setFocusable(true); contentPane.addKeyListener( this ); The real question is what are you trying to do? There is probably a better solution that we can suggest when we know the real requirement. Normally you would use Key Bindings to listen for a KeyStroke on a given component.

http://stackoverflow.com/comment/31182344
comment on: http://stackoverflow.com/q/20799573
has text: In the first sample, you're doing `Person person = new Teacher();` and in the second one you're doing `Student person = new Student();`. That's different. Doing `Person person = new Student();` in the Java code would yield the same result.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/31047424
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20714628
type: Comment
has text: I am not using Spring... at least not what I am aware of :D

http://stackoverflow.com/a/20704171
score: 1
accepted answer of: http://stackoverflow.com/q/20704047
has comment: http://stackoverflow.com/comment/31010628
answers question: http://stackoverflow.com/q/20704047
type: Answer
has comment: http://stackoverflow.com/comment/31010574
upvote count: 1
has body: Short explanation to give you an overview: In classes you talk about private and public variables. Most the time you declare a variable as private and access it with public getter and setter methods. In a procedure you can declare variables gloable or local, but not with a keyword like public/private. The variables are global when you can access them in the whole procedure and they are local when they are for example only in a while loop or and if statement. I hope you have a little overview now. Take a look at protected variables too.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31264839
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20732151
type: QuestionComment
has text: It can be 2003 or 2007. The format can be xls or xlsx.

http://stackoverflow.com/q/20731158
accepted answer: http://stackoverflow.com/a/20731312
answer count: 2
type: AnsweredQuestion
upvote count: 35
has title: Maven module using spring-boot
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/29257409
type: Question
possible better answer: http://stackoverflow.com/a/31695357
has answer: http://stackoverflow.com/a/31695357
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/20731312
has body: I like to configure my applications in maven by creating modules like; com.app example-app 0.0.1-SNAPSHOT pom app-api app-impl app-web The modules then use the 'example-app' as the parent. Now I want use 'spring-boot' for my web application. Is there a way to configure maven so that my 'app-web' is a spring-boot application? The problem I'm facing is that you have to use spring-boot as a parent.
tagged with: spring-boot
score: 35
tagged with: java

http://stackoverflow.com/a/20694850
has body: The function Studying() isn't a class, so Studying frame = new Studying(); refers to public class Studying extends JFrame and public void Studying() is never called. Move the creation of the buttons to the static main, and append them to the frame, and the buttons will be visible. public class Studying extends JFrame { static JButton button = new JButton("Word"); static JButton button1 = new JButton("MoreWords"); public static void main(String[] args) { Studying frame = new Studying(); frame.setTitle("test"); frame.setSize(500, 200); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridLayout(1, 2)); frame.add(button); frame.add(button1); frame.setVisible(true); } }
answers question: http://stackoverflow.com/q/20694785
score: 0
type: Answer

http://stackoverflow.com/comment/31125480
type: Comment
has text: Add it as ur answer then
comment on: http://stackoverflow.com/a/20767328
type: AnswerComment
score: 0

http://stackoverflow.com/q/20690269
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30986742
has body: I've followed everything I could find online about making Java Web start applications. I did sign my jar, however when I verify it I get the following: And when I try to use the jar in a web start application, I get the security warning about unsigned applications. Any help would be appreciated, thanks. Oh, also, the jar was made using eclipse, if that helps at all. This is what the warning looks like, the application runs but nothing works: The JNLP is as follows: <?xml version="1.0" encoding="UTF-8"?> Game of Life My name <j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/> <jar href="/GoL.jar" main="true" /> <update check="background"/>
has comment: http://stackoverflow.com/comment/30987436
tagged with: java
has comment: http://stackoverflow.com/comment/30994689
type: Question
has title: Signing JAR but file still does not work as a Java Web Start Application
tagged with: jar-signing
has comment: http://stackoverflow.com/comment/30986337
tagged with: jar
has comment: http://stackoverflow.com/comment/30986430
has comment: http://stackoverflow.com/comment/30986387
score: 0

http://stackoverflow.com/a/20738581
type: Answer
has comment: http://stackoverflow.com/comment/31088642
score: 2
has comment: http://stackoverflow.com/comment/31088536
upvote count: 3
has body: If you are looking for the problem of finding the convex hull of a finite set of points, take a look at here. You can find several solutions to do this in O(n*log n) If you are just looking for the four corners of the bounding rectangle of this convex hull, actually you are looking for minimum bounding box for the convex hull. If the bounding box is parallel to the coordinate axes, just find the min_x, min_y, max_x and max_y among all these convex hull points. Then the four corners (clockwisely) are: (min_x, min_y) (max_x, min_y) (max_x, max_y) (min_x, max_y) If the bounding box is not parallel to the coordinate axes, this becomes complex. Check out the references introduced in here and here for the implementation.
downvote count: 1
has comment: http://stackoverflow.com/comment/130870707
accepted answer of: http://stackoverflow.com/q/20733044
answers question: http://stackoverflow.com/q/20733044
type: AcceptedAnswer

http://stackoverflow.com/comment/31036871
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20716367
has text: The code currently in your question still does not close connections or statements. As stated by Steve, always close any resource in a finally block (or use Java 7 try-with-resources).
type: Comment

http://stackoverflow.com/a/26521208
downvote count: 1
score: -1
has body: There's some integration magic accomplished by http://www.ryantenney.com/metrics-spring/ that wires codahale metrics into the actuator /health endpoint. With this dependency included, compile 'com.ryantenney.metrics:metrics-spring:3.0.0-RC2' you can "enableMetrics" in your application configuration @EnableMetrics public class ApplicationConfiguration { ... This allows you to time each request with the @timed annotation: @Timed @RequestMapping(method=RequestMethod.GET) public @ResponseBody Foo foo() { ... and to have your other interactions with MetricRegistry aggregate into the actuator /health endpoint. I've put together an example application which implements this integration: https://github.com/benschw/consul-cluster-puppet/tree/master/demo and written a more in depth tutorial here: http://txt.fliglio.com/2014/10/spring-boot-actuator/
upvote count: 0
answers question: http://stackoverflow.com/q/20707746
type: Answer

http://stackoverflow.com/comment/31160053
score: 0
type: Comment
has text: 1) I used a while(true) loop because i wanted the countdown function to be available more than once. 2) I used a flag because the "Start" button was stuck when i executed the code inside the ActionListener. 3) That was actually a good idea, forgot about it when i wrote the code.
comment on: http://stackoverflow.com/a/20786588
type: AnswerComment

http://stackoverflow.com/a/20783713
has comment: http://stackoverflow.com/comment/31171543
answers question: http://stackoverflow.com/q/20771803
type: Answer
score: 11
downvote count: 0
has body: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h But this depends on your environment.
upvote count: 11
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20771803

http://stackoverflow.com/q/20796970
has comment: http://stackoverflow.com/comment/31178285
accepted answer: http://stackoverflow.com/a/20797611
tagged with: android
has comment: http://stackoverflow.com/comment/31178399
favorite count: 0
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/31178572
type: AnsweredQuestion
has title: Date picker dialog is not working in fragment
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31178371
has answer: http://stackoverflow.com/a/20797611
tagged with: date
has body: here i have made a simple code for date picker which works for current date, year and day,it is not working for fragment public class Activity extends Sherlockfragment { EditText dob; public static final int DATE_DIALOG_ID = 1009; String dob_string; int year = 2013, month = 10, day = 1, dayofmonth = 1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.update_profile, container, false); mdob = (EditText)view. findViewById(R.id.dob); mdob.setOnClickListener(new View.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); }}); return view; } // ****************************#DATE PICKER DIALOG# ************************** @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date return new DatePickerDialog(this, datePickerListener, year, month, day); } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { year = selectedYear; month = selectedMonth + 1; day = selectedDay; Calendar cal = Calendar.getInstance(); cal.set(selectedYear, selectedMonth, selectedDay); DateFormatSymbols dfs = new DateFormatSymbols(Locale.getDefault()); String weekdays[] = dfs.getWeekdays(); int daykk = cal.get(Calendar.DAY_OF_WEEK); String dayof = weekdays[daykk]; mdob.setText(day + "-" + month + "-" + year + dayof); mdob_string = day + "-" + month + "-" + year; }}; }
has comment: http://stackoverflow.com/comment/31177994
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20799236
has comment: http://stackoverflow.com/comment/31178329
has comment: http://stackoverflow.com/comment/31177753
linked to: http://stackoverflow.com/q/11527051
tagged with: android-datepicker
has answer: http://stackoverflow.com/a/20799236

http://stackoverflow.com/q/20792394
tagged with: java
type: Question
tagged with: firebird
downvote count: 0
has comment: http://stackoverflow.com/comment/31185914
has answer: http://stackoverflow.com/a/20802286
has title: Binding the following Entries in Global JNDI empty for Firebird
answer count: 1
has comment: http://stackoverflow.com/comment/31180382
favorite count: 0
tagged with: jpa-2.0
has body: I have trouble binding local and remote versions of service beans to the Global JNDI for Firebird database. To check whether I'm missing something I also setup a test configuration for SQL Server which works just fine. I'm using jaybird-2.1.6.jar. Something is incomplete or wrong in my Firebird JPA setup. When I use d20pid/D20PIDServiceBean/local to access the local service bean I get an error saying: Could not get the JNDI resource with the following JNDI name: d20pid/D20PIDServiceBean/local Understandably so since it hasn't been bound. Any help would be greatly appreciated! Thank you! Persistence.xml part for firebird: java:/D20-PID-DS edu.msu.its.d20pid.ejb.entity.ProvStudent <property name="hibernate.dialect" value="org.hibernate.dialect.FirebirdDialect" /> <property name="hibernate.show_sql" value="true" /> Datasource file firebird details (intentionally left out credentials) D20-PID-DS jdbc:firebirdsql:idcard.dev.ais.msu.edu:/home2/d20/idcard.db org.firebirdsql.jdbc.FBDriver 15 <check-valid-connection-sql>SELECT CAST(1 as INTEGER) FROM rdb$database</check-valid-connection-sql> false <prepared-statement-cache-size>0</prepared-statement-cache-size> Firebird server.log on EAR deployment; local and remote for D6501ServiceBean (SQL Server) are bound but not for D20PIDServiceBean (Firebird) 17:10:23,318 INFO [SessionSpecContainer] Starting boss.j2ee:ear=d20pid.ear,jar=d20pid-ejb3.jar,name=D20PIDServiceBean,service=EJB3 17:10:23,322 INFO [EJBContainer] STARTED EJB: edu.msu.its.d20pid.ejb.servicebean.D20PIDServiceBean ejbName: D20PIDServiceBean 17:10:23,324 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI: 17:10:23,327 INFO [SessionSpecContainer] Starting jboss.j2ee:ear=d20pid.ear,jar=d20pid-ejb3.jar,name=D6501ServiceBean,service=EJB3 17:10:23,329 INFO [EJBContainer] STARTED EJB: edu.msu.its.d20pid.ejb.servicebean.D6501ServiceBean ejbName: D6501ServiceBean 17:10:23,357 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global …
tagged with: jboss5.x
type: UnansweredQuestion
upvote count: 1
score: 1

http://stackoverflow.com/comment/31109542
type: QuestionComment
comment on: http://stackoverflow.com/q/20753419
score: 0
type: Comment
has text: @Luiz But each line would have each data type starting from the same index ? Meaning,without the double quotes, your name would always be at index 11 and amount at index 51.Is that correct ?

http://stackoverflow.com/comment/31153854
comment on: http://stackoverflow.com/a/20783311
type: Comment
score: 0
type: AnswerComment
has text: Is there any other way using Collection Tree to sort object on void beforeMarshal(Marshaller marshaller) listener ?

http://stackoverflow.com/a/20802018
accepted answer of: http://stackoverflow.com/q/20801874
type: Answer
has comment: http://stackoverflow.com/comment/31186813
answers question: http://stackoverflow.com/q/20801874
downvote count: 0
score: 21
has body: You need to change your pom for artifactid Main. You need to add the maven-assembly-plugin In the configuration of it you have an option to specify the mainClass in the manifest. This should be the fully qualified name of the Main class. 4.0.0 org.example Test 1.0-SNAPSHOT Main <maven.assembly.plugin.version>2.4</maven.assembly.plugin.version> <dep.version>1.0-SNAPSHOT</dep.version> org.apache.maven.plugins maven-jar-plugin org.apache.maven.plugins maven-assembly-plugin org.apache.maven.plugins maven-assembly-plugin ${maven.assembly.plugin.version} jar-with-dependencies Main make-assembly package single org.example Dep ${dep.version} After you start your build on the parent project, it should create the executable jar in the target subfolder of the module Main. (a jar with the name Main-1.0-SNAPSHOT-jar-with-dependencies.jar was what i got)
upvote count: 21
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137528488
has comment: http://stackoverflow.com/comment/31193841

http://stackoverflow.com/a/20745456
has comment: http://stackoverflow.com/comment/31085862
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20745387
downvote count: 0
score: 8
type: Answer
has body: I would do it like this private static boolean bitOf(char in) { return (in == '1'); } private static char charOf(boolean in) { return (in) ? '1' : '0'; } public static void main(String[] args) { String lseq ="0011111111101111111111111100101101111100110000001011111000010100"; String tseq ="0011111111100000110011001100110011001100110011001100110011001100"; String hseq ="0011111111110010010111110100010111100000101101001110000100011110"; StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; lseq.length(); i++) { sb.append(charOf(bitOf(lseq.charAt(i)) ^ bitOf(tseq.charAt(i)) ^ bitOf(hseq.charAt(i)))); } String result = sb.toString(); System.out.println(result); } Which outputs 0011111111111101011011000100001001010000101110001001001111000110
upvote count: 8
answers question: http://stackoverflow.com/q/20745387

http://stackoverflow.com/q/20699446
has title: Jsoup parse html for subscript and superscript
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: superscript
possible better answer: http://stackoverflow.com/a/20701683
has body: I'm using Jsoupto parse clipboard value to html code but it not working for subscript and superscript. For an example: Superscript Hello World (HTML: Hello World) Subscript Hello World (HTML: Hello World) Code result = rtfToHtml(new StringReader(streamToString((InputStream) contents.getTransferData(dfRTF)))); The Resul for above example is: < html > < head > < style > < !-- p.default { size:3; family:sansserif; foreground:#000000; bold:normal; italic:; } -- > < /style > < /head > < body > < p class=default > < span style="color: #000000; font-size: 14pt; font-family: ArialMT"> < b>Hello < /b> < /span> < span style="color: #000000; font-size: 11pt; font-family: ArialMT"> < b>World< /b> < /span> < /p> < /body> < /html> Any idea how I can handle Superscript and Subscript using Jsoup. Any advice or references is highly appreciated. EDIT Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable contents = clipboard.getContents(null); DataFlavor dfRTF = new DataFlavor("text/rtf", "Rich Formatted Text"); DataFlavor dfTxt = DataFlavor.stringFlavor; boolean hasTransferableRTFText = (contents != null) && contents.isDataFlavorSupported(dfRTF); boolean hasTransferableTxtText = (contents != null) && contents.isDataFlavorSupported(dfTxt); if (hasTransferableRTFText) { try { result = rtfToHtml(new StringReader(streamToString((InputStream) contents.getTransferData(dfRTF)))); Document doc = Jsoup.parse(result); } } EDIT public static String rtfToHtml(Reader rtf) throws IOException { // From http://www.codeproject.com/Tips/136483/Java-How-to-convert-RTF-into-HTML JEditorPane p = new JEditorPane(); p.setContentType("text/rtf"); EditorKit kitRtf = p.getEditorKitForContentType("text/rtf"); try { kitRtf.read(rtf, p.getDocument(), 0); kitRtf = null; EditorKit kitHtml = p.getEditorKitForContentType("text/html"); Writer writer = new StringWriter(); kitHtml.write(writer, p.getDocument(), 0, p.getDocument().getLength()); return writer.toString(); } catch (BadLocatio…
has answer: http://stackoverflow.com/a/20730039
has answer: http://stackoverflow.com/a/20701683
tagged with: subscript
upvote count: 3
has comment: http://stackoverflow.com/comment/31070781
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/20730039
type: Question
tagged with: jsoup
answer count: 2

http://stackoverflow.com/comment/31180303
score: 1
comment on: http://stackoverflow.com/q/20798357
type: Comment
type: QuestionComment
has text: Give more details. Your problem is unclear.

http://stackoverflow.com/q/20778143
tagged with: log4j
type: UnansweredQuestion
tagged with: logging
type: Question
tagged with: java
tagged with: logback
has body: I choose a log appender dynamically by using a Java system property like this %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n true true ${logLocation}/%d{yyyyMMdd}.%i.log %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n <appender-ref ref="${logAppender:-STDOUT}" /> As you can see the default value of the logAppender variable is STDOUT. Problem is that even when the STDOUT appender is selected, the FILE appender is instantiated and keep making logLocation_IS_UNDEFINED/%d{yyyyMMdd}.%i.log file on the root of the project. Can I prevent instantiate of FILE appender not to make the useless directory and file?
score: 0
has answer: http://stackoverflow.com/a/20780402
answer count: 1
has title: Prevent instantiate of specific appender

http://stackoverflow.com/comment/31249817
comment on: http://stackoverflow.com/q/20835760
type: Comment
type: QuestionComment
has text: No. Each WebDriver will control its' own browser window(s), and I don't think you can automate a previously running browser window.
score: 0

http://stackoverflow.com/q/20751996
has title: Most efficient way to store and sort words by length?
score: 1
has comment: http://stackoverflow.com/comment/31098830
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/4244627
possible better answer: http://stackoverflow.com/a/20752431
has comment: http://stackoverflow.com/comment/31098923
linked to: http://stackoverflow.com/q/18885656
answer count: 2
has answer: http://stackoverflow.com/a/20752035
accepted answer: http://stackoverflow.com/a/20752035
has comment: http://stackoverflow.com/comment/31098902
has comment: http://stackoverflow.com/comment/31098560
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31098472
favorite count: 0
has comment: http://stackoverflow.com/comment/31098884
has body: Since many words might have the same length, an insertion operation to a certain database can be costly. I saw the following suggestions for storing and sorting words by length. Which is the most efficient? Key: length of word, Value: Set of all words with that length. Using HashMap: Sorting all words in a file by length, in one read. (Java) Using Guava's MultiMap: https://stackoverflow.com/a/4244798/2653179 TreeMap? Or storing the words in an ArrayList, writing compare function, then using Collections.sort: Java: Sort a list of words by length, then by alphabetical order Or other suggestions?
has answer: http://stackoverflow.com/a/20752431
type: AnsweredQuestion

http://stackoverflow.com/comment/31211856
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20815003
type: Comment
has text: @Boann thanks for the valid comments I edited the answer

http://stackoverflow.com/a/20787146
type: Answer
has body: Consider you have a set of Strings like Set&lt;String&gt; set = new HashSet&lt;String&gt;(); // some elements in set then you can try List&lt;String&gt; listFromSet = new ArrayList&lt;String&gt;(yourCurrentSet); in your case . List&lt;String&gt; listFromSet = new ArrayList&lt;String&gt;(mPrefsaved.getStringSet("faves", null)); Make sure that your method getStringSet returns a collection of Strings.
downvote count: 0
has comment: http://stackoverflow.com/comment/31160416
has comment: http://stackoverflow.com/comment/31161043
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/31167293
answers question: http://stackoverflow.com/q/20787099

http://stackoverflow.com/comment/31179058
score: 0
type: Comment
has text: Hi, I have used the above code of BufferedInputStream and Now the files are getting downloaded but the size of the file is 0 bytes. What should i do now ??
comment on: http://stackoverflow.com/a/20787016
type: AnswerComment

http://stackoverflow.com/a/20809282
score: 5
has body: In C#, which does not have type erasure, there are several ways to work around not knowing a type argument at compile-time: Non-generic subset: If it happens to be the case that the methods of MyInterface&lt;T&gt; that you need don't involve T, then you can extract that portion of the interface into a base interface and return the base interface instead. Pro: No runtime type shenanigans. Con: Modifies the type (moving methods to a new base interface), breaking binary compatibility. Type checking wrapper: Make a RuntimeTypeCheckedMyInterface&lt;T&gt; class that implements MyInterface&lt;object&gt; by delegating to a MyInterface&lt;T&gt; after type checking. Have the method return a MyInterface&lt;object&gt;, created by wrapping the MyInterface&lt;whatever&gt; inside a RuntimeTypeCheckedMyInterface. Pro: Works with any existing interface type, without modifying it. Con: Introduces "does T=object really mean object, or does it mean unknown type"? ambiguity. Manual type erasure: Make a variant of MyInterface&lt;T&gt; that doesn't have a T like MyInterfaceOfUnknownType. Make MyInterface&lt;T&gt; inherit from MyInterfaceOfUnknownType. Have your method return MyInterfaceOfUnknownType. Pro: Acts basically identical to Java, with MyInterfaceOfUnknownType = MyInterface&lt;?&gt;. Con: Pollutes MyInterface&lt;T&gt; with non-generic methods. When the methods differ only by return type you have to disambiguate with a name change. Modifies the type (breaking source and binary compatibility). Screw the types: Have the method return object or dynamic. Cast conditionally and appropriately. Pro: Initially easy to do. Con: Harder to maintain.
answers question: http://stackoverflow.com/q/20809171
type: Answer
upvote count: 5
downvote count: 0

http://stackoverflow.com/q/20688705
upvote count: 1
downvote count: 1
has title: Implement simple text editor
type: Question
linked to: http://stackoverflow.com/q/4614227
has comment: http://stackoverflow.com/comment/30983305
has answer: http://stackoverflow.com/a/20690166
has comment: http://stackoverflow.com/comment/30983248
tagged with: file-io
answer count: 3
has body: All I am trying is to implement a simple text-editor. I will keep this simple for now. I have a text-area and string variable to hold the text and a file to write the contents of the text-area. Intuitively, I think there is a better way (better readability/agile code) to do the same below and this should work for notepad : FileWriter out = new FileWriter("filename.txt"); String sh = jTextArea1.getText(); for (int i=0; i&lt;sh.length(); i++) { if (sh.charAt(i) == '\n') out.write("\r\n"); else out.write(sh.charAt(i)); } out.close();
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30983181
has answer: http://stackoverflow.com/a/20688988
has comment: http://stackoverflow.com/comment/30983460
score: 0
has answer: http://stackoverflow.com/a/20688992
tagged with: java
tagged with: file

http://stackoverflow.com/comment/31179127
type: AnswerComment
type: Comment
has text: I first started programming on 8 bit computers, I'm not aware of any serious computer using less than 32 for a very long time now though.
comment on: http://stackoverflow.com/a/20782362
score: 0

http://stackoverflow.com/q/20701816
score: -1
tagged with: class
answer count: 2
has comment: http://stackoverflow.com/comment/31006822
upvote count: 0
has comment: http://stackoverflow.com/comment/31006575
favorite count: 0
has comment: http://stackoverflow.com/comment/31006302
has answer: http://stackoverflow.com/a/20702443
has comment: http://stackoverflow.com/comment/31007093
tagged with: exception
tagged with: android
has title: ArrayException in my TestActivity.java class
possible better answer: http://stackoverflow.com/a/20702141
accepted answer: http://stackoverflow.com/a/20702443
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20702141
tagged with: java
has body: I get ArrayException when i tried run my TestActivity.java class, This is First Time i use Arrays , maybe i did something incorrect PLEASE HELP AND ANSWER This is TestActivity.java class : package com.MalekAlrwily.multiplication; import java.util.Random; 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.TextView; public class TestActivity extends Activity { static String[] numbers = {"1","2","3","4","5","6","7","8","9","10"}; static String TrueAnswer ; static int mark = 0 ; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.test); Button center = (Button) findViewById(R.id.center); Button right = (Button) findViewById(R.id.right); Button left = (Button) findViewById(R.id.left); TextView question = (TextView) findViewById(R.id.question) ; int number = TestActivity.getNumber(); question.setText(TestActivity.ArabicNumbers(number) + " × " + TestActivity.ArabicNumbers(MainActivity.num)); Random r = new Random(); int i = r.nextInt(4-1) + 1; if (i==1){ TestActivity.TrueAnswer = "center"; center.setText(TestActivity.ArabicNumbers(number)); Random r2 = new Random(); int i2 = r2.nextInt(100-0) + 0; Random r3 = new Random(); int i3 = r3.nextInt(100-0) + 0; right.setText(TestActivity.ArabicNumbers(i2)); left.setText(TestActivity.ArabicNumbers(i3)); }else if (i==2){ TestActivity.TrueAnswer = "right"; right.setText(TestActivity.ArabicNumbers(number)); Random r2 = new Random(); int i2 = r2.nextInt(100-0) + 0; Random r3 = new Random(); int i3 = r3.nextInt(100-0) + 0; center.setText(TestActivity.ArabicNumbers(i2)); left.setText(TestActivity.ArabicNumbers(i3)); }else{ TestActivity.TrueAnswer = "left"; left.setText(TestActivity.ArabicNumbers(number)); Random r2 = new Random(); int i2 = r2.nextInt(100-0) + 0; Random r3 = new Random(); int i3 = r3.nextInt(100-0) +…
downvote count: 1
type: Question
tagged with: arrays

http://stackoverflow.com/a/20759799
type: Answer
answers question: http://stackoverflow.com/q/20754723
upvote count: 1
has body: Instead of trying to design your entire application in the GUI editor, you may be able to adapt the approach shown here. This will let you focus on a single container at a time. Also, remember to backup your .form files; more here.
score: 1
downvote count: 0

http://stackoverflow.com/a/20680291
has comment: http://stackoverflow.com/comment/30968334
score: 3
answers question: http://stackoverflow.com/q/20680205
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/30968273
type: Answer
accepted answer of: http://stackoverflow.com/q/20680205
upvote count: 3
has body: Just write cursor.moveToFirst(); before getting data from cursor or just under query line. Hope it will help you.

http://stackoverflow.com/q/20680604
has answer: http://stackoverflow.com/a/20680696
score: 0
has answer: http://stackoverflow.com/a/20680751
has answer: http://stackoverflow.com/a/20680659
type: Question
has answer: http://stackoverflow.com/a/20680625
has body: Imagine I have this: String input = "AB BC"; // ( Just an Example) I want to put this String into an char array, but i want to have no duplicates and blank symbols in my char Array. My solution so far: String input = "AB BC" char array[]=input.toCharArray(); for(int i=0;i&lt;array.length;i++){ System.out.println("Data at ["+i+"]="+array[i]); } The Output is : This is my input String AB BC This is the content of my Char Array Data at [0]=A Data at [1]=B Data at [2]= Data at [3]= Data at [4]=B Data at [5]=C Data at [6]= So now I don't know how I can erase the duplicates and the blank symbols.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20681269
tagged with: java
has answer: http://stackoverflow.com/a/20680756
accepted answer: http://stackoverflow.com/a/20680756
tagged with: duplicates
answer count: 6
tagged with: char
tagged with: arrays
has title: Input in Char Array without Duplicates Java
tagged with: string
possible better answer: http://stackoverflow.com/a/20680625

http://stackoverflow.com/comment/31069139
has text: When I added those lines, a blank JFrame is displayed
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20735633
score: 0

http://stackoverflow.com/q/20809280
answer count: 1
has answer: http://stackoverflow.com/a/20812597
accepted answer: http://stackoverflow.com/a/20812597
has title: How to run a Java Sesame Application From Eclipse
type: AnsweredQuestion
tagged with: sesame
has body: I am very new to Java Sesame. I am trying to start with something very simple. Here are the steps I have done so far: 1- Deployed the war files: openrdf-sesame and openrdf-workbench in Tomcat Manager. 2- created a repository called Sample through openrdf-workbench 3- In Eclipse, I have got this code: import org.openrdf.repository.Repository; import org.openrdf.repository.RepositoryConnection; import org.openrdf.repository.RepositoryException; import org.openrdf.repository.config.RepositoryConfigException; import org.openrdf.repository.manager.RemoteRepositoryManager; import java.io.File; import org.openrdf.rio.RDFFormat; import java.net.URL; import org.openrdf.OpenRDFException; import java.io.IOException; public class RDF{ public void create() throws RepositoryConfigException, RepositoryException { String serverUrl = "http://localhost:8080/openrdf-sesame"; RemoteRepositoryManager manager = new RemoteRepositoryManager(serverUrl); manager.initialize(); Repository repository = manager.getRepository("Sample"); File file = new File("Sample_Sesame.json"); String baseURI = "file://Sample_Sesame.json"; try { RepositoryConnection con = repository.getConnection(); try { con.add(file, baseURI, RDFFormat.N3); URL url = new URL("/Users/Documents/newsample/folder/Sample_Sesame.json"); con.add(url, url.toString(), RDFFormat.RDFXML); } finally { con.close(); } } catch (OpenRDFException e) { // handle exception } catch (IOException e) { // handle io exception } } } As being a beginner in Java Sesame, I have two questions, since I created the repository in openrdf-workbench, how can I execute the above code in Eclipse? My second question: is this the right way of adding an RDF statement into the repository? The file I am having is a JSON file as below: Sample_Sesame.json { "http://example.org/about" : { "http://purl.org/dc/elements/1.1/title": [ { "type" : "literal" , "value" : "Rich's Homepage" } ] } } Your assistance would be sincerely more than appreciated.
type: Question
score: 0
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/20770169
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20770229
accepted answer: http://stackoverflow.com/a/20770229
has title: Java Cloneable or copy constructor, why would I use any of those? What do either of those strategies actually do?
duplicate of: http://stackoverflow.com/q/869033
score: 0
has comment: http://stackoverflow.com/comment/31130777
has body: The question I have is pretty noob like so please excuse me for my ignorance as I am a noob. I came across code some consultants wrote in the company I work for. When I tried delving into the code, I had no idea why a class was implementing some interface called clonable. So I tried to google this clonable mess, and all I see is stuff like "don't use it" or "use copy constructor instead". I don't know what either of those things are. Could someone please elaborate the reasons for when this kind of cloning is actually needed? Why would I clone an object? I spoke to the ex-consultant and he mentioned this would allow us to chain methods apparently. Like questionSet.dosomething().doAnotherThing().dowth(); public class QuestionSet implements Cloneable { ... /* (non-Javadoc) * @see java.lang.Object#clone() */ @Override public QuestionSet clone() { return new QuestionSet(this); } ... }
tagged with: cloneable
tagged with: copy-constructor
answer count: 1
has comment: http://stackoverflow.com/comment/31138469
linked to: http://stackoverflow.com/q/869033
has comment: http://stackoverflow.com/comment/31321679
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31131153
tagged with: java
has comment: http://stackoverflow.com/comment/31131043
has comment: http://stackoverflow.com/comment/31320537
type: Question

http://stackoverflow.com/comment/31183908
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20800346
score: 0
has text: According to my requirement I can't use Triggers.Is there any other way to solve it.Thanks

http://stackoverflow.com/q/20770279
has answer: http://stackoverflow.com/a/20770867
accepted answer: http://stackoverflow.com/a/20770428
possible better answer: http://stackoverflow.com/a/20770370
has comment: http://stackoverflow.com/comment/31130820
score: -1
has comment: http://stackoverflow.com/comment/31130833
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/31130864
has comment: http://stackoverflow.com/comment/31130935
tagged with: string
has comment: http://stackoverflow.com/comment/31130853
has comment: http://stackoverflow.com/comment/31130790
has title: Replace a string with an image in java?
favorite count: 0
has comment: http://stackoverflow.com/comment/31130826
has answer: http://stackoverflow.com/a/20770428
tagged with: spring
has comment: http://stackoverflow.com/comment/31130916
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20770370
has body: Is there any way by which i can replace a text with an image? Can i tweak any of the string Util method in order to do so like replace, replaceAll or anything else? I tried a lot of things but could not do it. I know it is an idiotic kinds question but give it a go. String string = "This is an |IMAGE|"; ( string.contains("IMAGE") ? string.replace("|IMAGE|", *what to do here*) : string ); I want to replace the |IMAGE| with an image from my system. The output should look like this:
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31130870

http://stackoverflow.com/a/20822326
upvote count: 3
has body: Yes there is another and a better way! As you already have x and y coordinates of click, you can now check where these coordinates fall in the chess board grid and you can know exactly which box was clicked. As chessboards squares are rendered at specific coordinates by you, i guess so, you can perform an algorithm to compare x and y coordinates against those of square and you will have the position. If this don't help let me know with more specifics, I may be able to help you then.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20822274
score: 3

http://stackoverflow.com/q/20754432
type: Question
has body: Trying to use Powermock to mock out a static method on SystemTray. Not sure why this isn't working. I've checked the match of Powermock -> Mockito versions, and I think I've followed all the steps for adding the right annotations, and using the correct PowerMock methods to setup the static one. The static method on SystemTray seems to be called without the stubbed functionality set by the when(). I am mixing Powermock and Mockito calls here, but according to the docs that is correct. package CommissionChecker; import org.apache.commons.logging.Log; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.test.util.ReflectionTestUtils; import java.awt.*; import java.io.IOException; import java.util.List; import static org.mockito.Mockito.*; import static org.powermock.api.mockito.PowerMockito.mockStatic; @RunWith(PowerMockRunner.class) @PrepareForTest(SystemTray.class) public class DisplayManagerTest { @Mock Log logMock; @Mock Runner runnerMock; @Test public void display_manager_does_nothing_if_system_tray_is_not_supported() throws IOException, AWTException { mockStatic(SystemTray.class); when(SystemTray.isSupported()).thenReturn(false); new DisplayManager(runnerMock); verifyZeroInteractions(runnerMock); } } These are my maven dependencies <powermock.version>1.5.2</powermock.version> org.mockito mockito-all 1.9.5 test org.powermock powermock-module-junit4 ${powermock.version} test org.powermock powermock-api-mockito ${powermock.version} test
has title: Powermock + Mockito not working
has answer: http://stackoverflow.com/a/20761370
possible better answer: http://stackoverflow.com/a/27214479
score: 0
has answer: http://stackoverflow.com/a/27214479
answer count: 3
tagged with: mockito
tagged with: powermock
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28542785
tagged with: java
accepted answer: http://stackoverflow.com/a/20761370

http://stackoverflow.com/a/20771843
score: 1
has body: Try to increase heap size of JVM. -Xms&lt;size&gt; set initial Java heap size -Xmx&lt;size&gt; set maximum Java heap size -Xss&lt;size&gt; set java thread stack size For Ex. -Xms(minimum size) and -Xmx(maximum size) -Xms64m -Xmx256m
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20771701
downvote count: 0

http://stackoverflow.com/q/20760676
has answer: http://stackoverflow.com/a/20760825
has title: Call method with button on Android Action Bar
downvote count: 0
possible better answer: http://stackoverflow.com/a/20760816
tagged with: android-canvas
favorite count: 0
has answer: http://stackoverflow.com/a/20760816
has comment: http://stackoverflow.com/comment/31113293
tagged with: android
has comment: http://stackoverflow.com/comment/31113405
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20760825
has body: I have two classes at the moment, MainActivity and DrawView. The DrawView is working fine and creating a canvas that allows me to draw lines. What I have no idea how to do is when I click the button I've placed on the Action Bar it saves whatever is drawn on the canvas as an image. I don't know how to use the segment of code below from my MainActivity class. Do I need to create a new class with a method in it or can I create the method within the MainActivity class (in relation to the line "//method goes here")? I'm also assuming I have to retrieve the canvas object, from DrawView, and pass it to the method as a parameter. How do I do that when it's in the DrawView object? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); drawView = new DrawView(this); setContentView(drawView); drawView.requestFocus(); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_save: //method goes here return true; default: return super.onOptionsItemSelected(item); } }
upvote count: 1
type: Question
score: 1
tagged with: java
answer count: 2

http://stackoverflow.com/q/20803492
has comment: http://stackoverflow.com/comment/31189187
type: Question
has comment: http://stackoverflow.com/comment/97979320
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/6777554
has comment: http://stackoverflow.com/comment/31189258
has title: Cannot find symbol error in Test Class
type: UnansweredQuestion
has body: This is my student class. public class Student { private String name; private long id; private double gpa; private PersonalData pd; public Student(String name, long id, double gpa, PersonalData pd){ this.name= name; this.id=id; this.gpa= gpa; this.pd= pd; } public String getName(){ return name; } public long getID(){ return id; } public double getGPA(){ return gpa; } public PersonalData getPersonalData(){ return pd; } public String toString(){ String result= "Name: "+ name+ ", ID: "+ id+ ", GPA: "+gpa+", Personal Data: "+ pd; return result; } } Here is the test class: public class Test { public static void main(String[] args) { // TODO, add your application code PersonalData a= new PersonalData(80,4,1,1232154687); Student b= new Student(Ali,123,20,a); } } It gives this error: cannot find symbol Student b= new Student(Ali,123,20,a); ^ symbol: variable Ali location: class Test 1 error I don't know what is wrong. Is there anyone can see?
tagged with: java
has answer: http://stackoverflow.com/a/20803528

http://stackoverflow.com/a/20820112
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/20818489
has body: There's no easy way to accomplish this and I would question why you think it's required, however... While I'm sure there is probably an easy way to achieve this, most of the solutions I looked into required some kind of Graphics context and when I thought about variable width fonts, it quickly became a real mess... You could use something like... import java.awt.Component; import java.awt.EventQueue; import java.awt.Font; import java.awt.FontMetrics; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TextResize { public static void main(String[] args) { new TextResize(); } public TextResize() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } final JLabel label = new JLabel("Hello"); label.addComponentListener(new ComponentAdapter() { protected void decreaseFontSize(JLabel comp) { Font font = comp.getFont(); FontMetrics fm = comp.getFontMetrics(font); int width = comp.getWidth(); int height = comp.getHeight(); int textWidth = fm.stringWidth(comp.getText()); int textHeight = fm.getHeight(); int size = font.getSize(); while (size &gt; 0 &amp;&amp; (textHeight &gt; height || textWidth &gt; width)) { size -= 2; font = font.deriveFont(font.getStyle(), size); fm = comp.getFontMetrics(font); textWidth = fm.stringWidth(comp.getText()); textHeight = fm.getHeight(); } comp.setFont(font); } protected void increaseFontSize(JLabel comp) { Font font = comp.getFont(); FontMetrics fm = comp.getFontMetrics(font); int width = comp.getWidth(); int height = comp.getHeight(); int textWidth = fm.stringWidth(comp.getText()); int textHeight = fm.getHeight(); int size = font.getSi…
downvote count: 0
has comment: http://stackoverflow.com/comment/31222792
type: Answer
has comment: http://stackoverflow.com/comment/31223093

http://stackoverflow.com/a/20694968
has comment: http://stackoverflow.com/comment/50044133
score: 46
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/108634059
type: Answer
accepted answer of: http://stackoverflow.com/q/20694715
answers question: http://stackoverflow.com/q/20694715
has comment: http://stackoverflow.com/comment/35141474
has body: if (!project.hasProperty("build_version")) { ext.build_version = "1.0" }
upvote count: 46
has comment: http://stackoverflow.com/comment/35151721

http://stackoverflow.com/comment/31109731
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20758550
score: 1
has text: How can we tell without the surce code for Draw.java and ClassA.java? Stackoverflow is no riddle and puzzle site!

http://stackoverflow.com/comment/31256357
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20839052
has text: Thanks Tim. There are discussions like String literals are stored in JVM perm gen space and garbage collection is very rare in that area. Also in my scenario of using logger, what will be better String concatenation or String builder?

http://stackoverflow.com/comment/31098032
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20708624
has text: @JonathanWood I need my java code to read 11:30 and print out the format which is HH:MM.

http://stackoverflow.com/q/20763583
linked to: http://stackoverflow.com/q/18349517
duplicate of: http://stackoverflow.com/q/11461607
has answer: http://stackoverflow.com/a/20763946
accepted answer: http://stackoverflow.com/a/20763946
has comment: http://stackoverflow.com/comment/31118348
linked to: http://stackoverflow.com/q/11461607
has answer: http://stackoverflow.com/a/20763639
favorite count: 0
tagged with: android
has body: I looked at all the other places and I can't figure out how to do it. How do you type java -version into the console. Because all I get back is that java is not recognized as a command. I went on the java site and I got the version 1.7.0_45 so I did this C:\Program Files (x86)\Java\jdk1.7.0_45\bin\javaw.exe instead of C:\Program Files (x86)\Java\jre7\bin\javaw.exe it didn't work either "C:\Program Files (x86)\Java\jre7\bin\java.exe" -1.7.0_45 It also didn't work. I've downloaded the most recent android sdk of October 30th from the official site. Help? -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 -product com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256M -showsplash com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40 -Xmx768m -Declipse.buildId=v22.3.0-887826 -XX:MaxPermSize=512M
has title: Java was started but returned exit code=13 eclipse
duplicate of: http://stackoverflow.com/q/18349517
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 16
possible better answer: http://stackoverflow.com/a/20763639
tagged with: eclipse
type: Question
answer count: 2
upvote count: 16

http://stackoverflow.com/q/20811399
score: 0
answer count: 1
has title: Use a Scanner to return a String
has body: So, brand new to this site, but looks promising.. Anyways, to business, I'm working on this bit of code and I'm trying to return a string using a scanner. I've also tried using a BufferedReader, but it still returns null. public String scanFile(String lineStarter) throws IOException { Scanner sc = new Scanner(file); while (sc.hasNextLine()) { String[] lineInfo = sc.nextLine().toString().split("//|"); if(lineStarter.equalsIgnoreCase(lineInfo[0])){ return sc.toString(); } } //this is what keeps on returning return null; } The text file is formated like this: starwars|cool|Actor|general|google|low starw|cool|Actor|general|google|low hark|dude|this|I|don't|know So ya, it keeps on returning the last line that I don't want to return... I guess, if you really want it, I call the method while opening a new file I guess private void doubleClicked(java.awt.event.MouseEvent evt) { if(evt.getClickCount()==2){ try { String s = (String) jList1.getSelectedValue(); System.out.println(s); new DisplayMovie(scanFile(s)).setVisible(true); } catch (IOException ex) { System.out.println("An Error has occured"); } } } I hope I explained it well enouph, any suggestions will hopefully help
tagged with: netbeans
tagged with: java.util.scanner
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20811623
accepted answer: http://stackoverflow.com/a/20811623
tagged with: java
has comment: http://stackoverflow.com/comment/31204547
type: Question
tagged with: split
tagged with: string

http://stackoverflow.com/q/20807066
has title: How to validate XML against XSD 1.1 in Java?
has comment: http://stackoverflow.com/comment/31196423
tagged with: validation
has answer: http://stackoverflow.com/a/64548749
downvote count: 0
has comment: http://stackoverflow.com/comment/31196065
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/72730496
favorite count: 0
answer count: 5
has body: What is the best way to validate XML files against XML Schema 1.1 in Java? I took the code from this tutorial and changed the line where it looks up the factory to use XML Schema 1.1 as I have seen in this code example from the Xerces FAQ. This is my code: import java.io.File; import java.io.IOException; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.xml.sax.SAXException; public class XSDValidator { private static void validateFile(File xmlFile, File xsdFile) throws SAXException, IOException { // 1. Lookup a factory for the W3C XML Schema language SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1"); // SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // 2. Compile the schema. File schemaLocation = xsdFile; Schema schema = factory.newSchema(schemaLocation); // 3. Get a validator from the schema. Validator validator = schema.newValidator(); // 4. Parse the document you want to check. Source source = new StreamSource(xmlFile); // 5. Check the document try { validator.validate(source); System.out.println(xmlFile.getName() + " is valid."); } catch (SAXException ex) { System.out.println(xmlFile.getName() + " is not valid because "); System.out.println(ex.getMessage()); } } } The code throws this exception: java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://www.w3.org/XML/XMLSchema/v1.1 could be loaded As I see it I have exactly the same imports as the code snippet in the Xerces FAQ. I even tried to add Xerces to my Maven dependencies but that didn't help either. Cheers :)
has comment: http://stackoverflow.com/comment/31200387
tagged with: xsd
has answer: http://stackoverflow.com/a/20813131
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/31889170
has answer: http://stackoverflow.com/a/31889170
tagged with: java
type: Question
score: 20
upvote count: 20
has answer: http://stackoverflow.com/a/50023925
accepted answer: http://stackoverflow.com/a/20813131
tagged with: xsd-1.1
has comment: http://stackoverflow.com/comment/31195959

http://stackoverflow.com/comment/30971934
type: Comment
has text: I'm sorry but I haven't done anything so far. I'm just confused on how to go about it. One thing that I thought of was taring all the directories individually and then make a master tar having all the individual tar's of the dirs.
type: QuestionComment
comment on: http://stackoverflow.com/q/20682309
score: 0

http://stackoverflow.com/q/20695234
tagged with: java
score: 0
type: Question
has comment: http://stackoverflow.com/comment/30995455
has comment: http://stackoverflow.com/comment/30995503
has comment: http://stackoverflow.com/comment/30996100
has title: Best way to manipulate a conditional expression
has body: I have to manipulate an expression such as: (Order.number.contains("A12") || Order.customer_name.startsWith("ACME")) I need to get all elements such as Order.number, Order.customer_name and replace them with: this["Order.number"].contains or this["Order.customer_name"].startWith What is the best way to accomplish this in Java. John
has comment: http://stackoverflow.com/comment/30995429
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30995441
tagged with: regex
has comment: http://stackoverflow.com/comment/30996123
answer count: 0

http://stackoverflow.com/q/20755342
answer count: 2
accepted answer: http://stackoverflow.com/a/20781471
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20755416
has title: Big war file with Spring starter multi module project
possible better answer: http://stackoverflow.com/a/20755416
tagged with: spring
type: AnsweredQuestion
score: 2
tagged with: spring-boot
upvote count: 2
has body: I have a big project, consist of several small modules: core.jar: contains the entities & data jpa repositories, use spring-boot-starter-data-jpa api.jar: contains all the rest controller, depends on core.jar and use spring-boot-starter-web web.war: the entry point, contains the configuration and convert from executable jar to war by follow the guide: http://spring.io/guides/gs/convert-jar-to-war/ Everything works well, the only issue is the war file very big, about > 300MB at current code base (which is very small, just some controller, few entities). I do some investigation and found out that the core.jar & api.jar contains the dependencies, the web.war also again contains those dependencies includes his own dependencies. Do we have anyway to build the jar, war without dependencies and let them download the dependencies on first boot on the production machine? or the dependencies package separately, so in the incremental deployment, we do not need to re-upload the whole thing? Regards, Update 1: Q: Do I need core.jar & api.jar to be executable. A: No, I don't need it, but I also don't want to list down all the difference dependencies which is I can have by include spring-boot-starter-data-jpa or spring-boot-starter-web All my pom.xml My core.jar pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example.project module-core 0.0.1-SNAPSHOT module-core Demo project org.springframework.boot spring-boot-starter-parent 0.5.0.M6 org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-test test com.example.project.tuts.core.Application org.springframework.boot spring-boot-maven-plugin spring-snapshots Spring Snapshots http://repo.springsource.org/snapshot true spring-milestones Spring Milestones http://repo.springsource.org/milestone false spring-snapshots Spring Snapshots http://repo.springsource.org/snapshot true spring-milestones Spring Milestones http://repo.springsource.org/milestone false My api.jar pom.xml <?xml vers…
tagged with: java
has answer: http://stackoverflow.com/a/20781471
type: Question
has comment: http://stackoverflow.com/comment/31131059
has comment: http://stackoverflow.com/comment/31106905

http://stackoverflow.com/q/20794478
type: Question
type: AnsweredQuestion
favorite count: 0
has title: change locale in filter class in Spring MVC
score: 5
tagged with: spring
answer count: 1
has body: how to change locale in filter class in springMVC. in my filter class I'm using below code: LocaleContextHolder.setLocale(new Locale(lang)); I'm passing lang value is "ms". when I change locale from UI it is working fine. i want change in filter calss, it is not working. in my spring-servlet.xml below things i configured. <mvc:interceptors> locale </mvc:interceptors> Web.xml org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:/conf/context/spring-platform.xml classpath:/conf/context/spring-beans.xml classpath:/conf/context/spring-security.xml accessFilter org.springframework.web.filter.DelegatingFilterProxy accessFilter /* spring org.springframework.web.servlet.DispatcherServlet 1 spring *.do 30 jersy com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.api.json.POJOMappingFeature true 1 jersy /services/* http://www.springframework.org/tags /resources/tlds/spring.tld Noting is happening(Locale is not changing). No Exception in logs or console.
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/20794530
upvote count: 5
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/20794530

http://stackoverflow.com/comment/30991652
score: 0
type: Comment
type: QuestionComment
has text: LoanBook is required, Fiction and Non are also required to extend loan book, Main must pass in details to LoanBook. i have it coded in a different way without arrays but its broken also, just as bad.
comment on: http://stackoverflow.com/q/20692500

http://stackoverflow.com/q/20698386
favorite count: 0
upvote count: 1
tagged with: css
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20892732
score: 1
tagged with: java
tagged with: javafx
type: Question
has title: how to animate a text in javafx using css?
downvote count: 0
answer count: 1
has body: i'm styling my javafx scene with css, and now i want to animate a text in a button on mouse hover. when i was reading similar questions here they say that it's not possible to do animation in css, and suggested to do animation in logic layer(clear, right?). anyway while i was searching IDE's suggestions, codes like: animation-timing-function: ease-in; where allowed, so it is possible. my question is how to animate a text for example, using css. a sample code could be enough. I also read JavaFX CSS Reference Guide, but i got nothing.
accepted answer: http://stackoverflow.com/a/20892732

http://stackoverflow.com/q/20803960
possible better answer: http://stackoverflow.com/a/20804114
linked to: http://stackoverflow.com/q/16863657
has answer: http://stackoverflow.com/a/20804114
has title: Eclipse programs not running?
has answer: http://stackoverflow.com/a/20804603
has comment: http://stackoverflow.com/comment/31191175
has comment: http://stackoverflow.com/comment/31190289
has comment: http://stackoverflow.com/comment/31191390
has comment: http://stackoverflow.com/comment/31191119
has comment: http://stackoverflow.com/comment/31190406
has comment: http://stackoverflow.com/comment/31190227
has comment: http://stackoverflow.com/comment/31191161
upvote count: 1
has comment: http://stackoverflow.com/comment/31190788
has comment: http://stackoverflow.com/comment/31190185
accepted answer: http://stackoverflow.com/a/20804603
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31191059
tagged with: java
has comment: http://stackoverflow.com/comment/31191248
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31191190
answer count: 2
downvote count: 0
has body: I am new to java. I have just got Eclipse working (somehow) lol. well my programs are running fine until- I save a program, close out of eclipse, and re-open the program. when I try to run it the same way that works for all the other programs, I am getting a message asking to "run with ant build". for some reason eclipse will not run any of my programs that have been closed out and re-opened, but will run new programs just fine. does anyone know how to fix this??? thanks EDIT- i would post an image, but I do not have at least 10 reputation.. what is happening is I go to open file =&gt; C:\Documents and Settings\xxxxxx\workspace\t\src\t (t is the program's name) and then I open it, and run it. When I run it (either F11 or the run button) it pops up a window saying "select what to run as", and the only options are 2 ant build icons. Running as ant build does not work, because this isn't an antbuild file. I created a new program just to test, (from scratch) and everything compiles and runs fine... everything is compiling and running fine on NEW programs, but I just tried opening a program I created yesterday, and it is giving me the error mentioned above.. it was running perfectly fine yesterday. also, I have JDK installed at home, and I am getting this same exact problem.. JDK isn't the source. EDIT- i have 10 rep now. Here's an image of what was happening before the fix
has comment: http://stackoverflow.com/comment/31190996
favorite count: 0
has comment: http://stackoverflow.com/comment/31190175
has comment: http://stackoverflow.com/comment/31190260

http://stackoverflow.com/comment/52494639
type: Comment
comment on: http://stackoverflow.com/a/20816836
has text: glazaror: The Spring AOP [documentation](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html) then goes on to say: *A well written pointcut should try and include at least the first two types (**kinded** AND **scoping**), whilst the **contextual designators** may be included if wishing to match based on join point context, or bind that context for use in the advice. Supplying either JUST a **kinded designator** or JUST a **contextual designator** will work but could affect weaving performance (time and memory used) due to all the extra processing and analysis.*
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31093017
has text: Can you give us a bit better explanation. What do you mean _want to pass in a system property_? What property is that? The location of the jar that contains the task? There's not much else you can pass into `<taskdef>`.
comment on: http://stackoverflow.com/q/20748135
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31075533
type: Comment
has text: I'm not sure that I can because this is actually for a SharedPreference in Android.
comment on: http://stackoverflow.com/a/20739610
score: 0
type: AnswerComment

http://stackoverflow.com/a/20819310
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20819228
answers question: http://stackoverflow.com/q/20819228
has body: Well you are comparing different types, this will always be false. ".".equals(arrayPrice[k]) Instead you can use '.' == arrayPrice[k] But String class provide some utils method for doing that, for example String#indexOf(..) Returns the index within this string of the first occurrence of the specified character String price=Double.toString(Ad[i].Price()); price.indexOf('.');
type: Answer
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/comment/31065244
comment on: http://stackoverflow.com/q/20733741
score: 9
type: Comment
type: QuestionComment
has text: `java.util.Random` works just fine. Have you read the javadoc?

http://stackoverflow.com/q/20730337
has comment: http://stackoverflow.com/comment/41059757
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/44641274
has answer: http://stackoverflow.com/a/36928156
upvote count: 20
has comment: http://stackoverflow.com/comment/66495890
has answer: http://stackoverflow.com/a/78223751
has body: http://bluecove.org/ BlueCove is a Java library for Bluetooth, for MsWindows, Mac OSX and others. but it seems that it does not support Bluetooth Low Enegry 4.0. Android has a standard Java library for Bluetooth LE 4.0: http://developer.android.com/guide/topics/connectivity/bluetooth.html Is there a Java library for Bluetooth LE 4.0 for MsWindows and/or Mac OSX?
has comment: http://stackoverflow.com/comment/66497101
score: 20
downvote count: 0
has answer: http://stackoverflow.com/a/29923590
has comment: http://stackoverflow.com/comment/44373090
favorite count: 0
linked to: http://stackoverflow.com/q/8677204
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/61478008
has title: Java library for Bluetooth LE 4.0 for MsWindows and/or Mac OSX
tagged with: bluetooth-lowenergy

http://stackoverflow.com/a/20839419
accepted answer of: http://stackoverflow.com/q/20839236
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: As already indicated in the comments, you are not calling ResultSet.close(), but calling ResultSet.getStatement() followed by a Statement.close() instead. And that call to resSet.getStatement() is what throws the exception, as is required by the JDBC spec/api doc: Throws: SQLException - if a database access error occurs or this method is called on a closed result set (emphasis mine)
answers question: http://stackoverflow.com/q/20839236
upvote count: 3
score: 3

hibernate
tags question: http://stackoverflow.com/q/20719590
tags question: http://stackoverflow.com/q/20692260
tags question: http://stackoverflow.com/q/20706871
tags question: http://stackoverflow.com/q/20816000
tags question: http://stackoverflow.com/q/20813012
tags question: http://stackoverflow.com/q/20763568
tags question: http://stackoverflow.com/q/20836460
tags question: http://stackoverflow.com/q/20743150
tags question: http://stackoverflow.com/q/20772047
tags question: http://stackoverflow.com/q/20733021
tags question: http://stackoverflow.com/q/20714668
tags question: http://stackoverflow.com/q/20793375
tags question: http://stackoverflow.com/q/20838555
tags question: http://stackoverflow.com/q/20702714
tags question: http://stackoverflow.com/q/20796668
tags question: http://stackoverflow.com/q/20749070
tags question: http://stackoverflow.com/q/20804768
tags question: http://stackoverflow.com/q/20701505
tags question: http://stackoverflow.com/q/20793293
tags question: http://stackoverflow.com/q/20787038
tags question: http://stackoverflow.com/q/20785578
tags question: http://stackoverflow.com/q/20812767
tags question: http://stackoverflow.com/q/20803756
tags question: http://stackoverflow.com/q/20746174
tags question: http://stackoverflow.com/q/20700363
tags question: http://stackoverflow.com/q/20739150
tags question: http://stackoverflow.com/q/20815643
tags question: http://stackoverflow.com/q/20749806
tags question: http://stackoverflow.com/q/20715143
tags question: http://stackoverflow.com/q/20704023
tags question: http://stackoverflow.com/q/20710666
tags question: http://stackoverflow.com/q/20708693
tags question: http://stackoverflow.com/q/20792869
tags question: http://stackoverflow.com/q/20832271
tags question: http://stackoverflow.com/q/20759676
tags question: http://stackoverflow.com/q/20812125
tags question: http://stackoverflow.com/q/20819869
tags question: http://stackoverflow.com/q/20793775
tags question: http://stackoverflow.com/q/20834318
tag name: hibernate
tags question: http://stackoverflow.com/q/20809788
tags question: http://stackoverflow.com/q/20679925
tags question: http://stackoverflow.com/q/20805427
tags question: http://stackoverflow.com/q/20822976
tags question: http://stackoverflow.com/q/20849389
tags question: http://stackoverflow.com/q/20845553
tags question: http://stackoverflow.com/q/20798313
tags question: http://stackoverflow.com/q/20719260
tags question: http://stackoverflow.com/q/20791941
tags question: http://stackoverflow.com/q/20698792
tags question: http://stackoverflow.com/q/20838583
tags question: http://stackoverflow.com/q/20818737
tags question: http://stackoverflow.com/q/20725901
tags question: http://stackoverflow.com/q/20734758
tags question: http://stackoverflow.com/q/20799074
tags question: http://stackoverflow.com/q/20756389
tags question: http://stackoverflow.com/q/20687593
tags question: http://stackoverflow.com/q/20709872
tags question: http://stackoverflow.com/q/20720475
tags question: http://stackoverflow.com/q/20753647
tags question: http://stackoverflow.com/q/20698316
tags question: http://stackoverflow.com/q/20701247
tags question: http://stackoverflow.com/q/20760403
tags question: http://stackoverflow.com/q/20682567
tags question: http://stackoverflow.com/q/20772810
tags question: http://stackoverflow.com/q/20707485
tags question: http://stackoverflow.com/q/20756804
tags question: http://stackoverflow.com/q/20754466
tags question: http://stackoverflow.com/q/20769343
tags question: http://stackoverflow.com/q/20690549
tags question: http://stackoverflow.com/q/20821896
tags question: http://stackoverflow.com/q/20780408
tags question: http://stackoverflow.com/q/20754727
tags question: http://stackoverflow.com/q/20683188
tags question: http://stackoverflow.com/q/20796818
tags question: http://stackoverflow.com/q/20792988
tags question: http://stackoverflow.com/q/20748719
tags question: http://stackoverflow.com/q/20702951
tags question: http://stackoverflow.com/q/20686428
tags question: http://stackoverflow.com/q/20836652

http://stackoverflow.com/comment/31083182
has text: Its not full code..show client and server side full code
comment on: http://stackoverflow.com/q/20743872
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31122167
comment on: http://stackoverflow.com/a/20764260
type: AnswerComment
has text: My issue is when the program is exited and opened again. I have no problems when the user pauses the application and continues it. When the user closes the application, does something else then opens it again - the issue occurs. Now the textures are actually created again (I followed with the debugger) and pass through the right pieces of code - just that when it arrives to drawing them...
score: 0
type: Comment

http://stackoverflow.com/q/20826314
has title: Waiting for modal dialog to close before execution code in Java
tagged with: modal-dialog
answer count: 1
tagged with: jdialog
has comment: http://stackoverflow.com/comment/31231974
score: 0
has comment: http://stackoverflow.com/comment/31231827
has comment: http://stackoverflow.com/comment/31231897
has comment: http://stackoverflow.com/comment/31231761
tagged with: swing
has answer: http://stackoverflow.com/a/20826477
type: AnsweredQuestion
has body: I'm using Java, Swing in NetBeans and I have there main JFrame and some JDialog window. I click on a button and JDialog is created, but all code that is after opening this JDialog is instantly executed. But I want it to execute when the JDialog is closed (JDialog is modal and it blocks main frame but not its code). Example: private void buttonActionPerformed(java.awt.event.ActionEvent evt) { button.setText("Starting"); About.main(null); button.setText("Ending"); } And now: After clicking button it opens JDialog and text on the button is "ending". But I want: To click the button, it should has text "starting", then JDialog should appear and, but now, after it is closed the "ending" should be the caption. How to do it?
tagged with: java
accepted answer: http://stackoverflow.com/a/20826477
type: Question

http://stackoverflow.com/comment/43528024
has text: @mateen: can you elaborate on this initial context class?
comment on: http://stackoverflow.com/q/20786921
score: 0
type: QuestionComment
type: Comment

ruby
tags question: http://stackoverflow.com/q/20822111
tags question: http://stackoverflow.com/q/20725481
tag name: ruby
tags question: http://stackoverflow.com/q/20736804
tags question: http://stackoverflow.com/q/20696404
tags question: http://stackoverflow.com/q/20806316
tags question: http://stackoverflow.com/q/20820877
tags question: http://stackoverflow.com/q/20725726
tags question: http://stackoverflow.com/q/20819258
type: Tag
tags question: http://stackoverflow.com/q/20747103
tags question: http://stackoverflow.com/q/20685190

http://stackoverflow.com/q/20829473
type: Question
answer count: 2
has body: In a class called database; there are three String ArrayLists named firstName, surname and gender. The elements in the ArrayLists are parallel. For example surname(1) would be the surname of firstName(1). I would like to know how to display these ArrayLists in a JTable. All ArrayLists being shown in different columns.
upvote count: 0
tagged with: arrays
tagged with: arraylist
tagged with: jtable
has answer: http://stackoverflow.com/a/20829977
has answer: http://stackoverflow.com/a/20829601
favorite count: 0
score: -1
type: UnansweredQuestion
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/31238019
has title: Creating a JTable from multiple Array lists
tagged with: java

http://stackoverflow.com/comment/71216408
type: AnswerComment
type: Comment
has text: Unfortunately, I do not have the reputation to comment yet. But you could delte this post and add it as a comment.
comment on: http://stackoverflow.com/a/42016724
score: 0

http://stackoverflow.com/comment/31103913
has text: once check this http://developer.android.com/guide/topics/media/camera.html you will get clear idea..
comment on: http://stackoverflow.com/q/20755024
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/30988208
has text: huh? Thread.interrupted does nothing it checks a status. You actually have to interrupt the instances.
comment on: http://stackoverflow.com/q/20691216
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/86859699
has text: @Fabian does this mean that GridPane.getMargin(node) will always return null when the node is the first row in the grid pane?
comment on: http://stackoverflow.com/a/20828724
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20785844
has comment: http://stackoverflow.com/comment/31227232
has comment: http://stackoverflow.com/comment/31305215
score: 3
has body: Instructions for importing a new Play Java project into Eclipse, tested with Play Framework 2.2.1 and Eclipse Standard 4.3.1: Download and install Eclipse. Create a new Play project. When asked, select the Java language: $ play new myapp Change to the new application's directory: $ cd myapp Generate the Eclipse project: Without including library source code: $ play eclipse Including library source code (may take a long time for downloads and a few sources might be missing): $ play "eclipse with-source=true" Import the project into your Eclipse Workspace with File | Import | General | Existing Projects into Workspace. Result: For more information see Setting up your preferred IDE.
has comment: http://stackoverflow.com/comment/31306258
has comment: http://stackoverflow.com/comment/31319066
has comment: http://stackoverflow.com/comment/31305227
answers question: http://stackoverflow.com/q/20780568
downvote count: 0
has comment: http://stackoverflow.com/comment/31262345
has comment: http://stackoverflow.com/comment/31259671
has comment: http://stackoverflow.com/comment/34663935
type: Answer
has comment: http://stackoverflow.com/comment/60064232
has comment: http://stackoverflow.com/comment/34695737
has comment: http://stackoverflow.com/comment/31261126
upvote count: 3

http://stackoverflow.com/comment/31164490
comment on: http://stackoverflow.com/q/20789546
type: Comment
has text: have you made sure that ClassPath Env variables are in sync in production or check if there is anything that is overriding Classpath environment variable.
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31238076
has text: @nachokk at least you make the effort to comment ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20829088
type: Comment

http://stackoverflow.com/a/20799673
has body: There's no difference between the two cases. In both cases you are assigning a new value to the String variable. I know what optimization you have in mind. That kind of optimization is routinely done by compilers these days. But again, it doesn't apply in your case anyway.
downvote count: 0
answers question: http://stackoverflow.com/q/20799629
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/a/20768208
type: Answer
accepted answer of: http://stackoverflow.com/q/20768138
has body: Well, this is where encapsulation goes in. Suppose you have your deck in an array list: ArrayList&lt;Card&gt; deck = new ArrayList&lt;&gt;(); Now when you add or remove cards to/from your deck, you propabbly just call add and remove functions of the list. There is a better idea: create two functions addCard and removeCard, these will be the only way to manipulate with cards in deck (and shuffle, etc), and resolve recomputing of deck value only in functions that affect count of cards. You could also want create a separate class Deck and make field deck private, so you can 100% guarantee that everyone (= you if you program alone) uses only the safe functions addCard, ... and doesnt call list's functions directly. How it could look like: class Deck { private ArrayList&lt;Card&gt; deck = new ArrayList&lt;&gt;(); //only this class can see and work with this field ... //everyone can see and call this method public void addCard(Card newCard) { deck.add(newCard); gui.updateDeckValue(); //or something like that } }
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/31127315
has comment: http://stackoverflow.com/comment/31238719
has comment: http://stackoverflow.com/comment/31127340
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31127403
has comment: http://stackoverflow.com/comment/31127342
answers question: http://stackoverflow.com/q/20768138

http://stackoverflow.com/comment/33902942
has text: Hi there, I'm doing a filecopy from my device to a remote server using SCP, your code are helping me up, did you solved your problem? Thx
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20721462

http://stackoverflow.com/q/20742890
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20743062
type: UnansweredQuestion
upvote count: 1
tagged with: swing
score: 1
tagged with: java
has body: I'm getting java.awt.IllegalComponentStateException at line 103 i.e. guiFrame.setLocationByPlatform(true) Any ideas as to how to resolve it? During instance creation I'm enclosing it in SwingUtilities.invokeLater method but still it's popping up. Code is pasted below : import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Frame; import javax.swing.BorderFactory; import javax.swing.border.Border; import javax.swing.Box; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.SwingUtilities; import chrriis.common.UIUtils; import chrriis.dj.nativeswing.swtimpl.NativeInterface; import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class CardLayoutExample { JFrame guiFrame = new JFrame(); CardLayout cards = new CardLayout(); JPanel cardPanel = new JPanel(); JPanel firstPanel = new JPanel(); private JPanel tabsPanel = new JPanel(); static boolean isYoutube = false; static boolean isGmail = false; private ImageIcon animatedGif; private static final String FIRST_PANEL = "First Panel"; /* * public static void main(String[] args) { * * // EventQueue.invokeLater(new Runnable() { * * @Override public void run() { * * new CardLayoutExample(); } }); * * } */ public CardLayoutExample() { guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setTitle("Services"); guiFrame.setSize(400, 300); guiFrame.setLocationRelativeTo(null); guiFrame.setLayout(new BorderLayout()); guiFrame.setExtendedState(Frame.MAXIMIZED_BOTH); Border outline = BorderFactory.createLineBorder(Color.black); tabsPanel.setBorder(outline); tabsPanel.setLayout(cards); JLabel services = new JLabel("Please choose from the services below :-"); JButton youtube = new JButton(); youtube.setName("youtube"); ImageIcon youtubeI…
has title: java.awt.IllegalComponentStateException
type: Question
tagged with: illegalstateexception

http://stackoverflow.com/q/20832814
has comment: http://stackoverflow.com/comment/31244553
has title: Java convert ArrayList<String[]> to String[][]
accepted answer: http://stackoverflow.com/a/20832839
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 1
type: Question
tagged with: arraylist
has answer: http://stackoverflow.com/a/20832839
has answer: http://stackoverflow.com/a/20832855
answer count: 2
tagged with: arrays
has body: Do I have to loop through each element to convert ArrayList&lt;String[]&gt; to String[][] or is there a more efficient way?
possible better answer: http://stackoverflow.com/a/20832855
favorite count: 0

http://stackoverflow.com/comment/31266387
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20844472
type: Comment
has text: Have a look at http://en.wikibooks.org/wiki/Java_Persistence/Persisting#Refresh and http://en.wikibooks.org/wiki/Java_Persistence/Caching#JPA_2.0_Cache_APIs

http://stackoverflow.com/q/20702013
possible better answer: http://stackoverflow.com/a/20702242
has title: How to add Double-click capability in JScrollPane?
has answer: http://stackoverflow.com/a/20702242
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/20737557
tagged with: mouselistener
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20702390
accepted answer: http://stackoverflow.com/a/20737557
has answer: http://stackoverflow.com/a/20707896
type: Question
has body: I am using JScrollPane and populating it through Model..Now I want to add Double CLick Listener Here how I am trying... PlayListScrollPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseEvent) { JList theList = (JList) mouseEvent.getSource(); if (mouseEvent.getClickCount() == 2) { int index = theList.locationToIndex(mouseEvent.getPoint()); if (index &gt;= 0) { Object o = theList.getModel().getElementAt(index); System.out.println("Double-clicked on: " + o.toString()); } } } }); PlayListScrollPane is JScrollPane... The above method never fires up... THanks.
tagged with: jscrollpane
downvote count: 0
tagged with: double-click

http://stackoverflow.com/q/20716757
has body: I am trying to insert or update data in database using stored procedure in My batis but query was run succesfully but data is not inserted in DB. can u please help me out. below is the calling stored procedure in mapper.xml: &lt;select id="saveExaminations" resultMap="examinationForm"&gt; {call SaveExaminationForms(12,31,null, 1, 100.00,0,0, 1, 0, 1, 1, 1, 1, 1, 1000001,0,1,123456,0,1,BCA,0000000003,2011, fraud,allahabad,null,Hindi,1,2,1,8)} &lt;/select&gt; below is the resultmap in mapper.xml &lt;resultMap id="examinationForm" type="ExaminationForm"&gt; &lt;result property="id" column="EXAMINATIONFORM_ID"/&gt; &lt;result property="studentId" column="EXAMINATIONFORM_STUDENTID"/&gt; &lt;result property="examinationId" column="EXAMINATIONFORM_EXAMINATIONID"/&gt; &lt;result property="isSubmitted" column="EXAMINATIONFORM_ISSUBMITTED"/&gt; &lt;result property="feeAmount" column="EXAMINATIONFORM_FEEAMOUNT"/&gt; &lt;result property="paymentTypeId" column="EXAMINATIONFORM_PAYMENTTYPEID"/&gt; &lt;result property="bankId" column="EXAMINATIONFORM_BANKID"/&gt; &lt;result property="isClass10CertAttached" column="EXAMINATIONFORM_ISCLASS10CERTATTACHED"/&gt; &lt;result property="isClass12CertAttached" column="EXAMINATIONFORM_ISCLASS12CERTATTACHED"/&gt; &lt;result property="isUGCertAttached" column="EXAMINATIONFORM_ISUGCERTATTACHED"/&gt; &lt;result property="isPGCertAttached" column="EXAMINATIONFORM_ISPGCERTATTACHED"/&gt; &lt;result property="isReservationCategoryCertAttached" column="EXAMINATIONFORM_ISRESERVATIONCATEGORYCERTATTACHED"/&gt; &lt;result property="isDomicileCertAttached" column="EXAMINATIONFORM_ISDOMICILECERTATTACHED"/&gt; &lt;result property="isMigrationCertAttached" column="EXAMINATIONFORM_ISMIGRATIONCERTATTACHED"/&gt; &lt;result property="MigrationCertificateNo" column="EXAMINATIONFORM_MIGRATIONCERTIFICATENO"/&gt; &lt;result property="isBankChallanAttached" column="EXAMINATIONFORM_ISBANKCHALLANATTACHED"/&gt; &lt;result property="isEmployerNOCAttached" column="EXAMINA…
type: Question
has comment: http://stackoverflow.com/comment/31035371
has comment: http://stackoverflow.com/comment/31039191
answer count: 1
tagged with: stored-procedures
has comment: http://stackoverflow.com/comment/31034502
tagged with: java
score: 0
has title: Data is not inserted in Database using stored procedure in MyBatis
has answer: http://stackoverflow.com/a/20828215
tagged with: database
tagged with: mybatis
type: UnansweredQuestion

http://stackoverflow.com/a/20773594
has body: The index of the last element is listaprac.size() - 1 not listaprac.size().
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31136298
answers question: http://stackoverflow.com/q/20773503

http://stackoverflow.com/comment/31221131
has text: Thanks for comments. i have found the problem. i needed to include the PDFOne.jar in my classpath. But know i am getting a new error : [access denied ("java.io.FilePermission" "sibdownload.pdf" "read")] any work arroud on this error ?
score: 0
comment on: http://stackoverflow.com/q/20820343
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31272267
type: QuestionComment
has text: The only correct way to resolve the problem is to eliminate the use of internal APIs. Not only can they change between versions, but simply trying to run on a different VM might cause classloader errors.
score: 1
comment on: http://stackoverflow.com/q/20847787
type: Comment

http://stackoverflow.com/comment/31166311
comment on: http://stackoverflow.com/q/20789797
score: 0
has text: When you invoke gpg, it typically shows you a menu with a choice of key type. Choose that type with "signing" word in it.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20828251
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20827724
has comment: http://stackoverflow.com/comment/31236160
has comment: http://stackoverflow.com/comment/31259511
upvote count: 2
has body: You can simply define a callback Interface which your MainActivity implements. Just pass the MainActivity instance to the Fragment either as constructor parameter or some other defined method which takes as argument the Interface type. Then inside your Fragment call the implemented method when you need to slide to another page. This way you dont have to get the reference of the ViewPager inside the Fragment. You can also do this: public class MyFragment extends Fragment{ private ArrayList&lt;ChangePageListener&gt; listeners = new ArrayList&lt;ChangePageListener&gt;(); public addChangePageListener(ChangePageListener listener){ if(!listeners.contains(listener){ listeners.add(listener); } } public removeChangePageListener(ChangePageListener listener){ if(listeners.contains(listener){ listeners.remove(listener); } } private void changePage(int position) { for(ChangePageListener listener: listeners){ listener.changePage(position); } } } public interface ChangePageListener{ public void changePage(int position); } public MainActivity extends Activity implements ChangePageListener{ public void changePage(int position){ this.pager.setCurrentItem(position); } }
has comment: http://stackoverflow.com/comment/31239947
has comment: http://stackoverflow.com/comment/31257594
type: Answer

http://stackoverflow.com/comment/31083684
has text: Actually If he wants 3 values, enough to use `\t`
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20744168

http://stackoverflow.com/comment/31150771
has text: what are the other jars that you are referencing in the project
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20781776

http://stackoverflow.com/comment/31138584
comment on: http://stackoverflow.com/q/20774880
type: Comment
type: QuestionComment
has text: @Raghunandan I remember you. You helped a LOT last time. I think I have fixed the issue. Thanks :)
score: 0

http://stackoverflow.com/a/20840510
type: AcceptedAnswer
downvote count: 0
has body: You could use an annotation Processor. For example, the annotation and its processor would be placed in its own .jar file and added as a dependency of the sources that use the annotation. The custom .jar would have the following structure: src/main/ java/com/company/annotations/ RequiredStore.java RequiredStoreProcessor.java resources/META-INF/services javax.annotation.processing.Processor RequiredStore.java stays as you have it above. RequiredStoreProcessor.java could look something like this: package com.company.annotations; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; @SupportedAnnotationTypes("com.company.annotations.RequiredStore") public class RequiredStoreProcessor extends AbstractProcessor { @Override public boolean process( Set&lt;? extends TypeElement&gt; annotations, RoundEnvironment roundEnv) { for (Element element : roundEnv.getElementsAnnotatedWith(RequiredStore.class)) { if (element.getKind().equals(ElementKind.METHOD)) { processingEnv.getMessager().printMessage( Diagnostic.Kind.WARNING, "Using @RequiredStore on methods has been deprecated\n" + "Class: " + element.getEnclosingElement() + "\n" + "Method: " + element.getSimpleName() + "\n"); } } // Other processing... return false; } @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } } The javax.annotation.processing.Processor file allows javac to pickup the Processor via SPI and simply contains com.company.annotations.RequiredStoreProcessor Finally, compile this into a .jar and add it to the classpath where the annotations are being used. Any methods that have the @RequiredStore will produce a compiler warning. For examp…
answers question: http://stackoverflow.com/q/20840260
type: Answer
accepted answer of: http://stackoverflow.com/q/20840260
has comment: http://stackoverflow.com/comment/31258126
has comment: http://stackoverflow.com/comment/31258337
has comment: http://stackoverflow.com/comment/31258058
upvote count: 5
score: 5

double-click
tags question: http://stackoverflow.com/q/20702013
tag name: double-click
type: Tag
tags question: http://stackoverflow.com/q/20751493

http://stackoverflow.com/q/20774681
has title: Getting user's daily route in Android?
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/20817143
tagged with: locationmanager
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has body: I need to get the route a user goes through every day. I thought of checking the user's location every few minutes for 2-3 days and then analyze the information and get the origin and destination the user's going from and to every day. The question is how will it affect battery life and is there a better way to do it. Are there any Android services that save the user's location history that I can access for this information?
type: Question
accepted answer: http://stackoverflow.com/a/20817143
tagged with: android
tagged with: geolocation
upvote count: 1

http://stackoverflow.com/comment/31153959
type: QuestionComment
comment on: http://stackoverflow.com/q/20783789
score: 0
has text: plz update your full code.
type: Comment

http://stackoverflow.com/a/20762408
has body: A couple of things are going wrong: tag: '['TAG_TYPE "TAG_VALUE"']'; Why are there double quotes around TAG_VALUE? Remove the quotes if you want to match the token TAG_VALUE: tag: '['TAG_TYPE TAG_VALUE ']'; MOVE_NUMBER\. MOVE_DESC MOVE_DESC If you want to match the literal . (DOT) you need to put quotes around it (and not escape it!): MOVE_NUMBER '.' MOVE_DESC MOVE_DESC NEWLINE: \r? \n; Again, if you want to match the literals, put quotes around it: NEWLINE: '\r'? '\n'; TAG_VALUE: .*; ... MOVE_DESC: .*; Those rule will gobble up your entire input stream. You need another way to match a tag value and move description than you do now. Do not use .*. EDIT Here’s an existing PGN grammar: https://github.com/antlr/grammars-v4/tree/master/pgn
has comment: http://stackoverflow.com/comment/31116242
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20762216
score: 1
answers question: http://stackoverflow.com/q/20762216
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/31116332
downvote count: 1

http://stackoverflow.com/comment/31078656
type: QuestionComment
comment on: http://stackoverflow.com/q/20741189
score: 0
has text: For instance: Please provide a number: 12111 Number must be 4 digits long. Please provide the number again: alan
type: Comment

http://stackoverflow.com/q/20738984
upvote count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/20739037
has answer: http://stackoverflow.com/a/20739153
favorite count: 0
has answer: http://stackoverflow.com/a/20739027
answer count: 5
has comment: http://stackoverflow.com/comment/31074786
tagged with: android
has answer: http://stackoverflow.com/a/20739728
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31074577
has comment: http://stackoverflow.com/comment/31074567
tagged with: java
has answer: http://stackoverflow.com/a/30124311
possible better answer: http://stackoverflow.com/a/20739153
type: Question
has comment: http://stackoverflow.com/comment/31074559
has body: I am new to android and I am trying to create a game. It is a very simple Guess the number game.I want to change the value of the correct answer if he user guesses correctly. I am unsure how to do this. his is my code for on create: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button subm = (Button) findViewById(R.id.button1); final TextView tv1 =(TextView) findViewById(R.id.textView1); final EditText userG=(EditText)findViewById(R.id.editText1); Random rand=new Random(); final int correctAnswer=rand.nextInt(100)+1; subm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub int userNum=Integer.parseInt(userG.getText().toString()); if(userNum&gt;100 || userNum&lt;0){ tv1.setText("Enter a number between 1 and 100"); } else{ if(userNum==correctAnswer){ tv1.setText("YEAH! You got it right"); } else if(userNum&gt;correctAnswer){ tv1.setText("Sorry,Your guess is too high"); } else if(userNum&lt;correctAnswer){ tv1.setText("Sorry,Your guess is too low"); }} } }); } How do I change correctAnswer? I am forced to call it final and can't change the value.
accepted answer: http://stackoverflow.com/a/20739027
has title: Can i change value of final int

http://stackoverflow.com/comment/31009558
score: 0
type: Comment
type: QuestionComment
has text: 's' is a constant, you can't make it point to some other object. Right?
comment on: http://stackoverflow.com/q/20703628

http://stackoverflow.com/comment/31016593
has text: Here is a question with the same problem: http://stackoverflow.com/questions/11336157/running-external-program-with-redirected-stdin-and-stdout-from-java
comment on: http://stackoverflow.com/a/20707313
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20744691
answer count: 2
upvote count: 0
has body: I have to parse the SQL DDL queries to validate the SQL using Java. I tried and found some of the tools like jsql, ZSql. I downloaded ZSQL tool but struck with configuring. Is there any other easy way to parse the DDL command SQL file ? ZSQL or JSQL parsing means let me know the steps to configure in Windows XP.
has title: SQL parsing in Java
has comment: http://stackoverflow.com/comment/31085100
tagged with: sql
favorite count: 0
has comment: http://stackoverflow.com/comment/31084597
has answer: http://stackoverflow.com/a/20744831
type: UnansweredQuestion
downvote count: 1
tagged with: java
linked to: http://stackoverflow.com/q/141499
score: -1
type: Question
has answer: http://stackoverflow.com/a/20744830

http://stackoverflow.com/q/20789699
tagged with: colors
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31203131
has body: I'v been making a game in java from scratch and have recently come to an issue when trying to color black and white BuffereImages. I want to keep the darkness of the pixels (if that makes any sense). For example, the grass in Minecraft is a gray image, but when seen in game it comes in different shades of green, but keeps its value. I don't have any code to show because I don't know where to start. All I have is a couple BufferedImages that I want to color. Thanks.
has comment: http://stackoverflow.com/comment/31165892
linked to: http://stackoverflow.com/q/221830
tagged with: java
has comment: http://stackoverflow.com/comment/31165142
has comment: http://stackoverflow.com/comment/31164757
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/20789924
type: Question
has comment: http://stackoverflow.com/comment/31164878
has comment: http://stackoverflow.com/comment/31186903
linked to: http://stackoverflow.com/q/2123841
score: 0
has comment: http://stackoverflow.com/comment/31166952
answer count: 1
linked to: http://stackoverflow.com/q/3527811
has comment: http://stackoverflow.com/comment/31164950
has title: Making black & white buffered images colored in java

http://stackoverflow.com/a/25589068
answers question: http://stackoverflow.com/q/20771701
has body: I got this error in Amazon AWS ubuntu server - Tomcat 7 I solved the issue by first locating my tomcat catalina.sh file and updating the following line: locate catalina.sh /usr/share/tomcat7/bin/catalina.sh sudo vi /usr/share/tomcat7/bin/catalina.sh add the following line after the top comments: CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=256m"
score: 0
type: Answer

http://stackoverflow.com/comment/31284438
comment on: http://stackoverflow.com/q/20847679
has text: just i need to decompose this code to methods, and each method will be called by a button from the interface... the button are :create key, encrypt button, decrypt button... the create key button call the first method keycreation(), and the second.. etc
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20777879
score: 0
has body: different hashcodes leads to not equal objects ==> it says "leads" not says "always". Two equal objects always return the same hash code but two non equal objects very hardly return the same hash code if the hashcode method is not overridden.
type: Answer
answers question: http://stackoverflow.com/q/20777821

http://stackoverflow.com/q/20735289
favorite count: 0
tagged with: rest
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: I am writing a RESTful web service API. I am going to post an Answer resource to a mechanical question. When I do this I want to know if I answered correct or not. For this I have a Result resource. Is it wrong to return a different resource that the one you POSTed in a HTTP request? Example: POST /mechanical-questions/4/answers - shoud return result. The answer will be saved on the server, but so will the result. Should I return a HttpStatus 20x code together with a Location header indicating where I can find the quiz result or the answer, and what should the response entity be? The created answer or the quiz result?
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20735371
answer count: 2
has title: Can I return a different resource from a POST request?
possible better answer: http://stackoverflow.com/a/20735362
downvote count: 0
accepted answer: http://stackoverflow.com/a/20735371
has answer: http://stackoverflow.com/a/20735362

http://stackoverflow.com/a/20709907
has comment: http://stackoverflow.com/comment/31022618
downvote count: 1
answers question: http://stackoverflow.com/q/20709720
score: 9
has comment: http://stackoverflow.com/comment/31022644
has comment: http://stackoverflow.com/comment/31023001
upvote count: 10
has body: So what you are asking is correct assumption. You do not need to make it thread safe if you can guarantee that it is only used this way. You can't pass a half constructed object around in java, so the "Constructor might not be finished" is not possible. So if you do new Thread(new Runnable() { public void run() { final MyClass instance = new MyClass(10); new Thread(new Runnable() { public void run() { instance.put("one", "one"); .... } }).start(); } }).start(); You are fine :) This is what you described, created by Thread1 but only used by Thread2. There is no way for the thread to collide with itself. Thread-Safe is a different definition where the composed entity may safely be interacted with by multiple threads. In the case you described, that scenario does not happen, since you essentially have a thread that constructs and another that manipulates.
has comment: http://stackoverflow.com/comment/31022679
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31022767
has comment: http://stackoverflow.com/comment/31022719
has comment: http://stackoverflow.com/comment/31022883
has comment: http://stackoverflow.com/comment/31022961
has comment: http://stackoverflow.com/comment/31022668
type: Answer
has comment: http://stackoverflow.com/comment/31022921
has comment: http://stackoverflow.com/comment/31022605
has comment: http://stackoverflow.com/comment/31022544
accepted answer of: http://stackoverflow.com/q/20709720
has comment: http://stackoverflow.com/comment/31022970

http://stackoverflow.com/comment/31564608
comment on: http://stackoverflow.com/a/20921857
has text: Thanks you! :) After your post I find this: http://presos.dsyer.com/decks/spring-boot-intro.html#slide50
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/31155102
type: QuestionComment
comment on: http://stackoverflow.com/q/20784495
has text: Hashmaps ? Also try adding your solution/approach to the question.
score: 0
type: Comment

http://stackoverflow.com/comment/31104382
type: Comment
score: 0
type: AnswerComment
has text: @EJP :- So what is the solution if he wants to retrieve the result set data even after committing and indirectly closing the transaction?? what you are saying we already know that, be a part of solution not a part of problem
comment on: http://stackoverflow.com/a/20740236

http://stackoverflow.com/comment/51128594
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22896612
has text: Praneeth, add these jars to your project: "legacy-charts", "jfreechart" and "jcommon". Be sure to match the same version of PRD and Reporting Engine. You can find these jars in the lib folder of you Report Designer path. Don't forget, match the same version (for example, PRD 5.1.0 and Reporting Engine 5.1.0) [link](http://forums.pentaho.com/showthread.php?152813-Pentaho-does-display-chart-in-an-web-application)
type: AnswerComment

http://stackoverflow.com/a/20849261
has comment: http://stackoverflow.com/comment/31279192
has comment: http://stackoverflow.com/comment/31290860
upvote count: 2
answers question: http://stackoverflow.com/q/20849177
has body: Here's my take: 3 tier architecture application Any Java EE or Spring based app will satisfy this. Spring will force you to layer your application well. Need rich UI functionality such as dynamic tables, charts, file export from tables etc.. You're more likely to get these using UI form elements from jQuery, d3 and other JavaScript based libraries. Framework won't restrict your choices there. Use existing database tables to view, edit and save data JDBC or anything built on top of it (JPA, Hibernate, etc.) will make this possible. Flexible design to change, edit, or add new pages and business logic No framework will make this easy. You'll have to get a shovel and do the work regardless. Support business rules You can express business rules in many ways: code, state machines, Rete rules engines. Which one do you want? Flexibility to add expose some of the business services as web services You can do this regardless of framework choice. Spring has nice contract first, xsd-based web service remoting. Support crud operations on large database tables Large is immaterial. JDBC allows CRUD. Support https using oid and ldap I don't see what HTTPS has to do with LDAP. Your questions don't suggest a senior Java guy to me. I would not recommend either Struts or JSF. Both are 90s technology that aren't suited for mobile platforms. The world is moving towards HTML5, CSS3, JavaScript. I'd suggest that you do so, too. If you want to use Spring I'd stick with their web MVC. It's superior to both Struts and JSF, and you get all the other good stuff that Spring offers (e.g. DI and AOP). Personally I think the fixation on Oracle ADF is too strong. It ties you in just as much as Oracle Forms once did. I'd think about this in terms of web services, REST or SOAP, and flexible UIs. Decouple the front and back ends completely. UIs come and go, but a good service model for your business processes, at the right level of granularity, will stand up for a while.
has comment: http://stackoverflow.com/comment/31279204
downvote count: 1
type: Answer
score: 1

http://stackoverflow.com/a/21193144
score: 2
downvote count: 0
has body: I've never used it, but does http://www.jsonschema2pojo.org/ help? It seems you can even use it from within Java.
answers question: http://stackoverflow.com/q/20837705
upvote count: 2
has comment: http://stackoverflow.com/comment/32164502
type: Answer
has comment: http://stackoverflow.com/comment/31987206
has comment: http://stackoverflow.com/comment/31978496

http://stackoverflow.com/comment/32394625
has text: @HarishKoona Unfortunately, not yet. Do you have a concept? I might start a bouty some time in the future but I don't have that much reputation for now.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20719695

http://stackoverflow.com/comment/31124340
has text: @MiteshPathak what's basic to you may not be basic to someone else. One could argue any question regarding anything about syntax would be "basic" stuff since it's all (ideally) documented anyways.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20757020

http://stackoverflow.com/comment/105230392
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20713829
score: 1
has text: For anyone looking for the webinar @vikingsteve mentioned, I think it's this one, five minutes in: https://blog.jetbrains.com/blog/2013/08/02/webinar-recording-how-to-build-developer-tools-on-top-of-intellij-platform/

http://stackoverflow.com/q/20775565
has comment: http://stackoverflow.com/comment/31139776
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31139739
has comment: http://stackoverflow.com/comment/31139835
tagged with: android
score: -1
answer count: 3
downvote count: 1
tagged with: java
type: UnansweredQuestion
has body: i have been looking for the error so much but i can't find whats wrong the keep the app to stop and crashes whenever i open it, i have looked for each error and tried to correct it but still i can't figure it out, i hope you can help me? this is my logcat 12-25 03:33:42.214: E/AndroidRuntime(1559): FATAL EXCEPTION: main 12-25 03:33:42.214: E/AndroidRuntime(1559): Process: imamalsajadsayings.android.com, PID: 1559 12-25 03:33:42.214: E/AndroidRuntime(1559): java.lang.RuntimeException: Unable to start activity ComponentInfo{imamalsajadsayings.android.com/imamalsajadsayings.android.com.MainActivity}: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.LinearLayout 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.app.ActivityThread.access$800(ActivityThread.java:135) 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.os.Handler.dispatchMessage(Handler.java:102) 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.os.Looper.loop(Looper.java:136) 12-25 03:33:42.214: E/AndroidRuntime(1559): at android.app.ActivityThread.main(ActivityThread.java:5017) 12-25 03:33:42.214: E/AndroidRuntime(1559): at java.lang.reflect.Method.invokeNative(Native Method) 12-25 03:33:42.214: E/AndroidRuntime(1559): at java.lang.reflect.Method.invoke(Method.java:515) 12-25 03:33:42.214: E/AndroidRuntime(1559): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 12-25 03:33:42.214: E/AndroidRuntime(1559): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 12-25 03:33:42.214: E/AndroidRuntime(1559): at dalvik.system.NativeStart.main(Native Method) 12-25 03:3…
has answer: http://stackoverflow.com/a/20775601
has comment: http://stackoverflow.com/comment/31139788
has title: App has stopped working with no error specified
has answer: http://stackoverflow.com/a/20775636
has answer: http://stackoverflow.com/a/20775612
upvote count: 0

http://stackoverflow.com/comment/31271354
type: Comment
score: 2
comment on: http://stackoverflow.com/q/20847436
has text: ArrayList has method addAll from Collection use this method instead of for loop.(this.neighbours.addAll(neighbours))
type: QuestionComment

http://stackoverflow.com/a/27987094
score: 0
type: Answer
has body: I had an error saying that I had an invalid token on my R.java and indeed a string had an ' at the variable name, which is not permitted of course, but that string was not made by me but by the system so i could not fix it manually ! What I did was cleaning and building not only the current project but also the support library that I used for that project. Doing so the error popped up on the library project also ! Since I could not fix it manually, I deleted the support library and reimported a new support library which solved my problem.
answers question: http://stackoverflow.com/q/20718116

http://stackoverflow.com/a/20751170
answers question: http://stackoverflow.com/q/20751091
has comment: http://stackoverflow.com/comment/31096995
upvote count: 2
type: Answer
score: 2
has body: There are any number of possibilities you might use... You Could Return the user from the login class, using a getter of some sort. The. You would simply need to store the value in some way that it could then be passed to other parts of the program Generally I tend to prefer this option, but it can mean that you end up passing dozens of parameters to classes that don't really need them because they have a class or child class that needs it... You Could Use a singleton to store the active user, so when the user is first logged in, you would set the value of the singleton so that other parts of the program could get it from the singleton when they needed it. This is good if you intend to only allow access to a single database for a single user. If you need to support multiple databases or users, the first option becomes your only choice
downvote count: 0

http://stackoverflow.com/a/20734866
has comment: http://stackoverflow.com/comment/31068617
answers question: http://stackoverflow.com/q/20733913
has body: you should have a services folder in your META-INF folder with all the provider files and you should export them to the jar also. eclipse includes them by default, but an exported jar is not
type: Answer
score: 0

selenium
tags question: http://stackoverflow.com/q/20754706
tags question: http://stackoverflow.com/q/20738656
tags question: http://stackoverflow.com/q/20702930
tags question: http://stackoverflow.com/q/20685190
tags question: http://stackoverflow.com/q/20760039
tags question: http://stackoverflow.com/q/20849418
tags question: http://stackoverflow.com/q/20759348
tags question: http://stackoverflow.com/q/20711763
tags question: http://stackoverflow.com/q/20774487
tags question: http://stackoverflow.com/q/20798592
tags question: http://stackoverflow.com/q/20756007
tags question: http://stackoverflow.com/q/20692183
tags question: http://stackoverflow.com/q/20715798
tags question: http://stackoverflow.com/q/20733957
tags question: http://stackoverflow.com/q/20772696
tags question: http://stackoverflow.com/q/20687714
tag name: selenium
tags question: http://stackoverflow.com/q/20782003
tags question: http://stackoverflow.com/q/20806671
tags question: http://stackoverflow.com/q/20739567
tags question: http://stackoverflow.com/q/20680229
tags question: http://stackoverflow.com/q/20818226
tags question: http://stackoverflow.com/q/20696512
tags question: http://stackoverflow.com/q/20689963
tags question: http://stackoverflow.com/q/20703020
tags question: http://stackoverflow.com/q/20719256
tags question: http://stackoverflow.com/q/20826521
tags question: http://stackoverflow.com/q/20800801
tags question: http://stackoverflow.com/q/20833168
tags question: http://stackoverflow.com/q/20782535
tags question: http://stackoverflow.com/q/20835760
tags question: http://stackoverflow.com/q/20730933
tags question: http://stackoverflow.com/q/20730665
tags question: http://stackoverflow.com/q/20833750
tags question: http://stackoverflow.com/q/20816296
tags question: http://stackoverflow.com/q/20799785
tags question: http://stackoverflow.com/q/20806142
tags question: http://stackoverflow.com/q/20756278
tags question: http://stackoverflow.com/q/20761690
tags question: http://stackoverflow.com/q/20810600
tags question: http://stackoverflow.com/q/20758063
tags question: http://stackoverflow.com/q/20748102
tags question: http://stackoverflow.com/q/20805611
tags question: http://stackoverflow.com/q/20825377
type: Tag
tags question: http://stackoverflow.com/q/20812925
tags question: http://stackoverflow.com/q/20700423
tags question: http://stackoverflow.com/q/20780060
tags question: http://stackoverflow.com/q/20766327
tags question: http://stackoverflow.com/q/20736816
tags question: http://stackoverflow.com/q/20680562
tags question: http://stackoverflow.com/q/20778154
tags question: http://stackoverflow.com/q/20801833
tags question: http://stackoverflow.com/q/20694259
tags question: http://stackoverflow.com/q/20752153

http://stackoverflow.com/q/20830145
has answer: http://stackoverflow.com/a/21213089
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: recursion
accepted answer: http://stackoverflow.com/a/21213089
tagged with: algorithm
tagged with: java
has body: basically I'm solving the assembly line scheduling problem in a recursion way, based on the formula provided here The following information can be extracted from the problem statement to make it simpler: Two assembly lines, 1 and 2, each with stations from 1 to n. A car chassis must pass through all stations from 1 to n in order(in any of the two assembly lines). i.e. it cannot jump from station i to station j if they are not at one move distance. The car chassis can move one station forward in the same line, or one station diagonally in the other line. It incurs an extra cost ti, j to move to station j from line i. No cost is incurred for movement in same line. The time taken in station j on line i is ai,j. Si,j represents a station j on line i. Breaking the problem into smaller sub-problems: We can easily find the ith factorial if (i-1)th factorial is known. Can we apply the similar funda here? If the minimum time taken by the chassis to leave station Si, j-1 is known, the minimum time taken to leave station Si, j can be calculated quickly by combining ai, j and ti, j. T1(j) indicates the minimum time taken by the car chassis to leave station j on assembly line 1. T2(j) indicates the minimum time taken by the car chassis to leave station j on assembly line 2. Base cases: The entry time ei comes into picture only when the car chassis enters the car factory. Time taken to leave first station in line 1 is given by: T1(1) = Entry time in Line 1 + Time spent in station S1,1 T1(1) = e1 + a1,1 Similarly, time taken to leave first station in line 2 is given by: T2(1) = e2 + a2,1 Recursive Relations: If we look at the problem statement, it quickly boils down to the below observations: The car chassis at station S1,j can come either from station S1, j-1 or station S2, j-1. Case #1: Its previous station is S1, j-1 The minimum time to leave station S1,j is given by: T1(j) = Minimum time taken to leave station S1, j-1 + Time spent in station S1, j T1(j) = T1(j-1) + a1, j Case …
tagged with: dynamic-programming
has title: Assembly Line Scheduling recursion solution error
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31239388
favorite count: 0

http://stackoverflow.com/comment/31223113
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20811912
type: QuestionComment
has text: @lfx_cool Yep - missed that you initialize your secureRandom with the key. And those you generate the same key each time. The big question is why do you pass your key through a secureRandom in the first place? Now you would need to do the exact same in ruby as well. It does not add extra security, but it does add extra trouble.

http://stackoverflow.com/comment/30987851
type: Comment
comment on: http://stackoverflow.com/a/20688330
has text: there are 10 elements
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31165325
type: QuestionComment
comment on: http://stackoverflow.com/q/20781549
has text: I want to learn awt and swing too. Will look swing too.. but I put awt first. Thank you btw!
score: 0
type: Comment

aes
tags question: http://stackoverflow.com/q/20682226
tags question: http://stackoverflow.com/q/20811912
tags question: http://stackoverflow.com/q/20802380
type: Tag
tags question: http://stackoverflow.com/q/20801073
tags question: http://stackoverflow.com/q/20692425
tags question: http://stackoverflow.com/q/20770072
tag name: aes
tags question: http://stackoverflow.com/q/20796042
tags question: http://stackoverflow.com/q/20758597
tags question: http://stackoverflow.com/q/20847679
tags question: http://stackoverflow.com/q/20739513
tags question: http://stackoverflow.com/q/20746011

http://stackoverflow.com/q/20826028
has answer: http://stackoverflow.com/a/20826040
tagged with: java
type: Question
answer count: 2
tagged with: casting
possible better answer: http://stackoverflow.com/a/20826056
has answer: http://stackoverflow.com/a/20826056
accepted answer: http://stackoverflow.com/a/20826040
downvote count: 0
has title: Casting Object Types
favorite count: 0
upvote count: 2
has body: I'm a little confuse about casting object types. Given the example below: public class Test() { public void method1() { System.out.println("Method 1"); public void method2() { System.out.println("Method 2"); } public class Test1() extends Test{ @Override public void method1() { System.out.println("Method 11"); @Override public void method2() { System.out.println("Method 22"); public void method 3() { System.out.println("Method 3"); public static void main(String[] args) { Test a = new Test1(); a.method1(); //method invokes the overridden method1() of Test1, not Test the superclass a.method2(); //method invokes the overridden method2() of Test1, not Test the superclass a.method3(); //error, must cast == ((Test1)a).method3(); } } What I'm confused about is when I invoked method1 &amp; method2, the compiler or the JVM was able to invoke the method of the derived or subclass, so why does it still need to be downcasted/casted to invoke the method3()? I tried overloading method1 and method2 of the superclass instead of overriding it; The compiler/JVM will require you to downcast the object reference variable before allowing you to invoke the overloaded methods. So, what this means is that without downcasting, you can only invoke the superclass's methods as well as the overridden methods defined in the subclass?
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/31066301
has text: If you don't get an answer soon, then it would be best to show an [sscce](http://sscce.org).
score: 3
comment on: http://stackoverflow.com/q/20734217
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20828079
answers question: http://stackoverflow.com/q/20828057
has comment: http://stackoverflow.com/comment/31235343
has comment: http://stackoverflow.com/comment/31235162
upvote count: 3
has body: Avoid using toString(), just do the null check if(title != null &amp;&amp; vicinity != null) { tv.setText(title+ "\n"+vicinity); } Also make sure "tv" is assigned.
type: Answer
has comment: http://stackoverflow.com/comment/31235364
downvote count: 0
has comment: http://stackoverflow.com/comment/31235361
has comment: http://stackoverflow.com/comment/31235154
has comment: http://stackoverflow.com/comment/31235375
score: 3

http://stackoverflow.com/q/20731500
tagged with: java
accepted answer: http://stackoverflow.com/a/20732006
type: Question
tagged with: dependency-injection
tagged with: guice
downvote count: 0
answer count: 1
favorite count: 0
has body: I don't understand how can I simply bind any value when I bind a class. I always get this error: No implementation for test.Triangle annotated with @com.google.inject.name.Named(value=triangle) was bound. I tried this: Triangle class @Inject public void setLength(@Named("triangle") int length) { this.length = length; } Configuration class bind(Triangle.class).annotatedWith(Names.named("triangle")).toInstance(1); //this one just gives error that I can't do that. How can I enter a value into it, so it would use setLength method with my chosen value?.. I read Guice documentation, but didn't find it. In Spring framework such things like these seemed much easier to do and understand (maybe it has better documentation, at least for me). Also if I missed in documentation where it shows this kind of thing you can link it too.
has comment: http://stackoverflow.com/comment/31060995
has comment: http://stackoverflow.com/comment/31061158
has title: Java Guice - how to bind integer value to my class/object?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31063164
upvote count: 2
has answer: http://stackoverflow.com/a/20732006

http://stackoverflow.com/a/20732511
downvote count: 0
has comment: http://stackoverflow.com/comment/31107205
has body: Here's how I'd do it in VBA. Maybe you can translate: Sub ListBoldStrings() Dim cell As Excel.Range Dim i As Long Dim BoldChars As String Dim BoldStrings() As String 'replace "|" with a char that will not appear in evaluated strings Const SEPARATOR_CHAR As String = "|" Set cell = ActiveCell With cell For i = 1 To .Characters.Count If .Characters(i, 1).Font.Bold Then BoldChars = BoldChars + .Characters(i, 1).Text Else BoldChars = BoldChars + SEPARATOR_CHAR End If If Right$(BoldChars, 2) = WorksheetFunction.Rept(SEPARATOR_CHAR, 2) Then BoldChars = Left$(BoldChars, Len(BoldChars) - 1) End If Next i End With BoldStrings = Split(BoldChars, SEPARATOR_CHAR) For i = LBound(BoldStrings) To UBound(BoldStrings) Debug.Print BoldStrings(i) Next i End Sub
answers question: http://stackoverflow.com/q/20732151
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/31007091
has text: I wish the official Java documentation made these points more visible ... collections are so critical and importants
type: Comment
comment on: http://stackoverflow.com/a/20702017
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31025261
score: 1
type: Comment
type: QuestionComment
has text: Look at http://stackoverflow.com/questions/17681708/mocking-files-in-java-mock-contents-mockito
comment on: http://stackoverflow.com/q/20711964

http://stackoverflow.com/q/20842422
has answer: http://stackoverflow.com/a/20842681
has comment: http://stackoverflow.com/comment/31262079
tagged with: java
tagged with: mysql
has body: I want to create a new table from two other tables. The problem is that I have too many columns and it makes everything crash. The first table I have is a "connection" between users and objects. Table User | id | user_id | o54879 | o54880 | o87984 | ... -------------------------------------------------------- | 1 | 25488 | 0 | 1 | 0 | ... -------------------------------------------------------- | 2 | 35487 | 0 | 1 | 1 | ... -------------------------------------------------------- The 2nd table assigns each object to a category: Table Cat | id | object_id | category | --------------------------------- | 1 | o54879 | 1 | --------------------------------- | 2 | o54880 | 2 | --------------------------------- | 3 | o56457 | 2 | --------------------------------- | 4 | o59782 | 7 | --------------------------------- What I want is a 3nd table like this. Table UserGroupedByCat | id | user_id | c1 | c2 | c3 | ... --------------------------------------------- | 1 | 25488 | 0.4 | 0.1 | 0.7 | ... --------------------------------------------- | 2 | 35487 | 0.01 | 0.75 | 0.2 | ... --------------------------------------------- c1, c2, c3 ... should be the mean that a user has for each category. The main problem is that I have like 500 objects in the database and I makes everything crash when I try to built a sql query like this one: INSERT INTO UserGroupedByCat (user_id, C1, C2, C3, C4, C5, C6, c7) SELECT user_id, ((o34508629+o52965151+o52630004+o34518676+...)/&lt;sum of all objects&gt;), ((o62846406+o50349529+...)/&lt;sum of all objects&gt;), ... FROM `User`; Is there a better (faster) way to make such a query?
type: Question
has comment: http://stackoverflow.com/comment/31262001
has comment: http://stackoverflow.com/comment/31277989
score: 0
has comment: http://stackoverflow.com/comment/31262212
tagged with: sql
answer count: 1
has title: Pivoting a very large table with JDBC
tagged with: jdbc
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31262267

http://stackoverflow.com/q/20840791
downvote count: 0
tagged with: java
has body: I have learned that JasperViewer (default preview component of JasperReports) is a Swing component, so is there any way to convert or embed it in a web application? Some say I should use Java Web Start, but from what i have learned from this link JWS is useful to download and install an application on client machine and this is not our case. the other work around that it may work (maybe just in theory) is converting jFrame to jApplet as briefly described in this link Have you tried any of these solutions and did they work? Do you know any other solution to this problem?
type: Question
tagged with: jasper-reports
has title: Running JasperViewer on Tomcat as part of a web application
score: 4
has comment: http://stackoverflow.com/comment/31260331
answer count: 1
has answer: http://stackoverflow.com/a/20841225
favorite count: 0
type: UnansweredQuestion
tagged with: swing
upvote count: 4
has comment: http://stackoverflow.com/comment/31266520
has comment: http://stackoverflow.com/comment/31259011

http://stackoverflow.com/q/20804998
has answer: http://stackoverflow.com/a/20805039
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20805039
tagged with: java
type: Question
tagged with: string
has body: When using the equal method, if the string being compaired is null it results in an error: public static void main(String[] args) { String nullString = null; String nullString2 = null; System.out.println(nullString.equals(nullString2)); } Result: Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:11) This is causing a problem with what I want to do because I need to evaluate Strings and using the == operator frequently causes equivelant strings to evaluate as false. In my actual application if I have the following code as part of a loop this is the output I get: System.out.println(pointPerson == storyTasks.get(i).getPointPerson()); if (pointPerson != null) { System.out.println(pointPerson.equals(storyTasks.get(i).getPointPerson())); } false true false true So how can I prevent the program from crashing but also correctly evaluate strings. I will be doing the evaluation as part of a long if statement in my actual program: if (!name.equals(storyTasks.get(i).getName()) || !desc.equals(storyTasks.get(i) .getDescription()) || !est.equals(storyTasks.get(i) .getOriginalEstimate()) || !taskStatus.equals(storyTasks.get(i) .getStatus()) || !pointPerson.equals(storyTasks.get(i) .getPointPerson())) { //code }
has title: Correctly evaluating string equivelance and dealing with nulls
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20805377
possible better answer: http://stackoverflow.com/a/20805034
has answer: http://stackoverflow.com/a/20805034

http://stackoverflow.com/a/20765715
has body: Such an operation ought to be possible with a Java 8 Stream, but it can't necessarily be done efficiently -- for example, you can't necessarily parallelize such an operation, as you have to look at elements in order. The API doesn't provide an easy way to do it, but what's probably the simplest way is to take Stream.iterator(), wrap the Iterator to have a "take-while" implementation, and then go back to a Spliterator and then a Stream. Or -- maybe -- wrap the Spliterator, though it can't really be split anymore in this implementation. Here's an untested implementation of takeWhile on a Spliterator: static <T> Spliterator<T> takeWhile( Spliterator<T> splitr, Predicate<? super T> predicate) { return new Spliterators.AbstractSpliterator<T>(splitr.estimateSize(), 0) { boolean stillGoing = true; @Override public boolean tryAdvance(Consumer<? super T> consumer) { if (stillGoing) { boolean hadNext = splitr.tryAdvance(elem -> { if (predicate.test(elem)) { consumer.accept(elem); } else { stillGoing = false; } }); return hadNext && stillGoing; } return false; } }; } static <T> Stream<T> takeWhile(Stream<T> stream, Predicate<? super T> predicate) { return StreamSupport.stream(takeWhile(stream.spliterator(), predicate), false); }
upvote count: 85
has comment: http://stackoverflow.com/comment/31141508
answers question: http://stackoverflow.com/q/20746429
type: Answer
score: 85
has comment: http://stackoverflow.com/comment/90342212
downvote count: 0
has comment: http://stackoverflow.com/comment/31141433
has comment: http://stackoverflow.com/comment/90720226

http://stackoverflow.com/q/20774649
has comment: http://stackoverflow.com/comment/31499358
tagged with: javassist
type: UnansweredQuestion
has title: How to remove a previously added code block in Javassist?
has body: Is there a way to remove a previously added code block in Javassist? I'm working on a project which modifies .class files via Javassist. Among other things it adds some code into constructors. I want this process to be runnable on the same .class file again and again without any side effects. However at the moment, after each run the same code is added to constructor one more time. Is there a way to prevent this?
has answer: http://stackoverflow.com/a/24412719
has comment: http://stackoverflow.com/comment/31164208
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31390141
has comment: http://stackoverflow.com/comment/31458486
score: 0
has comment: http://stackoverflow.com/comment/31139194
answer count: 1
has comment: http://stackoverflow.com/comment/31337804

http://stackoverflow.com/comment/30969751
type: QuestionComment
has text: `tmp0` is the key. i guess, you are storing the file in application's temporary files directory.
score: 0
comment on: http://stackoverflow.com/q/20681434
type: Comment

http://stackoverflow.com/a/48506515
answers question: http://stackoverflow.com/q/20812262
score: 0
type: Answer
has body: private void GetServerModifiedTime(String my_token, String my_path_to_root_folder) throws IOException { //create the new DropBox client DbxClientV2 my_dropbox_client = new DbxClientV2(new DbxRequestConfig("my_app_name_and_version"), my_token); List&lt;Metadata&gt; list_of_metadata_for_all_files = new ArrayList&lt;Metadata&gt;(); try { //get a list of all files list_of_metadata_for_all_files = my_dropbox_client.files().listFolder(my_path_to_root_folder).getEntries(); for (Metadata file_metadata : list_of_metadata_for_all_files) { if (!(file_metadata instanceof FolderMetadata)) { String file_name = file_metadata.getName(); String root_path_plus_file_name = my_path_to_root_folder + "/" + file_name; FileMetadata file_meta_data = (FileMetadata) my_dropbox_client.files().getMetadata(root_path_plus_file_name); Date file_date = file_meta_data.getServerModified(); long file_server_modified = file_date.getTime(); Log.i("", "--------&gt;" + file_server_modified + "\n"); } } }catch (DbxException ignore){ throw new IOException(ignore); } }

asynchronous
tags question: http://stackoverflow.com/q/20801529
tags question: http://stackoverflow.com/q/20791178
tags question: http://stackoverflow.com/q/20761305
type: Tag
tags question: http://stackoverflow.com/q/20822077
tags question: http://stackoverflow.com/q/20740961
tags question: http://stackoverflow.com/q/20752756
tag name: asynchronous
tags question: http://stackoverflow.com/q/20723797
tags question: http://stackoverflow.com/q/20722584

http://stackoverflow.com/a/20837713
type: Answer
has body: class A { public String name; A(String name) { this.name = name; } String getName() { return this.name; } } class B { public int num; public B(int a ) { this.num = a; } int getNum() { return this.num; } } public class Start { public static void main(String[] args) { A objectA = new A("John"); B objectB = new B(24); Person a = new Person(objectA, objectB); a.getAge(); } } **class Person{** A aa; B bb; Person(A aa, B bb) { this.aa = aa; this.bb = bb; } public void getAge() { System.out.println(this.aa.getClass().getName()); System.out.println(this.bb.getClass().getName()); System.out.println(this.aa.getName()); } } No need to change access modifier of the method as you will be importing the class A .
answers question: http://stackoverflow.com/q/20837164
score: 0

http://stackoverflow.com/comment/30988985
score: 0
type: Comment
has text: It is jusdt one output that I need help on
type: QuestionComment
comment on: http://stackoverflow.com/q/20691657

http://stackoverflow.com/comment/38081302
type: AnswerComment
comment on: http://stackoverflow.com/a/20859513
type: Comment
has text: Simple Factory is not really a pattern. It simply decouples the PizzaStore from Pizza creation code. So that PizaaStore becomes "close for modification". The simple factory itself is not close for modification though. Ant that is never its intention.
score: 0

http://stackoverflow.com/a/20769855
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/20769425
has body: Put all your list views in PullToRefreshLayout and give R.id.tab_1 R.id.tab_2 R.id.tab_3 id's to your PullToRefreshLayout instead of ListView &lt;uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tab_1" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ListView android:id="@+id/listview1" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;/uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout&gt; same for rest of the listview In java inside onCreate of the activity: mTabHost = (TabHost) findViewById(android.R.id.tabhost); mPullToRefreshLayout= (ListView)findViewById(R.id.tab_1); mPullToRefreshLayout1 = (ListView)findViewById(R.id.tab_2); mPullToRefreshLayout2 = (ListView)findViewById(R.id.tab_3); listview = (ListView)findViewById(R.id.listview1); listview1 = (ListView)findViewById(R.id.listview2); listview2 = (ListView)findViewById(R.id.listview3); ActionBarPullToRefresh.from(this) // Mark All Children as pullable .allChildrenArePullable() // Set the OnRefreshListener .listener(this) // Finally commit the setup to our PullToRefreshLayout .setup(mPullToRefreshLayout); on tab change: public void onTabChanged(String tabId) { for(int i=0;i&lt;mTabHost.getTabWidget().getChildCount();i++) { mTabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.WHITE); } if (TAB_1.equals(tabId)) { // updateTab(R.id.tab_1); mCurrentTab = 0; //Toast.makeText(getApplicationContext(), "1No Guest list for Today", Toast.LENGTH_SHORT).show(); mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab()).setBackgroundColor(Color.parseColor("#fff498")); ActionBarPullToRefresh.from(this) // Mark All Children as pullable .allChildrenArePullable() // Set the OnRefreshListener .listener(this) // Finally commit the setup to our PullToRefreshLayout .setup(mPullToRefreshLayout); } if (TAB_2.equals(tabId)) { //updateTab(R.id.tab_2); mCurrent…
answers question: http://stackoverflow.com/q/20769425

http://stackoverflow.com/a/20725464
answers question: http://stackoverflow.com/q/20725432
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31050422
score: 1
has body: See this: How do I list the files inside a JAR file? Basically, you just use a ZipInputStream to find a list of files (a .jar is the same as a .zip) Once you know the names of the files, you can use getClass().getResource(String path) to get the URL to the file.
upvote count: 1

http://stackoverflow.com/comment/30992736
type: AnswerComment
type: Comment
has text: Now you are getting into a subjective topic ... whether the rule is "strange" or not. Bear in mind that both auto-boxing and varags were retro-fitted into an earlier design for Java. The rules for method overload resolution in Java 5 and later *had to be* consistent with what Java 4 and earlier did ... when those constructs weren't part of the language.
comment on: http://stackoverflow.com/a/20693262
score: 0

http://stackoverflow.com/a/20758636
has comment: http://stackoverflow.com/comment/31110170
answers question: http://stackoverflow.com/q/20758584
upvote count: 1
type: Answer
downvote count: 0
has body: The .class files were compiled for Java7 and you are probably running them with Java 6 or 5.
score: 1

http://stackoverflow.com/comment/31146504
type: QuestionComment
has text: I want to set the value of time taken by a target to execute in a property hence not tried with ant -v. This property value is to be passed to other targets
comment on: http://stackoverflow.com/q/20779141
score: 0
type: Comment

http://stackoverflow.com/q/20816279
has body: I've downloaded the latest stable binaries of Hadoop (2.2.0). Just as I initialized HDFS, I got this warning: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable I understand that I can fix this by compiling from source so I downloaded the source package from Hadoop. I know the basic process of compiling but got confused after reading the README. A quick google showed that I have to use maven for this, which is a tool to build java based projects. So my question is, how do I use maven to compile Hadoop from source? Should I go into each directory and compile each of the modules? A step by step guide would be very helpful, and explanations would be appreciated.
upvote count: 2
tagged with: maven
has answer: http://stackoverflow.com/a/20818857
type: Question
tagged with: java
tagged with: compilation
tagged with: hadoop
answer count: 2
downvote count: 0
has title: How to compile Hadoop for 64-bit Linux machine?
favorite count: 0
has answer: http://stackoverflow.com/a/20818888
type: UnansweredQuestion
tagged with: maven-2
score: 2

http://stackoverflow.com/a/20811261
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20811214
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20811214
has body: You can use the .mayBeJSON(String str) available in the JSONUtils library for validating JSON in java or else A wild idea for validating JSON, try parsing it and catch the exception: public boolean isJSONValid(String test) { boolean valid = false; try { new JSONObject(test); valid = true; } catch(JSONException ex) { valid = false; } return valid; }

http://stackoverflow.com/comment/35937417
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21177350
type: Comment
has text: Setting the parameter `append` works perfectly with regular file appenders! Is it somehow possible to do the same when using a file appender in a `SiftingAppender`? I always get `No such property [append] in ch.qos.logback.classic.sift.SiftingAppender` no matter if I place the `param` tag in the parent or child appender...

http://stackoverflow.com/a/22547892
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/20698929
answers question: http://stackoverflow.com/q/20698929
has body: I stumbled across this post which helped me get JsonIgnoreProperties working again: http://jersey.576304.n2.nabble.com/Beware-of-JacksonFeature-in-Jersey-td7581633.html I didn't research enough to be 100% sure on the underlying cause of the issue, but it seems registering JacksonFeature.class pulls in an outdated version of a library needed for this. Doing as suggested in that link worked for me.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34328171

http://stackoverflow.com/q/20832717
linked to: http://stackoverflow.com/q/3646632
has body: This is NOT about whether primitives go to the stack or heap, it's about where they get saved in the actual physical RAM. Take a simple example: int a = 5; I know 5 gets stored into a memory block. My area of interest is where does the variable 'a' get stored? Related Sub-questions: Where does it happen where 'a' gets associated to the memory block that contains the primitive value of 5? Is there another memory block created to hold 'a'? But that will seem as though a is a pointer to an object, but it's a primitive type involved here.
has comment: http://stackoverflow.com/comment/31244913
has comment: http://stackoverflow.com/comment/31244912
duplicate of: http://stackoverflow.com/q/3646632
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31246743
linked to: http://stackoverflow.com/q/3698078
has comment: http://stackoverflow.com/comment/31244506
tagged with: java
has comment: http://stackoverflow.com/comment/31244647
has answer: http://stackoverflow.com/a/20833010
score: 9
type: Question
has comment: http://stackoverflow.com/comment/31245163
upvote count: 9
has title: How does Java store primitive types in RAM?
has comment: http://stackoverflow.com/comment/31246706
has comment: http://stackoverflow.com/comment/31244389
answer count: 2
has comment: http://stackoverflow.com/comment/31244381
downvote count: 0
accepted answer: http://stackoverflow.com/a/20833010
favorite count: 0
possible better answer: http://stackoverflow.com/a/20833011
tagged with: primitive-types
has comment: http://stackoverflow.com/comment/31244636
has answer: http://stackoverflow.com/a/20833011

http://stackoverflow.com/q/20753660
answer count: 5
tagged with: interface
possible better answer: http://stackoverflow.com/a/20753672
has answer: http://stackoverflow.com/a/20753672
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20753684
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/48844873
type: Question
accepted answer: http://stackoverflow.com/a/20753669
downvote count: 0
has body: Consider the following interface : public interface MyInterface { public void func1(); public void func2(); abstract public void func3(); } and the class MyClass : public class MyClass implements MyInterface{ @Override public void func1() { // TODO Auto-generated method stub } @Override public void func2() { // TODO Auto-generated method stub } @Override public void func3() { // TODO Auto-generated method stub } } What's the difference between func2() and func3() ? I must implement both when I want to implement MyClass , so it seems that there's no difference if I write public or abstract public in the interface . Thanks
has answer: http://stackoverflow.com/a/20753813
favorite count: 0
has title: What's the difference between public method and abstract method in Interface?
has answer: http://stackoverflow.com/a/20753669

http://stackoverflow.com/a/20760238
has comment: http://stackoverflow.com/comment/31114856
upvote count: 0
answers question: http://stackoverflow.com/q/20760034
type: Answer
has comment: http://stackoverflow.com/comment/31114766
has body: Use this Code String filename = "C:\\folder name where you save file\\filename"; response.setContentType("application/octet-stream"); String disHeader = "Attachment; Filename=\"filename\""; response.setHeader("Content-Disposition", disHeader); File fileToDownload = new File(filename); InputStream in = null; ServletOutputStream outs = response.getOutputStream(); try { in = new BufferedInputStream (new FileInputStream(fileToDownload)); int ch; while ((ch = in.read()) != -1) { outs.print((char) ch); } } finally { if (in != null) in.close(); // very important } outs.flush(); outs.close(); in.close();
has comment: http://stackoverflow.com/comment/31113444
has comment: http://stackoverflow.com/comment/31114688
score: -1
downvote count: 1

http://stackoverflow.com/a/20758850
answers question: http://stackoverflow.com/q/20758789
has comment: http://stackoverflow.com/comment/31114733
downvote count: 0
has body: As you need to run other code you can do ScheduleExecutorService ses = Executors.newSingleThreadScheduledExecutor(); ses.scheduleAtFixedRate(new Runnable() { public void run() { Data data = getDataFromRouter(); updateDatabase(data); } }, 0, 30, TimeUnit.SECONDS); Other wise I would have a simple loop like this. while(true) { Data data = getDataFromRouter(); updateDatabase(data); Thread.sleep(30 * 1000); } You need at least one thread, but you start with one.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31112864
score: 2
has comment: http://stackoverflow.com/comment/31110371
has comment: http://stackoverflow.com/comment/31110185

http://stackoverflow.com/comment/30970599
score: 0
comment on: http://stackoverflow.com/q/20681815
type: Comment
type: QuestionComment
has text: iam using this import org.json.JSONArray;

http://stackoverflow.com/a/20754377
type: Answer
answers question: http://stackoverflow.com/q/20754272
has comment: http://stackoverflow.com/comment/31103013
upvote count: 1
has comment: http://stackoverflow.com/comment/31103082
score: 1
has body: Create a class, say AudioPlayer with a SoundPool variable. Setup a constructor to initialise the AudioPlayer object and create a Play method. SoundPool works better for short sounds played many times and does not require you to release. public class AudioPlayer { private SoundPool sPool = new SoundPool(Integer.MAX_VALUE, AudioManager.STREAM_MUSIC, 0); public AudioPlayer(Context c, int id){ sounds.put("1",sPool.load(c, id, 1)); } public void play(Context c) { sPool.play("1", 1, 1, 1, 0, 1f); } } So your class should look like public class soundPageOne extends Activity { public void onCreate(Bundle savedState) { super.onCreate(savedState); setContentView(R.layout.soundsone); final AudioPlayer ap = new AudioPlayer(this, R.raw.sound); Button playSound1 = (Button) this.findViewById(R.id.peter1Button); playSound1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ap.play(); } });
has comment: http://stackoverflow.com/comment/31115932
downvote count: 0

http://stackoverflow.com/a/20782955
type: Answer
answers question: http://stackoverflow.com/q/20782815
has body: Fundamentally you are trying to do a series of comparisons, so there is little choice but to do a series of comparisons. What you could do is define an interface/enum/abstract class which is a FieldChecker. That FieldChecker would have an abstract method implemented differently in each FieldChecker: String performCheck(Font a, Font b) { if (DO CHECK HERE) { return "failure message"; } return null; } Then your check function just becomes: for (FieldChecker fc: fieldCheckers) { String res = fc.performCheck(a,b); if (res != null) { return res; } } return "All ok";
score: 0

http://stackoverflow.com/comment/31065672
type: Comment
has text: Ah i am new in stackoverflow. So i dont know general deportments yet sorry :)
comment on: http://stackoverflow.com/a/20733276
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31217244
type: AnswerComment
type: Comment
has text: This code is on server side and just means that the server sends bsck the mesaage it just received from client to the client. So when it works normal the privious sent message will appear again on client console. But additionally the server hhas to print out the message from clint in its console
score: 0
comment on: http://stackoverflow.com/a/20817857

http://stackoverflow.com/q/20779760
accepted answer: http://stackoverflow.com/a/20779890
tagged with: java
score: 0
answer count: 2
has title: JUNRAR : Application freezes until extraction is not completed
has answer: http://stackoverflow.com/a/20779939
has answer: http://stackoverflow.com/a/20779890
tagged with: android
possible better answer: http://stackoverflow.com/a/20779939
type: AnsweredQuestion
has body: i have some kind of problem with junrar , i am able to extract rar files using junrar but it is slow and my application stops to respond until extraction is not completed if any one having solution or alternate of junrar please help me. i have also used junrar in service but same result please help... here is my code to extract private static File createFile(FileHeader fh, File destination) { File f = null; String name = null; if (fh.isFileHeader() &amp;&amp; fh.isUnicode()) { name = fh.getFileNameW(); } else { name = fh.getFileNameString(); } f = new File(destination, name); if (!f.exists()) { try { f = makeFile(destination, name); } catch (IOException e) { Log.e("error creating the new file: " ,f.getName(), e); } } return f; } private static File makeFile(File destination, String name) throws IOException { String[] dirs = name.split("\\\\"); if (dirs == null) { return null; } String path = ""; int size = dirs.length; if (size == 1) { return new File(destination, name); } else if (size &gt; 1) { for (int i = 0; i &lt; dirs.length - 1; i++) { path = path + File.separator + dirs[i]; new File(destination, path).mkdir(); } path = path + File.separator + dirs[dirs.length - 1]; File f = new File(destination, path); f.createNewFile(); return f; } else { return null; } } public void extractRar(File filerar,final String location) { Archive a = null; try { a = new Archive(new FileVolumeManager(filerar)); } catch (RarException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (a != null) { a.getMainHeader().print(); FileHeader fh = a.nextFileHeader(); while (fh != null) { try { if(fh.isDirectory()) { Log.e("directory", fh.getFileNameString()); if(fh.getFileNameString().contains(".")) { directory=fh.getFileNameString(); Log.e("Directory name",directory); } }else{ file=fh.getFileNameString(); Log.e("File name",file); File out = createFile(fh, new File(location)); Log.e("observe fil…
type: Question

http://stackoverflow.com/q/20838290
tagged with: jasper-reports
has body: I am using jasper report to generate pdf file from my database. Here is my code.. ReportGenerator.java package com; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; public class ReportGenerator { Connection conn; public void generateReport() { try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:SID","username","password"); System.out.println("Loading Report Designs"); InputStream input = new FileInputStream(new File("jrxml/EmployeeReport.jrxml")); JasperDesign jasperDesign = JRXmlLoader.load(input); System.out.println("Compiling Report Designs"); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); System.out.println("Creating JasperPrint Object"); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("ReportTitle", "PDF JasperReport"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,null,conn); //Exporting the report OutputStream output = new FileOutputStream(new File("report/EmployeeReport.pdf")); JasperExportManager.exportReportToPdfStream(jasperPrint, output); System.out.println("Report Generation Complete"); conn.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (JRException e) { e.printStackTrace(); } catch (ClassNotFoundExc…
has comment: http://stackoverflow.com/comment/31254113
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20839429
has answer: http://stackoverflow.com/a/29686137
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
has title: Error in Jasper Report
tagged with: java
has comment: http://stackoverflow.com/comment/31282885
type: Question

http://stackoverflow.com/q/20692940
has answer: http://stackoverflow.com/a/20693234
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20693069
has answer: http://stackoverflow.com/a/20693041
tagged with: java
has answer: http://stackoverflow.com/a/20693127
type: Question
has body: I'm trying to make a for loop that gives a random seat number to each name the user enters. So the user tells me the names, and how many seats there are and I need to make a for loop that randomly assigns each name a random seat? Here's what I'm doing, but I'm not sure how I can make this right: for(seats=1; seats&lt;=kids.size(); seats++) { int result=(int)(Math.random()* (kids.size()) ); System.out.println(result); } It just returns 0 for however many names there are. I'm pretty sure I've messed up a lot on this but any help is appreciated :)
tagged with: for-loop
has comment: http://stackoverflow.com/comment/30991382
has title: Trying to make a for loop with random numbers?
has answer: http://stackoverflow.com/a/20693096
score: 0
tagged with: random

http://stackoverflow.com/q/20733415
has title: Error on add Action Bar Sherlock and AppCompat v7 in Android Studio
tagged with: actionbarsherlock
has body: I'm trying to use Action Bar Sherlock, but the libraries give an error on Add, I made a screenshot to explain this situation better:
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/20734232
type: AnsweredQuestion
tagged with: android-styles
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20734232
type: Question

http://stackoverflow.com/comment/35632379
score: 2
has text: were you able to get this to work? I'm having the same issue myself
comment on: http://stackoverflow.com/q/20721044
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20822738
tagged with: jpanel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31225174
tagged with: keyboard-events
score: -5
has comment: http://stackoverflow.com/comment/31225206
has answer: http://stackoverflow.com/a/20822843
favorite count: 0
has title: I cannot get keyboard input in JFrame?
type: Question
tagged with: jframe
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/31225189
linked to: http://stackoverflow.com/q/13999506
tagged with: java
has body: I have a JFrame that has two panels, the first panel(panel) has buttons and labels only, where the second panel has the game and keyboard input . The second panel(panelGame) does appear on screen, but with no keyboard response, my space ship cannot move nor I can shoot. Please download my project and help me thank you for your time and consideration. https://www.mediafire.com/?wjz6fm3z4567bq8
has comment: http://stackoverflow.com/comment/31225210
upvote count: 0
downvote count: 5

http://stackoverflow.com/comment/31140642
type: Comment
comment on: http://stackoverflow.com/q/20766837
type: QuestionComment
has text: Can someone tell me the space complexity of this solution?
score: 0

http://stackoverflow.com/q/20816044
favorite count: 0
has title: Can not project image on the exit screen
has answer: http://stackoverflow.com/a/20816158
has comment: http://stackoverflow.com/comment/31212639
has comment: http://stackoverflow.com/comment/31212709
has comment: http://stackoverflow.com/comment/31212959
has comment: http://stackoverflow.com/comment/31212726
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20816158
score: 1
tagged with: java
tagged with: eclipse
has body: The problem is: When I close main program I have a little window with some image (Exit screen) and this image is not visible, only frame. I have also another image when I launch program and this image is visible on the screen but the second (when close) isn't. When I compile this class in Eclipse everything works OK but when I run the MAIN program it doesn't. Both are generated from the same class but the difference is in constructor's arguments. Both PNG files are in the folder where JAR file of this project and WorkSpace are. Please help. SplashScreen code: package Models; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Toolkit; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JWindow; import MainProject.ExpertSystem; public class SplashScreen extends JWindow { private static final long serialVersionUID = 1L; private int duration; private ExpertSystem context; private String graphicPath; private boolean exit = false; int width,height; private boolean showContext; public SplashScreen(int d, ExpertSystem context,String graphicPath,boolean exit,int width, int height,boolean showContext) { duration = d; this.graphicPath = graphicPath; this.context = context; this.exit = exit; this.width = width; this.height = height; this.showContext = showContext; showSplashAndExit(); } public SplashScreen(int d) { duration = d; } // A simple little method to show a title screen in the center // of the screen for the amount of time given in the constructor public void showSplash() { JPanel content = (JPanel)getContentPane(); content.setBackground(Color.white); // Set the window's bounds, centering the window Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screen.width-width)/2; int y = (screen.height-height)/2; setBounds(x,y,width,height); // Build the splash screen JLabel label = new JLabel(new ImageIco…
type: Question
answer count: 1
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/q/20829495
type: Question
has title: TimesTen 11.2.2 Hibernate 4 Dialect
upvote count: 1
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27175763
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
score: 1
tagged with: java
tagged with: hibernate
tagged with: timesten
has body: I've been trying to use TimesTen 11.2.2.5 as a provider for Hibernate. In order to do so I had to download some custom made Dialect but then I realized that it is meant for Hibernate 3.5 (which is quite different from Hibernate 4.X). Hibernate's packed dialects are for TimesTen 5 and are not really helpful... What should I do in order to make it work?

http://stackoverflow.com/q/20782268
favorite count: 0
has body: Need help to setup Log4j JDBCAppender in standalone.xml in JBoss 7.1.1 I have tried as below but not working .... .... .... <level name="ERROR"/> Data Base URL edb-jdbc14 username password <pattern-formatter pattern="INSERT INTO log_dtl(application_type,thread,class,method,line_no,level,log_date,message_key,message_dtl,message_desc,message_meta_data) VALUES('APP','%t','%c','%M','%L','%p','%d{dd/MM/yyyy HH:mm:ss}','%X{MESSAGE_KEY}','%m','%X{MESSAGE_DESC}','%X{MESSAGE_META_DATA}')" /> com.edb.Driver .... .... Error Log 14:56:16,881 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.server.ServerService.boot(ServerService.java:266) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02] Caused by: java.lang.IllegalArgumentException: newValue is null at org.jboss.dmr.ModelNode.set(ModelNode.java:458) [jboss-dmr-1.1.1.Final.jar:1.1.1.Final] at org.jboss.as.logging.LoggingSubsystemParser.parsePropertyElement(LoggingSubsystemParser.java:898) at org.jboss.as.logging.LoggingSubsystemParser.parseCustomHandlerElement(LoggingSubsystemParser.java:610) at org.jboss.as.logging.LoggingSubsystemParser.readElement(LoggingSubsystemParser.java:169) at org.jboss.as.logging.LoggingSubsystemParser.readElement(LoggingSubsystemParser.java:113) at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final] at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final] at org…
tagged with: jboss7.x
tagged with: log4j
tagged with: log4jdbc
upvote count: 2
type: UnansweredQuestion
has title: Jboss 7 log4j configuration - JDBCAppender
score: 2
has answer: http://stackoverflow.com/a/20887665
tagged with: java
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/q/20796882
has answer: http://stackoverflow.com/a/20798780
score: 8
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11415711
tagged with: spring
tagged with: properties
has answer: http://stackoverflow.com/a/20797689
type: Question
has title: How can I get all properties with prefix 'abc.' from PropertyPlaceholderConfigurer
tagged with: java
has body: In spring context file, I use org.springframework.beans.factory.config.PropertyPlaceholderConfigurer to load several configuration files: a.properties b.properties c.properties The a.properties, b.properties, c.propertes may have some hibernate configurations which have prefix of abc.: abc.hibernate.show_sql=true abc.hibernate.default_schema=myschema abc.hibernate.xxx=xxx abc.hibernate.xxx=xxx abc.hibernate.xxx=xxx abc.hibernate.xxx=xxx abc.hibernate.xxx=xxx abc.hibernate.xxx=xxx Now I want to define a hibernate session factory: <util:properties> ${abc.hibernate.show_sql} ${abc.hibernate.xxx} ${abc.hibernate.xxx} ${abc.hibernate.xxx} ${abc.hibernate.xxx} ${abc.hibernate.xxx} </util:properties> You can see I have to write the property in bean declaration again and again: ${abc.hibernate.xxx} Is there any way to just tell spring to get all properties which have prefix abc.? So I can write: <something prefix="abc" /> Is it possible or is there any other simple solutions for it?
has comment: http://stackoverflow.com/comment/31178147
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20797989
upvote count: 8

http://stackoverflow.com/q/20738207
favorite count: 0
possible better answer: http://stackoverflow.com/a/20738240
tagged with: classloader
has answer: http://stackoverflow.com/a/59547185
has answer: http://stackoverflow.com/a/20738240
has comment: http://stackoverflow.com/comment/31073553
accepted answer: http://stackoverflow.com/a/20738341
type: AnsweredQuestion
tagged with: java
has body: I define a classloader name MyClassLoader as such. cl = new MyClassLoader(); I could use cl to load my class A. Class c = cl.loadClass(); but how to load a class which is A[].class?
has comment: http://stackoverflow.com/comment/31073597
type: Question
upvote count: 4
has title: how to get a array class using classloader in java?
downvote count: 0
has comment: http://stackoverflow.com/comment/31073420
score: 4
has comment: http://stackoverflow.com/comment/31073462
has answer: http://stackoverflow.com/a/20738341
answer count: 3

http://stackoverflow.com/q/20704800
answer count: 3
has answer: http://stackoverflow.com/a/20704816
accepted answer: http://stackoverflow.com/a/20704855
tagged with: collections
has answer: http://stackoverflow.com/a/20704842
has comment: http://stackoverflow.com/comment/31012015
has comment: http://stackoverflow.com/comment/31021145
tagged with: java
has comment: http://stackoverflow.com/comment/31012187
has comment: http://stackoverflow.com/comment/31012375
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31011689
has comment: http://stackoverflow.com/comment/31011901
has comment: http://stackoverflow.com/comment/31011630
has comment: http://stackoverflow.com/comment/31011874
has comment: http://stackoverflow.com/comment/31011684
has title: Collections.frequency returning 0 when checking -1 values in ArrayList
type: Question
has comment: http://stackoverflow.com/comment/31012149
has body: List line = [0, -1, 28, 0, 50, 0, -1, 75, 0] // pseudocode System.out.println(Collections.frequency(line, -1)); Why does Collections.frequency return 0 when I check the -1 value?
has answer: http://stackoverflow.com/a/20704855
has comment: http://stackoverflow.com/comment/31012094
possible better answer: http://stackoverflow.com/a/20704816
score: 0
has comment: http://stackoverflow.com/comment/31012252

http://stackoverflow.com/q/20779743
upvote count: 1
type: Question
has title: how to continuously increment student number after click save with key event
accepted answer: http://stackoverflow.com/a/20779943
has body: I am making an enrollment System which can generate a student number which starts at 1000000. Once saved it will continously increase by a value of 1 which the second student number will look like this '1000001'. The increase of student number should happen after clicking save. I am using key event, after the user click ENTER the system will check if there's a match of student number. If there's a match the number will increment by 1, but unfortunately after pressing ENTER for generating new student number nothing happen. Please see the code below. Note: The first Key Release works, only after saving and click the the key release again for generating new student number, it doesn't work anymore. public class generate_stud_num { public void create() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:sca"); Statement stmnt = con.createStatement(); rs = stmnt .executeQuery("SELECT Student_Number FROM student_form_new order by Student_Number ASC"); while (rs.next()) { // JOptionPane.showMessageDialog(null, // "Student Number already exist"); studID = rs.getInt("Student_Number"); studID += 1; INC = Integer.toString(studID); // System.out.println(INC); } rs.close(); } catch (Exception er) { er.printStackTrace(); } }// close method }// close class Here is the code for key event. public class Mylistener implements KeyListener { generate_stud_num gsn = new generate_stud_num(); public void keyReleased(KeyEvent e) { if (e.getSource() == textStudentID) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { gsn.create(); textStudentID.setText(gsn.INC); } } }// end method public void keyTyped(KeyEvent e) { // TODO: Do something for the keyTyped event } public void keyPressed(KeyEvent e) { // TODO: Do something for the keyPressed event } }// close inner class
has comment: http://stackoverflow.com/comment/31147792
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31147591
has comment: http://stackoverflow.com/comment/31147784
favorite count: 0
has comment: http://stackoverflow.com/comment/31147565
has comment: http://stackoverflow.com/comment/31147711
has comment: http://stackoverflow.com/comment/31148106
has comment: http://stackoverflow.com/comment/31147555
has comment: http://stackoverflow.com/comment/31147712
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31147522
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20779943

http://stackoverflow.com/q/20686715
tagged with: java
has title: Moving view using touch events
type: Question
downvote count: 0
has body: I want to make an application with sliding navigation, i.e. user can move views horizontally, sliding them in or out. Currently I have implemented my custom ViewGroup with my layout and measurement settings (overridden onLayout and onMeasure). Also I have implemented OnTouchListener calculating difX from starting event point to end point. But I dont know how to apply this difX to my views to change their position.
tagged with: android
answer count: 1
favorite count: 0
tagged with: view
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20687033
score: 2

http://stackoverflow.com/comment/43381434
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20702782
has text: Related: http://cstheory.stackexchange.com/questions/27748/computing-parity-of-a-permutation-in-a-streaming-fashion-way

http://stackoverflow.com/comment/31247355
comment on: http://stackoverflow.com/a/20748786
type: Comment
score: 0
type: AnswerComment
has text: First of all Thank you for the reply. Ganymed is one of the pure JAVA SSH implementations that I am using in my code so I am going to take a look at its source.

http://stackoverflow.com/q/20742438
has comment: http://stackoverflow.com/comment/31080473
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31080482
has answer: http://stackoverflow.com/a/20742927
has comment: http://stackoverflow.com/comment/31080412
score: 0
answer count: 5
has body: I have been facing a question frequently regarding Hashtable. How to convert key as value and value as key with out any data loss using java.util.Hashtable. Hashtable ht = new Hashtable(); ht.put(1,"One"); ht.put(2,"Two"); ht.put(3,"One"); I would like to convert keys as "One","Two","One" and values as 1,2,3 respectively. Thanks for your valuable support.
has answer: http://stackoverflow.com/a/20743386
has comment: http://stackoverflow.com/comment/31081011
has answer: http://stackoverflow.com/a/20742726
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31080770
has answer: http://stackoverflow.com/a/20742636
has comment: http://stackoverflow.com/comment/31080607
has title: With out any data loss, how can we interchange hashtable key values?
has answer: http://stackoverflow.com/a/20751811

http://stackoverflow.com/comment/31102564
has text: Both of them do not make much sense and whoever wrote it doesn't realize that it can be done much simpler with just `public interface Vector<T>`.
comment on: http://stackoverflow.com/q/20736221
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31220109
comment on: http://stackoverflow.com/q/20819988
type: Comment
type: QuestionComment
has text: Can you assume a white space after the command? Does it always start with `\u`? What would you like the "cleaned" string to look like (exactly)?
score: 0

http://stackoverflow.com/comment/30972113
comment on: http://stackoverflow.com/q/20682309
has text: Yeah. I have used tar streaming. But I've done that just from one absolute path and have extracted to same one, on another node.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20785264
favorite count: 0
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/20787243
tagged with: c++
type: AnsweredQuestion
has title: How to use android native code inside application project
score: 1
tagged with: java
type: Question
has body: I have a requirement where I need to access native code(inside android os) and use it in my application through jni interface. For eg: Accessing void NuPlayer::HTTPLiveSource::start() {..} method inside HttpLiveSource.cpp. I have found out from the from Android - Include native StageFright features in my own project that this is possible using two options: build your project using android full source tree. you can just copy include file to your project I can't use option 1 and so am trying to use option 2... I am new to jni and so want to know: What files to include inside my project? How to access native methods? Is it a future proof approach?(I have seen that source files are moved to different folders depending on the OS version) Any pointers or detailed explanation will be very helpful.
tagged with: java-native-interface
linked to: http://stackoverflow.com/q/9832503
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20787243
tagged with: native-methods

http://stackoverflow.com/comment/31247856
comment on: http://stackoverflow.com/a/20834647
type: Comment
has text: ok... getClass().getName() + '@' + Integer.toHexString(hashCode()) ... this should refer to the current object in the Test class right??.. I mean is it correct to use "the child object" as the current object even in the parent class ?. The parent object will have its own hashcode and name. Why not use it??
score: 0
type: AnswerComment

http://stackoverflow.com/q/20733106
accepted answer: http://stackoverflow.com/a/20756126
upvote count: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: properties-file
has answer: http://stackoverflow.com/a/20756126
answer count: 2
score: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/20733273
has title: Read all properties files in a directory
has body: Right now I am reading properties file in spring as <property name="basename" value="customer/messages" /> Here I am specifying that read messages.properties in customer directory. But what I want to do is to specify a directory and ask spring to read all properties file present in that directory. How can I achieve that? I tried value="customer/*" but it doesn't work.
has answer: http://stackoverflow.com/a/20733273
tagged with: spring

http://stackoverflow.com/comment/31040236
type: QuestionComment
has text: Other side note: your byte array shouldn't be public. Especially in a class used as a key of a map, which should be immutable (as I already told you in a previous answer).
score: 0
comment on: http://stackoverflow.com/q/20720063
type: Comment

http://stackoverflow.com/comment/31113806
has text: Well, no ideas at the moment for Java. However, I have used GPSS to simulate real world models in a faculty course.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20760969

command-prompt
tags question: http://stackoverflow.com/q/20738264
tag name: command-prompt
type: Tag
tags question: http://stackoverflow.com/q/20755556

http://stackoverflow.com/q/20791936
has title: Teamcity engine crashed with parent-modules maven
favorite count: 0
has comment: http://stackoverflow.com/comment/31343018
type: UnansweredQuestion
tagged with: maven
tagged with: teamcity
upvote count: 1
tagged with: subproject
answer count: 0
has comment: http://stackoverflow.com/comment/31420748
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31345068
type: Question
downvote count: 0
has body: I have two simple spring projects, both built fine on teamcity. Then I added a parent pom.xml: 4.0.0 com.abcd MainProject 1.0-SNAPSHOT pom employee SpringOne Then in employee and SpringOne pom.xml files, I added parent tag: MainProject com.abc 1.0-SNAPSHOT The new pom files are build fine from command line. But when I moved it to teamcity, I am seeing error with -X -e option: [16:53:17][Step 1/1] Caused by: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.close(ForkClient.java:257) [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:301) [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:116) [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:740) [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:682) [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:648) [16:53:17][Step 1/1] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:586 ) [16:53:17][Step 1/1] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) [16:53:17][Step 1/1] ... 20 more [16:53:17][Step 1/1] [main] ERROR org.apache.maven.cli.MavenCli - [16:53:17][Step 1/1] [main] ERROR org.apache.maven.cli.MavenCli - [16:53:17][Step 1/1] [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles: [16:53:17][Step 1/1] [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException [16:53:17][Step 1/1] [ma…

http://stackoverflow.com/a/20712853
has body: The problem is that you are putting in your input as a double. This is from the javadoc: The results of this constructor can be somewhat unpredictable. One might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal which is exactly equal to 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal to 0.1000000000000000055511151231257827021181583404541015625. This is because 0.1 cannot be represented exactly as a double (or, for that matter, as a binary fraction of any finite length). Thus, the value that is being passed in to the constructor is not exactly equal to 0.1, appearances notwithstanding Since you are using a double, it is being stored as a floating-point number, and not as a precision number. It then converts that non-precision floating-point number to a precision BigDecimal, which then puts it out as a precise number. It works if the input is a String, however, since a String is just text, and converts the string directly to a BigDecimal. See this from here: Creating a big decimal from a (scalar) double is simple: bd = new BigDecimal(1.0); To get a BigDecimal from a Double, get its doubleValue() first. However it is a good idea to use the string constructor: bd = new BigDecimal("1.5"); If you don't, then you'll get the following, bd = new BigDecimal(1.5); bd.toString(); // => 0.1499999999999999944488848768742172978818416595458984375 So do it like this: Sysout(new MyDecimal("0.0001")); Also, as @JBNizet points out, you're extending an immutable object, a BigDecimal. You're ignoring the return value of setting the scale. This could be changed by using a method such as the one below: public static BigDecimal createBigDecimal(String s) { BigDecimal bigdeci = new BigDecimal(s); return bigdeci.setScale(4); }
upvote count: 2
has comment: http://stackoverflow.com/comment/31027299
has comment: http://stackoverflow.com/comment/31027325
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20712792

http://stackoverflow.com/comment/31075871
score: 0
type: QuestionComment
has text: NPE may be more consistent but empty collection may be easier to work with...
type: Comment
comment on: http://stackoverflow.com/q/20739736

http://stackoverflow.com/comment/31189714
has text: Yes, in that case the class would not be anonymous, it would be called `Square`.
comment on: http://stackoverflow.com/a/20803534
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/35341062
has body: I found solution. You have to inicializate ImageIO before other operations. You can do this by adding: static { ImageIO.scanForPlugins(); } eg into your Main class.
downvote count: 0
answers question: http://stackoverflow.com/q/20789546
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/93434011

http://stackoverflow.com/comment/31211877
type: QuestionComment
comment on: http://stackoverflow.com/q/20815582
score: 0
has text: which xml you are using in Catrpt activity?
type: Comment

http://stackoverflow.com/comment/31134128
type: AnswerComment
comment on: http://stackoverflow.com/a/20753700
score: 0
type: Comment
has text: I am tired of arguing with Java developers who don't understand difference between security and encapsulation or think they are the same thing.

http://stackoverflow.com/q/20722978
type: Question
tagged with: ant
upvote count: 2
answer count: 1
has body: I'm trying to build a javafxpackager project similar to this issue which actually solves my problem via NetBeans. However, I would like to automate the task without using NetBeans. Unfortunately it seems that in order to get this to work I need to change the classpath that Ant uses for its own execution (not the one it uses to compile my stuff). I can hardcode my directories (which is a problem for my case) or change the ant.bat file probably (again a problem). Ideally I'd like to know if there is an ant configuration or command line that allows me to append a directory to its internal path?
favorite count: 0
tagged with: netbeans
has title: Changing Ants Task Classpath From Command Line
has answer: http://stackoverflow.com/a/20762359
accepted answer: http://stackoverflow.com/a/20762359
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: javafx

http://stackoverflow.com/a/20800057
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20800006
has body: You do return something, you're just not printing it. Just try: System.out.println(lcm(firstNumber, secondNumber));
answers question: http://stackoverflow.com/q/20800006
has comment: http://stackoverflow.com/comment/31189011
upvote count: 3
has comment: http://stackoverflow.com/comment/31188916
type: Answer

http://stackoverflow.com/a/20842076
score: 0
type: Answer
has body: This is the code I think you want: public class B { protected sum s1 = new sum(); protected sub s2 = new sub(); Connection con; Dummy d; public B(Connection con, Dummy d) { this.con = con; this.d = d; } public method_demo() { } } public class A extends B { //this is a constructor, because is has the same name as the class public A(Connection con, Dummy d) { super(con, d); } /* // This is a method, not a constructor: public method_1(Connection con , Dummy d) { super(con,d) ; } */ }
answers question: http://stackoverflow.com/q/20841805

http://stackoverflow.com/q/20833380
duplicate of: http://stackoverflow.com/q/40480
type: UnansweredQuestion
has title: Are Objects passed by reference in Java Collections?
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/20833406
tagged with: collections
downvote count: 1
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/31245520
tagged with: oop
tagged with: java
score: -1
has body: I had a doubt in my code snippet : my main class public static void main(String[] args) { Test test = new Test(); test.copyAtoB(3); test.setValueinAlist(30, 3); test.showValues(3, 0); } And this my dummy class public class Test { public ArrayList&lt;MyClass&gt; alist = new ArrayList&lt;MyClass&gt;(); public ArrayList&lt;MyClass&gt; blist = new ArrayList&lt;MyClass&gt;(); Test() { for (int i = 0; i &lt; 10; i++) { MyClass myClass = new MyClass(); myClass.setCount(i); alist.add(myClass); } } public void copyAtoB(int position) { MyClass o = alist.get(position); System.out.println("vlaue of count in object of myclass going to be copied "+o.getCount()); blist.add(o); } public void setValueinAlist(int val,int position){ MyClass myClass= alist.get(position); System.out.println(myClass.getCount()+" is changing to "+val); myClass.setCount(val); } public void showValues(int aPostion,int bPosition){ System.out.println("Vlaue in a "+alist.get(aPostion).getCount()+"\n Vlaue in b "+blist.get(bPosition).getCount()); } } Here comes My object class public class MyClass { int count; public int getCount() { return count; } public void setCount(int count) { this.count = count; } } when i run my code i was expecting output like this vlaue of count in object of myclass going to be copied 3 3 is changing to 30 Vlaue in a 30 Vlaue in b 3 But what i'm getting is this vlaue of count in object of myclass going to be copied 3 3 is changing to 30 Vlaue in a 30 Vlaue in b 30 Could you help me to understand why my concept is wrong ?? I didn't write code to change the value in "blist" but it also get changed how does this happens ?? May be i'm asking a blunder but i couldn't resist
answer count: 2
has answer: http://stackoverflow.com/a/20833402
upvote count: 0
favorite count: 0

http://stackoverflow.com/a/20766355
upvote count: 3
has body: You have a bunch of options: provide the sourcecode + binary so that anyone can download and run by themselves implement your Java code so that it can run in a Java Applet or re-implement it in JavaScript / HTML so that it can just run in browser
has comment: http://stackoverflow.com/comment/31123605
answers question: http://stackoverflow.com/q/20766328
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/20683894
tagged with: arraylist
has comment: http://stackoverflow.com/comment/30974083
accepted answer: http://stackoverflow.com/a/20683949
possible better answer: http://stackoverflow.com/a/20683917
has answer: http://stackoverflow.com/a/20683917
has body: In this class, I'm wanting to return an arraylist in whole, not as individual elements. However, I'm getting an error, "Incompatible Types" at compilation time. What am I doing wrong here? Thanks for any and all of your help!! import java.util.ArrayList; public class CO2FromElectricity { /** * Constructor for objects of class CO2FromElectricity */ public CO2FromElectricity() { } public static double calcAverageBill(ArrayList&lt;Double&gt; monthlyBill, int ind) { ArrayList&lt;Double&gt; avgBill = new ArrayList&lt;Double&gt;(); int i = ind; avgBill.set(i, (monthlyBill.get(i) + avgBill.get(i))/2); return avgBill.get(i); } public double calcAveragePrice(ArrayList&lt;Double&gt; monthlyPrice, int ind) { int i = ind; ArrayList&lt;Double&gt; avgPrice = new ArrayList&lt;Double&gt;(); avgPrice.set(i, (monthlyPrice.get(i) + avgPrice.get(i))/2); return avgPrice; } public double calcElectricityCO2(double avgBill, double avgPrice) { double avBill = avgBill; double avPrice = avgPrice; //Price per kilowatt that is... double emissions = (avBill/avPrice)*1.37*12; return emissions; } }
has comment: http://stackoverflow.com/comment/30974194
has answer: http://stackoverflow.com/a/20683944
answer count: 5
type: AnsweredQuestion
has title: "Incompatible Types" while trying to return arraylist from method
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/30974294
has answer: http://stackoverflow.com/a/20683949
has answer: http://stackoverflow.com/a/20683947
has answer: http://stackoverflow.com/a/20683927

http://stackoverflow.com/a/20804915
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20802397
accepted answer of: http://stackoverflow.com/q/20802397
type: Answer
has body: etOne = (EditText) findViewById(R.id.etSyst); etOne.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { int i = Integer.parseInt(s.toString()); if (i &gt;= 70 &amp;&amp; i &lt;= 190) { sbSyst.setProgress( i - 70); // This ensures 0-120 value for seekbar } } public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void onTextChanged(CharSequence s, int start, int before, int count) {} });
downvote count: 0
score: 1

http://stackoverflow.com/q/20743859
has answer: http://stackoverflow.com/a/20795414
has answer: http://stackoverflow.com/a/36055980
has answer: http://stackoverflow.com/a/20743979
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28667553
tagged with: java
has title: ImageView rounded corners
has comment: http://stackoverflow.com/comment/31082919
has answer: http://stackoverflow.com/a/20743900
linked to: http://stackoverflow.com/q/2459916
type: Question
has answer: http://stackoverflow.com/a/23713740
has comment: http://stackoverflow.com/comment/55640898
tagged with: imageview
has answer: http://stackoverflow.com/a/35295616
accepted answer: http://stackoverflow.com/a/20795414
duplicate of: http://stackoverflow.com/q/2459916
has answer: http://stackoverflow.com/a/61086632
has answer: http://stackoverflow.com/a/56992085
score: 36
has answer: http://stackoverflow.com/a/42234152
has body: I wanted image to have rounded corners. I implement this xml code and use this in my image view. but image overlap the shape. I am downloading the image through async task. &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;corners android:radius="20dip" /&gt; &lt;/shape&gt; &lt;ImageView android:id="@+id/trVouchersImage" android:layout_width="55dp" android:layout_height="55dp" android:layout_marginLeft="8dp" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_alignParentLeft="true" android:background="@drawable/ash_arrow" /&gt;
has answer: http://stackoverflow.com/a/29426464
has answer: http://stackoverflow.com/a/37466079
upvote count: 36
linked to: http://stackoverflow.com/q/25278821
downvote count: 0
has comment: http://stackoverflow.com/comment/121219726
tagged with: rounded-corners
answer count: 17
has answer: http://stackoverflow.com/a/52426304
favorite count: 0
possible better answer: http://stackoverflow.com/a/42234152
has answer: http://stackoverflow.com/a/47351502
has answer: http://stackoverflow.com/a/44685677
has answer: http://stackoverflow.com/a/20744023
has answer: http://stackoverflow.com/a/44902787
tagged with: android

http://stackoverflow.com/comment/31232967
type: Comment
comment on: http://stackoverflow.com/a/20826771
has text: No worries. It kind of invalidates the opening line of the answer, fwiw. :-)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31076013
score: 1
comment on: http://stackoverflow.com/a/20739643
has text: Thank you for the time and answer, it sort of worked out but I had my custom Exception, so i have to went the other way around. but surely your answer was helpful :)
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20782619
tagged with: java
has answer: http://stackoverflow.com/a/20782984
type: Question
possible better answer: http://stackoverflow.com/a/34190495
answer count: 2
has answer: http://stackoverflow.com/a/34190495
downvote count: 0
has comment: http://stackoverflow.com/comment/31152209
has title: Failure delivering result ResultInfo
has comment: http://stackoverflow.com/comment/31152058
tagged with: nullpointerexception
has body: There are many people who have encountered the same error on stackoverflow, but I haven't been able to find any relevant resolution in those posts. My MainActivity is starting a new activity (SecondActivity) with startActivityForResult(); SecondActivity then returns some data with onBackPressed(); and putExtra(); Extract from MainActivity.java: public void addNewNote(View v){ Intent intent = new Intent(this, SecondActivity.class); intent.putExtra("Source", "NEW"); startActivityForResult(intent, 1); //1 is the result code } protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v("TAG", data.getStringExtra("Note")); if (requestCode == 1) { if(resultCode == RESULT_OK){ listItems.add(data.getStringExtra("Note")); Log.v("TAG", data.getStringExtra("Note")); adapter.notifyDataSetChanged(); listView.invalidateViews(); } if (resultCode == RESULT_CANCELED) { } } } Extract from SecondActivity.java: @Override public void onBackPressed() { super.onBackPressed(); if (mainTextField.getText() != null){ Intent returnIntent = new Intent(); returnIntent.putExtra("Note",mainTextField.getText()); setResult(RESULT_OK, returnIntent); finish(); } else { Intent returnIntent = new Intent(); setResult(RESULT_CANCELED, returnIntent); finish(); } } Logcat:
has comment: http://stackoverflow.com/comment/31152257
accepted answer: http://stackoverflow.com/a/20782984
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/31152182
upvote count: 25
has comment: http://stackoverflow.com/comment/31152297
score: 25
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31152102

http://stackoverflow.com/q/20685276
has comment: http://stackoverflow.com/comment/30976742
has comment: http://stackoverflow.com/comment/30977424
has comment: http://stackoverflow.com/comment/30977152
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has title: "R cannot be resolved to a variable " in android Activity
has answer: http://stackoverflow.com/a/20685317
tagged with: java
has body: i was doing small android application , i added blank xml file but it was showing some error although i did not add any code and still it was showing error so i cleaned project but now after cleaning for my activity when i write setContentView(R.layout.reminder_edit); its giving errors like this R cannot be resolved to a variable , for another activity named ReminderListaActivity i tried this setContentView(R.layout.reminder_edit) error was for xml file not for "R " error was :reminder_edit cannot be resolved or is not a field . xml file is in layout and its showing like never used file so how do i solve this issue , can someone help me with it pleae EDIT code added reminder_edit.xml &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:text="@string/title" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;EditText android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/body" /&gt; &lt;EditText android:id="@+id/body" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minLines="5" android:scrollbars="vertical" android:gravity="top" /&gt; &lt;TextView android:text="@string/date" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;Button android:id="@+id/reminder_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Reminder_Time" /&gt; &lt;TextView android:text="@string/time" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:id="@+id/remindertime" android:layout_width="wrap_content" android:layout_h…
type: Question
score: 0
has comment: http://stackoverflow.com/comment/30977249
has comment: http://stackoverflow.com/comment/30976642
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/20685366
tagged with: android
has answer: http://stackoverflow.com/a/20685338
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/31093106
type: Comment
type: QuestionComment
has text: okay i will try, the class i wrote is of a circular list, when i insert elements into the linked list they are perfectly fine and it also returns the current data, etc. But when the remove method is run and this line is tested "assertTrue(l.getCurrent() == 9);" i get an assertion error.
score: 0
comment on: http://stackoverflow.com/q/20749233

http://stackoverflow.com/comment/66402300
comment on: http://stackoverflow.com/a/20811193
type: Comment
has text: I didn't have to catch a "NoMatchingViewException" but an "AssertionFailedError"
score: 1
type: AnswerComment

http://stackoverflow.com/q/20799178
possible better answer: http://stackoverflow.com/a/37134473
score: 10
tagged with: stream-processing
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20800203
type: AnsweredQuestion
has body: I am using a Java class to submit a topology to a Storm cluster and I also plan to use a Java class to kill the topology. But as per storm documentation, the following command is used to kill a topology and there is no Java method (and this has valid reasons). storm kill {stormname} So is it fine to call a shell script from Java class to kill the topology? What are the other ways to kill topology? Also, how to get the status of running topologies in storm cluster?
has title: How to programmatically kill a Apache Storm topology?
tagged with: java
accepted answer: http://stackoverflow.com/a/20800203
has answer: http://stackoverflow.com/a/37134473
upvote count: 10
tagged with: apache-storm
type: Question

http://stackoverflow.com/q/20702622
upvote count: 2
has title: Ordering a set without duplication in JAVA
favorite count: 0
has answer: http://stackoverflow.com/a/20703236
answer count: 5
type: UnansweredQuestion
score: 2
tagged with: treeset
downvote count: 0
has answer: http://stackoverflow.com/a/20702704
tagged with: java
has answer: http://stackoverflow.com/a/20702779
has answer: http://stackoverflow.com/a/20703024
has answer: http://stackoverflow.com/a/20703029
type: Question
has body: I need to order a set without duplicating it in memory, using a custom comparator. The naive implementation would be: Set&lt;MyClass&gt; newSet = new TreeSet&lt;&gt;(myComparator); newSet.addAll(oldSet); but this would imply that, even for a limited time, I'll have two sets in memory: oldSet (unordered) and newSet(ordered). Since they will be very large, I would like to avoid this. I would like to perform something like this: oldSet = new TreeSet&lt;&gt;(oldSet, myComparator); which actually is not possible, since there is no constructor for TreeSet with such structure. Could this be a solution? Iterator&lt;MyClass&gt; it = oldSet.iterator(); Set&lt;MyClass&gt; newSet = new TreeSet&lt;&gt;(myComparator); while(it.hasNext()) { newSet.add(it.next()); it.remove(); } Something better to suggest? Thank you
has comment: http://stackoverflow.com/comment/31008298

http://stackoverflow.com/q/20795847
tagged with: javascript
tagged with: ajax
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31183058
has title: a4j:commandButton not reached the oncomplete
tagged with: richfaces
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31245306
has comment: http://stackoverflow.com/comment/31245212
tagged with: jsf
tagged with: java
type: Question
has body: I am using Richfaces 3.3.3Final sometimes the a4j:commandButton action are not completed, no more page reRendered. sample codes : &lt;a4j:commandButton image="#{Icon.gotoIcon}" id="gotoLinkId" action="#{Home.gotoLinkAction}" oncomplete="linkExpand('#{Home.id}');" reRender="modalPanel,navigationMenu"/&gt; after the button click action the panelMenuGroup will be automatically expanded, but sometimes page hanged. And also tried to clear the cookies, no effect. &lt;rich:panelMenuGroup id="groupId" label="About" action="#{Home.homeLinkAction}" expandMode="ajax" reRender="navigationMenuId"&gt; &lt;!-- Development --&gt; &lt;rich:panelMenuItem&gt; &lt;a4j:commandLink id="developmentMenuId" value="Development" action="#{Home.developmentMenuAction}" reRender="mainOutputPanelId"&gt; &lt;f:param id="ParamId" name="nameId" value="Development"/&gt; &lt;/a4j:commandLink&gt; &lt;/rich:panelMenuItem&gt; &lt;/rich:panelMenuGroup&gt; Script : function linkExpand(id) { var elementId = "iconNavigationId:"+id; document.getElementById(elementId).click(); } When i try manually expand the panelMenuGroup no more actions should be completed. I got the below exception, Exception : debug[15:47:22,701]: Script evaluation succeeded debug[15:47:22,701]: Evaluate script replaced area in document: error[15:47:22,717]: . Error message: Invalid argument. debug[15:47:22,717]: call selectSingleNode for id= org.ajax4jsf.oncomplete debug[15:47:22,732]: Call request oncomplete function after processing updates debug[15:47:22,748]: call selectSingleNode for id= _ajax:data
has answer: http://stackoverflow.com/a/20797287

http://stackoverflow.com/q/20817409
tagged with: mgwt
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have the following ui binder structure using mgwt 1.2-Snapshot. &lt;mgwt:LayoutPanel&gt; &lt;g:FlowPanel /&gt; &lt;mgwt:LayoutPanel&gt; &lt;b:MyTouchPanel&gt; &lt;g:Label &gt;&lt;/g:Label&gt; &lt;g:Label&gt;&lt;/g:Label&gt; &lt;/b:MyTouchPanel&gt; &lt;/mgwt:LayoutPanel&gt; &lt;b:MyTouchPanel &gt; &lt;mgwt:LayoutPanel ui:field="contentPanel"&gt; &lt;b:MyTouchPanel&gt; &lt;/b:MyTouchPanel&gt; &lt;mgwt:ScrollPanel ui:Field="panel2"&gt; &lt;b:MyTouchPanel &gt;&lt;/b:MyTouchPanel &gt; &lt;/mgwt:ScrollPanel&gt; &lt;/mgwt:LayoutPanel&gt; &lt;/b:MyTouchPanel&gt; &lt;/mgwt:LayoutPanel&gt; The previous one is working fine. I refresh the red marked schrollPanel each time the content changes. My problem is that the following is not working: &lt;mgwt:LayoutPanel&gt; &lt;g:FlowPanel /&gt; &lt;mgwt:LayoutPanel&gt; &lt;b:MyTouchPanel&gt; &lt;g:Label &gt;&lt;/g:Label&gt; &lt;g:Label&gt;&lt;/g:Label&gt; &lt;/b:MyTouchPanel&gt; &lt;/mgwt:LayoutPanel&gt; &lt;b:MyTouchPanel &gt; &lt;mgwt:LayoutPanel ui:field="contentPanel"&gt; &lt;b:MyTouchPanel&gt; &lt;/b:MyTouchPanel&gt; &lt;mgwt:LayoutPanel&gt; &lt;b:MyTouchPanel ui:Field="panel1"&gt;&lt;/b:MyTouchPanel&gt; &lt;mgwt:ScrollPanel ui:Field="panel2"&gt; &lt;b:MyTouchPanel &gt;&lt;/b:MyTouchPanel &gt; &lt;/mgwt:ScrollPanel&gt; &lt;/mgwt:LayoutPanel&gt; &lt;/mgwt:LayoutPanel&gt; &lt;/b:MyTouchPanel&gt; &lt;/mgwt:LayoutPanel&gt; When I wrap the scrollPanel in a LayoutPanel it is not scrollable anymore. I have to do it this way because The red marked pieces are from a new page which are rendered in the overall layout. Since ui binder does not allow more than one root element I have to wrap panel1 and pane2 (the ScrollPanel) in another Panel for which I choose the LayoutPanel. Is there a way to get the ScrollPanel (panel2) work correctly in my case?
tagged with: gwt
tagged with: javascript
has answer: http://stackoverflow.com/a/20828411
accepted answer: http://stackoverflow.com/a/20828411
score: 0
answer count: 1
has title: MGWT ScrollPanel is not scrollable?
tagged with: http://stackoverflow.com/tag/html

logging
tags question: http://stackoverflow.com/q/20723050
tags question: http://stackoverflow.com/q/20778143
tags question: http://stackoverflow.com/q/20795373
tags question: http://stackoverflow.com/q/20801569
tags question: http://stackoverflow.com/q/20801072
tag name: logging
tags question: http://stackoverflow.com/q/20759747
tags question: http://stackoverflow.com/q/20838271
tags question: http://stackoverflow.com/q/20811483
tags question: http://stackoverflow.com/q/20815048
tags question: http://stackoverflow.com/q/20707333
tags question: http://stackoverflow.com/q/20781850
tags question: http://stackoverflow.com/q/20844121
tags question: http://stackoverflow.com/q/20749130
tags question: http://stackoverflow.com/q/20823409
tags question: http://stackoverflow.com/q/20737880
tags question: http://stackoverflow.com/q/20830673
type: Tag

http://stackoverflow.com/a/20834522
type: Answer
score: 2
has body: Why is the game drawing being drawn on top of the input components when the game drawing is being done on the Panel that is in a lower layer in the JLayeredPane? Mostly because you've circumvented how Swing works. Let's start with the fact that the Graphics context is a shared resource (typically there is a single Graphics context per native peer), that is, every component gets the same context, this means, when you use your own painting routine, you are basically painting over every thing else. The RepaintManager is responsible for making decisions about what and when something should be painted. So what you now have is two artist fighting over the same canvas, wanting to paint on it simultaneously, which is just making a mess. Add into the fray that Swing's painting process is not thread safe and you end up with a complete mess. If you absolutely must have control, then you need to remove Swing's painting engine from the equation. Start by taking a look at Passive vs. Active Rendering ps- There is also hard ware acceleration benefits to using a BufferStrategy
has comment: http://stackoverflow.com/comment/31247550
has comment: http://stackoverflow.com/comment/31247722
downvote count: 0
has comment: http://stackoverflow.com/comment/31247617
has comment: http://stackoverflow.com/comment/31247693
has comment: http://stackoverflow.com/comment/31247641
answers question: http://stackoverflow.com/q/20833913
has comment: http://stackoverflow.com/comment/31247643
has comment: http://stackoverflow.com/comment/31247668
upvote count: 2

http://stackoverflow.com/a/20689879
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20689788
has body: Read this page: String API, consider using split() to split the name string. Then reassemble it in the correct format.

http://stackoverflow.com/q/20803334
type: UnansweredQuestion
tagged with: android
has title: Google map not showing and location not detected
has body: I am tryin to make an Android Google map, the map is not showing and a toast with "Cannot determine location" appears which means that the location is not detected (=null) so I have 2 problems : 1- The map not showing 2- Location not detected I have 2 Java files MyMapLocationActivity.java package com.joshclemm.android.tutorial; import android.os.Bundle; import android.widget.Toast; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; public class MyMapLocationActivity extends MapActivity { private MapView mapView; private MyLocationOverlay myLocationOverlay; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // main.xml contains a MapView setContentView(R.layout.main); // extract MapView from layout mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); // create an overlay that shows our current location myLocationOverlay = new FixedMyLocationOverlay(this, mapView); // add this overlay to the MapView and refresh it mapView.getOverlays().add(myLocationOverlay); mapView.postInvalidate(); // call convenience method that zooms map on our location zoomToMyLocation(); } @Override protected void onResume() { super.onResume(); // when our activity resumes, we want to register for location updates myLocationOverlay.enableMyLocation(); } @Override protected void onPause() { super.onPause(); // when our activity pauses, we want to remove listening for location updates myLocationOverlay.disableMyLocation(); } /** * This method zooms to the user's location with a zoom level of 10. */ private void zoomToMyLocation() { GeoPoint myLocationGeoPoint = myLocationOverlay.getMyLocation(); //System.out.println("myLocationGeoPoint is " +myLocationGeoPoint); if(myLocationGeoPoint != null) { System.out.println("Gowa !null"); mapView.getController…
tagged with: java
has answer: http://stackoverflow.com/a/20803762
type: Question
tagged with: google-maps
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/31182981
type: QuestionComment
comment on: http://stackoverflow.com/q/20797281
score: 0
has text: I have edited the question to remove the word "recursive", as there is nothing recursive in the problem or the attempted answers.
type: Comment

http://stackoverflow.com/comment/30973649
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20683397
has text: Not sure, but does: `PropertyConfigurator.configure( new ConfigSlurper().parse( new File('config.groovy').toURL() ).toProperties() )` work?
score: 0

http://stackoverflow.com/a/20757449
answers question: http://stackoverflow.com/q/20757414
has comment: http://stackoverflow.com/comment/31107982
downvote count: 0
has comment: http://stackoverflow.com/comment/31108010
has body: String s = "http:www.abc.com/ABC/ABC-Boots-in-Leather/Prod/product.aspx?iid=34487"; String s1 = s.replaceAll("(/(.)*/)","/"); output: http:www.abc.com/product.aspx?iid=34487
has comment: http://stackoverflow.com/comment/31109078
has comment: http://stackoverflow.com/comment/31108991
type: Answer
has comment: http://stackoverflow.com/comment/31108955
score: 2
upvote count: 2

http://stackoverflow.com/comment/31077597
score: 0
type: AnswerComment
has text: Yep, this is exactly what the example does. What you can't do is update the UI from outside the Event Dispatching Thread
comment on: http://stackoverflow.com/a/20739571
type: Comment

http://stackoverflow.com/comment/31238002
has text: @zero Right, you would have to do some custom configuration with the `RequestMappingHandlerAdapter` bean. I don't think it's worth it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20829342
type: Comment

http://stackoverflow.com/comment/31263568
type: Comment
has text: @HotLicks that's what I was getting at... maybe I could be more clear.
score: 0
comment on: http://stackoverflow.com/q/20843033
type: QuestionComment

http://stackoverflow.com/q/20798435
tagged with: indexing
tagged with: java
has comment: http://stackoverflow.com/comment/31181288
downvote count: 1
has comment: http://stackoverflow.com/comment/31190883
upvote count: 0
type: UnansweredQuestion
has body: I am new to Elasticsearch. I have tried CRUD processes of elasticsearch in Curl Api. But no I want to write my java code which is following: public class App { public static void main(String[] args){ Node node = nodeBuilder().local(true).clusterName("myclustername").node(); Client client = node.client(); try { IndexResponse indexResponse = client .prepareIndex("company", "employee", "367") .setSource( jsonBuilder() .startObject() .field("name", "surendra") .field("address", "kapan") .endObject() ) .execute() .actionGet(); } catch (IOException e) { e.printStackTrace(); } } } The code ran successfully with no error. But when I send Get request it sends IndexMissingException. I have double checked my cluster name. What is wrong here?
has answer: http://stackoverflow.com/a/20833833
has comment: http://stackoverflow.com/comment/31181840
has title: IndexMissingException while creating index in elasticsaerch
favorite count: 0
has comment: http://stackoverflow.com/comment/31181944
type: Question
tagged with: elasticsearch
answer count: 1
score: -1

http://stackoverflow.com/comment/31252592
type: Comment
type: QuestionComment
has text: No easy way out here. You will have write your own parser for wikitext. use javaRegEx or Antlr here.
comment on: http://stackoverflow.com/q/20836597
score: 0

rabbitmq
tags question: http://stackoverflow.com/q/20713229
tag name: rabbitmq
tags question: http://stackoverflow.com/q/20784632
type: Tag
tags question: http://stackoverflow.com/q/20772538
tags question: http://stackoverflow.com/q/20843236

http://stackoverflow.com/q/20720509
type: AnsweredQuestion
score: 1
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/126569587
has answer: http://stackoverflow.com/a/20720800
accepted answer: http://stackoverflow.com/a/20720800
upvote count: 1
type: Question
tagged with: network-programming
has comment: http://stackoverflow.com/comment/31040792
tagged with: udp
has title: What's the easiest way to switch a Java program from UDP to TCP?
answer count: 1
downvote count: 0
has body: I've been given a Java application that uses the java.net.DatagramSocket class, and it uses UDP. I need to switch this to TCP, is there a simple way to do this or do I need to rewrite the whole application? I'm sorry if this is a noobish question, but I'm just starting with networking.
favorite count: 0

http://stackoverflow.com/q/20755246
type: UnansweredQuestion
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/20757250
has title: Selenium Webdriver click not working
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20757454
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31104848
has body: I am trying to use the selenium webdriver to automate my testing I am using selenium 2.39.0 and firefox 26.0 I am tryign a simple example example for a click but its failing The element is selected because a sysout on the selected element text gives "create account".But its not able to click the button WebDriver driver = new FirefoxDriver(); driver.get("http://en.wikipedia.org/wiki/Main_Page"); System.out.println(driver.findElement(By.id("pt-createaccount")).getText()); driver.findElement(By.id("pt-createaccount")).click(); assertEquals("Create account - Wikipedia, the free encyclopedia", driver.getTitle()); driver.quit(); Any help is appreciated Tried all the below things Got a reply from the selenium google group and this worked Please open the system display settings and ensure that font size is set to 100%, see the attached screenshot. https://code.google.com/p/selenium/issues/detail?id=6756
tagged with: selenium-webdriver

http://stackoverflow.com/q/20717897
has body: So, I'm trying to do read-only access of a zip file in Java, decompressing in a multithreaded manner, because my standard simple singly-threaded solution of ZipFile/ZipEntry using the enumeration and inputstreams and what-not results in it taking about five full seconds just to decompress into memory a 50-meg zipfile which takes one second AT MOST for my disk to read without decompressing. However, the entire Java zip library is synchronized to an incredibly-obnoxious degree, no doubt because it's all abstracted for reading/writing/etc. in the same code instead of having nice efficient non-synchronized read-only code. I've looked at third-party Java libraries, and all of them are either massive VFS libraries that are worse than using an elephant gun to shoot a fly, or else the only reason they have a performance benefit is they multithread to the extent that most of the threads are blocking on disk IO anyway. All I want to do is pull a zipfile into a byte[], fork some threads, and work on it. There's no reason any synchronization would be needed in any way for anything, because each of the unzipped files I use separately in memory without interaction. Why must this be so difficult?
favorite count: 0
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/31036442
possible better answer: http://stackoverflow.com/a/20725287
has comment: http://stackoverflow.com/comment/31036517
has answer: http://stackoverflow.com/a/20725287
has comment: http://stackoverflow.com/comment/31036804
has comment: http://stackoverflow.com/comment/31036893
has comment: http://stackoverflow.com/comment/31036471
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/20718935
answer count: 3
has comment: http://stackoverflow.com/comment/31036294
linked to: http://stackoverflow.com/q/4332264
downvote count: 1
has answer: http://stackoverflow.com/a/51255091
tagged with: zlib
accepted answer: http://stackoverflow.com/a/20718935
tagged with: inflate
has comment: http://stackoverflow.com/comment/31036493
has comment: http://stackoverflow.com/comment/31036616
has title: Multithreaded Unzipping In Java
has comment: http://stackoverflow.com/comment/31036231
type: AnsweredQuestion
score: 7
has comment: http://stackoverflow.com/comment/31037106

http://stackoverflow.com/q/20829813
upvote count: 8
has comment: http://stackoverflow.com/comment/31239740
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31239236
has comment: http://stackoverflow.com/comment/31239750
has comment: http://stackoverflow.com/comment/31239263
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/20829893
has comment: http://stackoverflow.com/comment/31239376
tagged with: java
has comment: http://stackoverflow.com/comment/31239785
type: Question
answer count: 2
has body: I've read an extensive amount of documentation about the HotSpot GC of Java SE 6 and 7. When talking about strategies for obtaining contiguous regions of free memory, two 'competing' approaches are presented: that of Evacuation (usually applied on the young gen), where live objects are copied from 'from' to an empty 'to' and that of Compaction (fall-back of CMS), where live object are moved to one side inside a fragmented region to form a contiguous block of used an unused memory. Both approaches are proportional to the size of the 'live set'. The difference is that evacuation requires x2 times space than the live set, where the compaction does not. Why do we need the Evacuation technique at all? The amount of copying that needs to be done is the same, however it requires reservation of more heap size, and it does not allow for faster remapping of references. True: the evacuation can be executed in parallel (where-as compaction cannot, or at least not as easily) but this trait is never mentioned and seems not that important (considering that remapping is much more expensive than moving).
downvote count: 0
has comment: http://stackoverflow.com/comment/31239421
has comment: http://stackoverflow.com/comment/31239537
has comment: http://stackoverflow.com/comment/31239699
has comment: http://stackoverflow.com/comment/31239605
has comment: http://stackoverflow.com/comment/31239672
has comment: http://stackoverflow.com/comment/31239652
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/52689000
has comment: http://stackoverflow.com/comment/31238847
has title: What is the fundamental difference between evacuation and compaction in garbage collection?

http://stackoverflow.com/comment/31238945
type: AnswerComment
comment on: http://stackoverflow.com/a/20829935
has text: @einpoklum No, it's not reasonable to inherit them. They are fully-fledged containers. You should be *using* them, not inheriting from them, just like you wouldn't *inherit* an `ArrayList` in Java.
type: Comment
score: 2

oracle-database
tags question: http://stackoverflow.com/q/20743263
tags question: http://stackoverflow.com/q/20688325
tags question: http://stackoverflow.com/q/20743473
tags question: http://stackoverflow.com/q/20791477
tags question: http://stackoverflow.com/q/20759428
tags question: http://stackoverflow.com/q/20712612
tags question: http://stackoverflow.com/q/20696367
tag name: oracle-database
tags question: http://stackoverflow.com/q/20786404
tags question: http://stackoverflow.com/q/20689326
tags question: http://stackoverflow.com/q/20757011
tags question: http://stackoverflow.com/q/20699182
tags question: http://stackoverflow.com/q/20782867
tags question: http://stackoverflow.com/q/20696227
tags question: http://stackoverflow.com/q/20820193
tags question: http://stackoverflow.com/q/20687051
tags question: http://stackoverflow.com/q/20803756
tags question: http://stackoverflow.com/q/20685192
type: Tag
tags question: http://stackoverflow.com/q/20685677
tags question: http://stackoverflow.com/q/20704684
tags question: http://stackoverflow.com/q/20800879
tags question: http://stackoverflow.com/q/20752544
tags question: http://stackoverflow.com/q/20703676
tags question: http://stackoverflow.com/q/20780883
tags question: http://stackoverflow.com/q/20823864
tags question: http://stackoverflow.com/q/20783350
tags question: http://stackoverflow.com/q/20694250
tags question: http://stackoverflow.com/q/20700058
tags question: http://stackoverflow.com/q/20705807
tags question: http://stackoverflow.com/q/20837508
tags question: http://stackoverflow.com/q/20843263
tags question: http://stackoverflow.com/q/20742794
tags question: http://stackoverflow.com/q/20829495
tags question: http://stackoverflow.com/q/20738634
tags question: http://stackoverflow.com/q/20693535
tags question: http://stackoverflow.com/q/20731470
tags question: http://stackoverflow.com/q/20697825
tags question: http://stackoverflow.com/q/20745010

http://stackoverflow.com/comment/31268155
comment on: http://stackoverflow.com/a/20775039
type: AnswerComment
type: Comment
has text: @George you have the wrong generic declaration. Just add the `@Override` annotation to the reduce method which should result in a compiler error. Your extends should look like `extends Reducer<Text, Text, Text, Text>`
score: 1

http://stackoverflow.com/comment/31244199
score: 1
has text: There are not `static` objects. There are static variables which reference objects.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20832604

http://stackoverflow.com/comment/31131466
comment on: http://stackoverflow.com/a/20770637
has text: thank you very much, i wasn't aware you could use a for statement in any other way than for(;;){} ... i am going to look into this more because i honestly have no clue how this even works lol ... merry christmas!
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/20725265
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40112166
has title: Segmentation fault in Java 3D on Raspberry Pi
type: Question
tagged with: arm
answer count: 2
tagged with: raspberry-pi
downvote count: 0
has comment: http://stackoverflow.com/comment/40180295
has answer: http://stackoverflow.com/a/20725336
has body: I'm trying to run a program using Java 3d on a Raspberry Pi and I'm having some problems with the native libraries. I've found a version compiled for ARM on the debian website here http://packages.debian.org/en/wheezy/armhf/libjava3d-jni/download I've also tried the 'dfsg-9' version. When I try and run the program the following output is printed: java version "1.7.0_40" Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode) A fatal error has been detected by the Java Runtime Environment: SIGILL (0x4) at pc=0xa6e5b9e2, pid=7251, tid=3057575024 JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43) Java VM: Java HotSpot(TM) Client VM (24.0-b56 mixed mode linux-arm ) Problematic frame: C [libj3dcore-ogl.so+0x69e2] Java_javax_media_j3d_NativePipeline_getAWT+0x11 I don't really have any experience debugging problems to do with native code and am hoping for some advice on how to proceed with ths problem. Thanks for reading.
favorite count: 0
has answer: http://stackoverflow.com/a/20727270
accepted answer: http://stackoverflow.com/a/20727270
upvote count: 1
tagged with: java-3d
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40187965
possible better answer: http://stackoverflow.com/a/20725336

collections
tags question: http://stackoverflow.com/q/20701600
tags question: http://stackoverflow.com/q/20685709
tags question: http://stackoverflow.com/q/20758080
tags question: http://stackoverflow.com/q/20784181
tags question: http://stackoverflow.com/q/20817873
tags question: http://stackoverflow.com/q/20833380
tags question: http://stackoverflow.com/q/20717111
tags question: http://stackoverflow.com/q/20730757
tags question: http://stackoverflow.com/q/20848674
tags question: http://stackoverflow.com/q/20772869
tags question: http://stackoverflow.com/q/20801506
tags question: http://stackoverflow.com/q/20801706
tags question: http://stackoverflow.com/q/20836369
tags question: http://stackoverflow.com/q/20825643
tags question: http://stackoverflow.com/q/20770276
tags question: http://stackoverflow.com/q/20738075
type: Tag
tags question: http://stackoverflow.com/q/20704800
tags question: http://stackoverflow.com/q/20755432
tags question: http://stackoverflow.com/q/20805123
tags question: http://stackoverflow.com/q/20749806
tags question: http://stackoverflow.com/q/20803293
tags question: http://stackoverflow.com/q/20820648
tags question: http://stackoverflow.com/q/20684428
tags question: http://stackoverflow.com/q/20814002
tags question: http://stackoverflow.com/q/20748000
tags question: http://stackoverflow.com/q/20825684
tag name: collections
tags question: http://stackoverflow.com/q/20772961
tags question: http://stackoverflow.com/q/20692500
tags question: http://stackoverflow.com/q/20829802
tags question: http://stackoverflow.com/q/20682979
tags question: http://stackoverflow.com/q/20707657
tags question: http://stackoverflow.com/q/20701958
tags question: http://stackoverflow.com/q/20748713
tags question: http://stackoverflow.com/q/20798334

http://stackoverflow.com/a/20814872
answers question: http://stackoverflow.com/q/20814539
has comment: http://stackoverflow.com/comment/31210570
type: Answer
score: 3
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/31210502
has body: Try this code, it is running fine. You may choose any algorithm whether it is SHA/MD5 import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Checksum { public static void main(String ar[]) { File currentJavaJarFile = new File(Checksum.class.getProtectionDomain().getCodeSource().getLocation().getPath()); String filepath = currentJavaJarFile.getAbsolutePath(); StringBuilder sb = new StringBuilder(); try { MessageDigest md = MessageDigest.getInstance("SHA-256");// MD5 FileInputStream fis = new FileInputStream(filepath); byte[] dataBytes = new byte[1024]; int nread = 0; while((nread = fis.read(dataBytes)) != -1) md.update(dataBytes, 0, nread); byte[] mdbytes = md.digest(); for(int i=0; i&lt;mdbytes.length; i++) sb.append(Integer.toString((mdbytes[i] &amp; 0xff) + 0x100 , 16).substring(1)); } catch(NoSuchAlgorithmException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } System.out.println("Checksum: "+sb); } }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20814539

netty
tags question: http://stackoverflow.com/q/20691815
tags question: http://stackoverflow.com/q/20698947
tags question: http://stackoverflow.com/q/20751750
tags question: http://stackoverflow.com/q/20836139
type: Tag
tags question: http://stackoverflow.com/q/20692292
tag name: netty
tags question: http://stackoverflow.com/q/20739903

http://stackoverflow.com/q/20703607
has body: I'm in a dire situation which is summed up by the following code. try { dangerousCode(); // Declares `throws ExecutionException` } catch (ExecutionException ex) { handleIt(); throw ex; } catch (RuntimeException ex) { handleIt(); throw new ExecutionException(ex); } finally { notifyListeners(); // May throw RuntimeException! } I would like to stick to the contract of propagating a potential ExecutionException derived from the dangerous code - explicitly thrown, or wrapping a RuntimeException. However, the listeners in the finally block (which I don't control) may throw another runtime exception. Of course, I would also like to notify the client of this event. The dilemma: I now have two exceptions on hands. I could define my own exception type to wrap both exceptions thrown. class MyExecutionException { Throwable getCause(); Throwable getSecondCause(); } I was just wondering, is there another way around this issue?
accepted answer: http://stackoverflow.com/a/20703713
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31009817
favorite count: 0
has answer: http://stackoverflow.com/a/20703713
upvote count: 2
possible better answer: http://stackoverflow.com/a/20703791
tagged with: exception
has answer: http://stackoverflow.com/a/20703791
type: AnsweredQuestion
score: 2
tagged with: java
has title: Working Around Multiple Exceptions
has comment: http://stackoverflow.com/comment/31009547
has comment: http://stackoverflow.com/comment/31009515
tagged with: try-catch-finally

http://stackoverflow.com/q/20759015
has title: ORMlite + MySQL Foreign Key Binding
accepted answer: http://stackoverflow.com/a/20907485
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
has body: How do I create auto delete cascade using ORMLite? I am using ormlite-core and omlite-jdbc version 4.8. I tried public class Account { // for QueryBuilder to be able to find the fields public static final String NAME_FIELD_NAME = "name"; public static final String PASSWORD_FIELD_NAME = "passwd"; @DatabaseField(generatedId = true) private int id; @DatabaseField(columnName = NAME_FIELD_NAME, canBeNull = false) private String name; @DatabaseField(columnName = PASSWORD_FIELD_NAME) private String password; } and another class @DatabaseTable(tableName = "orders") public class Order { public static final String ACCOUNT_ID_FIELD_NAME = "account_id"; @DatabaseField(generatedId = true) private int id; @DatabaseField(foreign = true, columnName = ACCOUNT_ID_FIELD_NAME, canBeNull = false,index = true, foreignAutoRefresh = true, columnDefinition = "integer references document(id) on delete cascade") private Account account; @DatabaseField private int itemNumber; @DatabaseField private int quantity; @DatabaseField private float price; } But When I delete the parent key record, no exception is being thrown and also, if try to insert records in order table with foreign key values which are not defined in the Account table, no exception is being thrown and the records get created and inserted in database.
tagged with: ormlite
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20907485
tagged with: mysql
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: foreign-key-relationship

http://stackoverflow.com/a/20730722
has comment: http://stackoverflow.com/comment/31064691
downvote count: 0
answers question: http://stackoverflow.com/q/20730680
has body: This is true of any behavior, not just Visitor. You can choose either one, of course. Both work. Sounds like a rehash of the "interface or abstract class?" question. You prefer abstract when there can be meaningful, non-abstract default behavior. Interfaces have no default, so every user is forced to implement the method. No assumptions are possible.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31063811
has comment: http://stackoverflow.com/comment/31059709
score: 1
has comment: http://stackoverflow.com/comment/31062757

http://stackoverflow.com/a/20806304
has body: You could write the method so it accepts an arbitrary number of booleans. If any of the booleans is false, return false; otherwise, return true. public boolean ope(boolean...list) { for (boolean value: list) { if (!value) { return false; } } return true; } Note that this would return true for an empty list. That may or may not be what you want.
score: 2
accepted answer of: http://stackoverflow.com/q/20806267
answers question: http://stackoverflow.com/q/20806267
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/20700750
has comment: http://stackoverflow.com/comment/31004422
has title: How to filter files without extensions using file dialog in Java
has answer: http://stackoverflow.com/a/20703478
has comment: http://stackoverflow.com/comment/31004932
accepted answer: http://stackoverflow.com/a/20703478
score: -3
linked to: http://stackoverflow.com/q/7211107
downvote count: 4
type: AnsweredQuestion
tagged with: java
tagged with: file-browser
tagged with: rcp
type: Question
has comment: http://stackoverflow.com/comment/31004694
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31004351
favorite count: 0
has comment: http://stackoverflow.com/comment/31005704
has body: In my application I need to select files with out file extension using file dialog. Is there a way to achieve this? Please help me to find a solution for this. My current code with out any filter is given below: @Override public void handleEvent(Event event) { FileDialog dialog = new FileDialog(shell, SWT.NONE); String filePath = dialog.open(); if (filePath != null &amp;&amp; !filePath.equals("")) { //Do my Operations } }
has comment: http://stackoverflow.com/comment/31008223

http://stackoverflow.com/a/31127546
type: Answer
upvote count: 6
has body: So far as I can tell, you can't sandbox Nashorn. An untrusted user can execute the "Additional Nashorn Built-In Functions" listed here: https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/shell.html which include "quit()". I tested it; it exits the JVM entirely. (As an aside, in my setup the global objects, $ENV, $ARG, did not work, which is good.) If I'm wrong about this, someone please leave a comment.
has comment: http://stackoverflow.com/comment/55435596
answers question: http://stackoverflow.com/q/20793089
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/73890659

http://stackoverflow.com/a/20948671
answers question: http://stackoverflow.com/q/20841416
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/73486676
downvote count: 0
has body: Replication is configured on a per-bucket basis. If no replicas are configured then when a node goes down the vBucket(s) hosted by that node will be no longer be available, and hence any attempt to perform operations on that data fail as you saw. See the Creating and Editing Data Buckets in the Couchbase Manual for details on configuring replicas (specifically the Replicas section of the "Create Bucket" process and the Failover Nodes section).
accepted answer of: http://stackoverflow.com/q/20841416

http://stackoverflow.com/comment/31248232
type: AnswerComment
type: Comment
has text: i have the toString on my other class. i dont really know whats dictionary enterface. so i need to change my codes for this? i hope ull teach me how.:)
comment on: http://stackoverflow.com/a/20834931
score: 0

http://stackoverflow.com/comment/58998240
score: 0
comment on: http://stackoverflow.com/a/35297893
type: AnswerComment
has text: After further thought, I realized that would still only work for durations up to 24 hours. I've fixed it to allow for more than just 24 hours.
type: Comment

http://stackoverflow.com/q/20680883
has answer: http://stackoverflow.com/a/20688983
accepted answer: http://stackoverflow.com/a/20688983
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I was running the code in lucene 3.5. But,how can run the code in lucene 4.5, public class CustomScoreQuerySample { private Log logger = LogFactory.getLog(CustomScoreQuerySample.class); public static void main(String[] args) throws Exception { CustomScoreQuerySample sample = new CustomScoreQuerySample(); sample.makeIndex(); sample.execute("??"); } private static final String[][] DATAS = { {"??","981"}, {"??","672"}, {"??","521"}, {"??","124"}, {"??","908"}, {"??","652"}, {"??","872"}, {"??","278"}, {"??","485"}, {"??","372"}}; private RAMDirectory dir = new RAMDirectory(); private Analyzer analyzer = new SimpleAnalyzer(); public void makeIndex() throws Exception{ IndexWriter writer = new IndexWriter( dir, analyzer , true, MaxFieldLength.UNLIMITED); try{ for(int i=0;i&lt;DATAS.length;i++){ Document doc = new Document(); doc.add( new Field( "value", DATAS[i][0], Store.YES, Index.NOT_ANALYZED ) ); doc.add( new Field( "count", DATAS[i][1], Store.YES, Index.NOT_ANALYZED ) ); writer.addDocument( doc ); } }finally{ writer.close(); } } public void execute(String value) throws Exception{ IndexSearcher searcher = new IndexSearcher( dir ); try{ search(searcher,value); }finally{ searcher.close(); } } private void search(Searcher searcher,String value) throws Exception{ Query tq = new TermQuery(new Term("value",value)); FloatFieldSource source = new FloatFieldSource("count"); ValueSourceQuery vq = new ValueSourceQuery(source); //FieldScoreQuery vq = new FieldScoreQuery("count",FieldScoreQuery.Type.INT); CustomScoreQuery query = new CustomScoreQuery(tq,vq) { @Override public float customScore(int doc, float subQueryScore, float valSrcScore) { float result = subQueryScore * valSrcScore; System.out.println("doc:"+doc+" / subQueryScore:"+subQueryScore+" / valSrcScore:"+valSrcScore + " / result:"+result); return valSrcScore; } }; query.setStrict(true); TopScoreDocCollector collector = null; collector = TopScoreDocCollector.create(5 * 5, false); searcher.search(query, collector); Scor…
tagged with: java
has comment: http://stackoverflow.com/comment/30997149
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/30973936
has title: How can I make CustomScoreQuery run in lucene version 4.5.
tagged with: lucene
answer count: 1

http://stackoverflow.com/a/20750342
answers question: http://stackoverflow.com/q/20750311
score: 1
downvote count: 0
has body: Outerclass needs to have a reference to the TestClass for this work. So: public class OuterClass { private NastedInterface interfaceToCall; public void classMethod(){ if(SOME_CONDITION){ \\ here I want to call the **callback()** method of **NastedInterface** if(interfaceToCall != null) { interfaceToCall.callback(); } } } public interface NastedInterface { void callback(); } }
type: Answer
upvote count: 1

http://stackoverflow.com/comment/31185189
type: Comment
comment on: http://stackoverflow.com/a/20801154
has text: I recive this response from facebook by fql. The online checher works if i put "data":[{"pic_square":"https:\/\/fbcdn-profile-a.akamaihd.net\/xxx.jpg", "uid":"1020272xxxx852765","name":"Mister X"} but how can extraxt automatically the right informations from the response?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31065232
has text: Are you sure that you cannot extend the binding context of your javascript execution environment?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20705162

http://stackoverflow.com/q/20739029
accepted answer: http://stackoverflow.com/a/20739659
has comment: http://stackoverflow.com/comment/31074751
has comment: http://stackoverflow.com/comment/31075001
has comment: http://stackoverflow.com/comment/31074902
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31074947
tagged with: java
score: -1
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/31074675
answer count: 2
has title: How to draw a circle on an image in android
favorite count: 0
has answer: http://stackoverflow.com/a/20739659
possible better answer: http://stackoverflow.com/a/20739336
has comment: http://stackoverflow.com/comment/31074723
has answer: http://stackoverflow.com/a/20739336
tagged with: android
has body: I loaded an image from drawable resources and I show it on android device's screen. I need to draw a circle on the image and update the place of the circle during times. Can anyone help me to figure the process out. This is my code for loading image which works perfectly: private void createBitMap() { Bitmap bitMap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); //creates bmp bitMap = bitMap.copy(bitMap.getConfig(), true); //lets bmp to be mutable Canvas canvas = new Canvas(bitMap); //draw a canvas in defined bmp Paint paint = new Paint(); //define paint and paint color paint.setColor(Color.RED); paint.setStyle(Style.FILL_AND_STROKE); //paint.setStrokeWidth(0.5f); paint.setAntiAlias(true); //smooth edges ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.setImageBitmap(bitMap); imageView.setImageResource(R.drawable.map); //canvas.drawCircle(50, 50, 3, paint); }
has comment: http://stackoverflow.com/comment/31075026
tagged with: geometry
has comment: http://stackoverflow.com/comment/31075064
downvote count: 2
tagged with: screen
upvote count: 1

http://stackoverflow.com/q/20701094
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/56295014
type: Question
has comment: http://stackoverflow.com/comment/31005168
has comment: http://stackoverflow.com/comment/31005211
has answer: http://stackoverflow.com/a/20701327
possible better answer: http://stackoverflow.com/a/20701445
tagged with: java
has answer: http://stackoverflow.com/a/20701445
accepted answer: http://stackoverflow.com/a/20701327
answer count: 3
has body: I really hope you can help me on this one.... I need to get specific data from my xml file but I am stuck at one point and I can't figure out how to proceed... I want to get from Network: network name; From Codes: the mcc and mnc code; From Settings:name, id, type, parameter name and value; So this is the structure of my xml file: <parameter name="mms-gprs-access-point-name" value="MMS" /> <parameter name="mms-gprs-name" value="MMS" /> <parameter name="mms-gprs-proxy" value="192.168.021.050" /> <parameter name="mms-gprs-proxy-port" value="9201" /> <parameter name="mms-url" value="http://mms.ad/mmsc" /> <parameter name="iap-gprs-access-point-name" value="internet" /> <parameter name="iap-gprs-name" value="Internet" /> <parameter name="iap-gprs-url" value="http://google.com" /> This is what I have so far...... and I really can't proceed any further... I have a null pointer exception at String content = cNode.getLastChild().getTextContent().trim(); and I am not sure that I am doing it the right way..... public void ReadXML() throws ParserConfigurationException, SAXException, IOException { // Get the DOM Builder Factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Get the DOM Builder DocumentBuilder builder = factory.newDocumentBuilder(); // Load and Parse the XML document // document contains the complete XML as a Tree. Document document = builder.parse("D:\\test.xml"); List<Apn> empList = new ArrayList<Apn>(); // Iterating through the nodes and extracting the data. NodeList nodeList = document.getDocumentElement().getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof Element) { //Apn apn = new Apn(); System.out.println(node.getAttributes().getNamedItem("country") .getNodeValue()); NodeList childNodes = node.getChildNodes(); for (int j = 0; j < childNodes.getLength(); j++) { Node cNode = childNodes.item(j); if (cNode instanceof Element) { String content = cNode.getLastChild().get…
has title: Java XML Parsing of complex xml file
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31005484

http://stackoverflow.com/comment/31082840
type: QuestionComment
has text: Your *friend* eh? Does he go by the name of Teacher or Professor per chance?
comment on: http://stackoverflow.com/q/20743120
type: Comment
score: 2

http://stackoverflow.com/comment/31153666
has text: memory efficiency is more relevant about large object, like images. here it really doesn't matter no matter how you look at it - both the types take the same amount of memory.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20782361
type: Comment

http://stackoverflow.com/comment/30986619
type: Comment
type: QuestionComment
has text: @camickr thanks for the clarification... right now my GUI is Frame -> JDesktopPane... then I add my JInternalFrames with... theDesktop.add(minimapFrame, JLayeredPane.DEFAULT_LAYER); Is this an okay strategy?
score: 0
comment on: http://stackoverflow.com/q/20689411

http://stackoverflow.com/comment/31048187
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20724323
score: 0
has text: Hmmmm... why are you using deprecated API in the first place?

http://stackoverflow.com/comment/31114186
has text: Think about what things need to be concurrent. Each concurrent thread represents some entity that will, relatively independently, perform actions. The thread should persist as long as that entity exists as a part of the stated problem, and there should never be multiple threads representing the same entity, nor multiple independent entities represented by the same thread. What are your entities?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20760969

http://stackoverflow.com/q/20783266
has comment: http://stackoverflow.com/comment/114652872
favorite count: 0
has comment: http://stackoverflow.com/comment/94765060
has answer: http://stackoverflow.com/a/55194975
has answer: http://stackoverflow.com/a/23191814
linked to: http://stackoverflow.com/q/12159601
has answer: http://stackoverflow.com/a/44551538
possible better answer: http://stackoverflow.com/a/20783339
linked to: http://stackoverflow.com/q/2400284
score: 155
has answer: http://stackoverflow.com/a/49691732
has comment: http://stackoverflow.com/comment/41427934
has answer: http://stackoverflow.com/a/45216377
has comment: http://stackoverflow.com/comment/98384499
has answer: http://stackoverflow.com/a/20783660
has answer: http://stackoverflow.com/a/48517780
type: AnsweredQuestion
tagged with: overloading
accepted answer: http://stackoverflow.com/a/20783390
has answer: http://stackoverflow.com/a/34477984
has comment: http://stackoverflow.com/comment/98069286
tagged with: oop
downvote count: 0
has body: Can anyone provide a simple example that explains the difference between Dynamic and Static polymorphism in Java?
tagged with: java
has comment: http://stackoverflow.com/comment/98037022
type: Question
has title: What is the difference between dynamic and static polymorphism in Java?
has answer: http://stackoverflow.com/a/20783390
has comment: http://stackoverflow.com/comment/31153228
has answer: http://stackoverflow.com/a/20783339
upvote count: 155
has comment: http://stackoverflow.com/comment/31153150
tagged with: overriding
has comment: http://stackoverflow.com/comment/98299125
answer count: 14
has answer: http://stackoverflow.com/a/46372147
has answer: http://stackoverflow.com/a/60156893
has comment: http://stackoverflow.com/comment/98108700
has answer: http://stackoverflow.com/a/20783410
has answer: http://stackoverflow.com/a/46865936
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/31153076

http://stackoverflow.com/comment/30970420
comment on: http://stackoverflow.com/a/20680595
has text: String name = jso3.getString("Nombre"); String surname = jso3.getString("Apellidos"); int date = jso3.getInt("Año_nacimiento");JSONArray jsa2 = jso3.getJSONArray ("Nombres_Hijos"); jso3.toString(json); These are the troublesome spots.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23596235
type: Answer
has comment: http://stackoverflow.com/comment/68708327
score: 12
has body: Instead of write Numerical number in value of android:layout_marginTop , you can use the height specified by actionBarSize like an Example in Android Training . You can use ?android:attr or ?attr [ in case support library ] If you need to use any android attributes[ attr ] can be found in R.attr For More Description about ?android:attr Question 1 ,Question 2
answers question: http://stackoverflow.com/q/20773307
has comment: http://stackoverflow.com/comment/68680481
has comment: http://stackoverflow.com/comment/68706630
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/68710028

http://stackoverflow.com/a/20780131
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20779704
answers question: http://stackoverflow.com/q/20779704
has body: If you use java jdbc batch update: int x = 1000;//your total records int y = 100;//set of records that need to be updated String sql = "update xxx set xx = ?,yy=? "; Connection dbConnection = null; PreparedStatement preparedStatement = null; try{ dbConnection = getDBConnection(); //get your db connetion preparedStatement = dbConnection.prepareStatement(sql); dbConnection.setAutoCommit(false); for(int i = 1;i &lt; x;i++){ preparedStatement.setInt(1, 101); preparedStatement.setString(2, "zzzz"); preparedStatement.addBatch(); if(i % y == 0){ try{ preparedStatement.executeBatch();// update y records }catch(Exception e){ x -= 100; //if failed ,roll back x } } } preparedStatement.executeBatch(); // update rest of the reords dbConnection.commit(); }catch(Exception e){ } wish can help you!

http://stackoverflow.com/q/20781120
has title: Why hadoop does not recognize my Map class?
has comment: http://stackoverflow.com/comment/38014462
tagged with: java
has body: I am trying to run my PDFWordCount map-reduce program on hadoop 2.2.0 but I get this error: 13/12/25 23:37:26 INFO mapreduce.Job: Task Id : attempt_1388041362368_0003_m_000009_2, Status : FAILED Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class PDFWordCount$MyMap not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1720) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:721) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:339) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157) Caused by: java.lang.ClassNotFoundException: Class PDFWordCount$MyMap not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718) ... 8 more It says that my map class is not known. I have a cluster with a namenod and 2 datanodes on 3 VMs. My main function is this: public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); @SuppressWarnings("deprecation") Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(MyMap.class); job.setReducerClass(MyReduce.class); job.setInputFormatClass(PDFInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setJarByClass(PDFWordCount.class); job.waitForCompletion(true); } If I run my jar using this command: yarn jar myjar.jar PDFWordCount /in /out it takes /in as output path and gives…
has answer: http://stackoverflow.com/a/20784489
tagged with: mapreduce
linked to: http://stackoverflow.com/q/9617420
tagged with: hadoop
tagged with: runtimeexception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31153978
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31307187
has comment: http://stackoverflow.com/comment/38003091
type: Question
has comment: http://stackoverflow.com/comment/38003757
score: 3
accepted answer: http://stackoverflow.com/a/20784489
has comment: http://stackoverflow.com/comment/31153929
has comment: http://stackoverflow.com/comment/31154027
upvote count: 3
has comment: http://stackoverflow.com/comment/38015968
answer count: 1
has comment: http://stackoverflow.com/comment/31265742
has comment: http://stackoverflow.com/comment/38020515

http://stackoverflow.com/comment/31159513
type: QuestionComment
comment on: http://stackoverflow.com/q/20786961
has text: Isn't that a contradiction?
score: 0
type: Comment

http://stackoverflow.com/comment/31150774
score: 0
type: Comment
type: QuestionComment
has text: The effect would probably be negligible. Test it out if you want.
comment on: http://stackoverflow.com/q/20781351

http://stackoverflow.com/q/20778881
has title: Changing values of static class variables in a nested loop
has comment: http://stackoverflow.com/comment/31146098
tagged with: loops
type: Question
possible better answer: http://stackoverflow.com/a/20778944
has answer: http://stackoverflow.com/a/20778944
has answer: http://stackoverflow.com/a/20779906
has answer: http://stackoverflow.com/a/20780297
has answer: http://stackoverflow.com/a/21661257
tagged with: static
has comment: http://stackoverflow.com/comment/31146043
answer count: 4
accepted answer: http://stackoverflow.com/a/21661257
type: AnsweredQuestion
tagged with: object
tagged with: instance
score: 0
has body: I'm having an issue with changing the values of a class variable within nested loops - I can't figure out why. I'm guessing it's because the variable is static. But it's a static method and because it's used for listing a User in a system from a file, it has to be static (I'm calling it from main method to read file to TreeMaps). Is it not possible to rewrite a static class variable from within a method? If it's possible - what the heck am I doing wrong? public class Loan{ protected int noOfLoans; protected int noOfReturns; protected User user=new User(); protected static Book book= new Book(); protected Map &lt;Integer, Book&gt; currentLoans=new TreeMap &lt;Integer, Book&gt;(); protected Map &lt;Integer, Book&gt; returned=new TreeMap &lt;Integer, Book&gt;(); protected static Map&lt;Integer, Loan&gt; loanList=new TreeMap&lt;Integer, Loan&gt;(); public static void main(String[] args){ readLoans(); } public static void readLoans(){ loanList.clear(); BufferedReader reader = null; try { reader=new BufferedReader(new FileReader("loans.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } String line = null; try { line = reader.readLine(); } catch (IOException e) { e.printStackTrace(); } while (line!=null) { String[] splitOut=line.split("-"); String[] loan_User=splitOut[0].split(","); String[] loan_CurrentLoans=splitOut[2].split(","); String[] loan_Returned=splitOut[4].split(","); Loan loan = new Loan(); loan.user.setFirstName(loan_User[0]); loan.user.setSurname(loan_User[1]); loan.user.setPersonalID(loan_User[2]); for (int i = 1; i &lt;= Integer.parseInt(splitOut[1]); i++) { book.setName(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)]); book.setAuthorFirstname(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+1]); book.setAuthorSurname(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+2]); book.setISBN(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+3]); loan.currentLoans.put(i, book); } for (int i = 1; i &lt;= Integer.parseI…
tagged with: java

http://stackoverflow.com/comment/31079501
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20740493
has text: @KumarBibek:I have added the code I have implemented.

http://stackoverflow.com/q/20795421
accepted answer: http://stackoverflow.com/a/20797567
tagged with: struts2-json-plugin
has body: I have in my action class: try{ tspNameIdMap = slsReqMgmtCommonRemote.getTspNameIdMap(Integer.parseInt(circleId)); throw new ReqMgmtException("Message test"); } catch(ReqMgmtException rEx){ addActionError("Action-Error: Request Management Exception thrown"); return ERROR; } I am doing an AJAX call and using Struts2-Json-plugin to get tspNameIdMap in JSON form. JS: Part of AJAX: success: function(data){ alert('Updated DB'); }, error: function(data){ alert(data); } My struts.xml: &lt;action name="findTspNameIdMap" class="cdot.oss.cmsat.gma.struts.ConfigureTspThresholdAction" method="findTspNameIdMap"&gt; &lt;result name="success" type="json"&gt; &lt;param name="root"&gt; tspNameIdMap &lt;!-- tspNameIdMap will be returned in JSON form --&gt; &lt;/param&gt; &lt;/result&gt; &lt;/action&gt; I want my addActionError message in my Ajax error function. I will also want to display it in my JSP then. How can I get this? Ps: Do I have to include this ActionError message in a properties file? I am using it for first time. Help EDIT : As i followed @Prabhakar answer I got the error message, but it got returned in the success of the AJAX call. Another issue is that, when i put this in my JSP, the actionerror is not getting displayed. Jsp: &lt;s:if test="hasActionErrors()"&gt; &lt;s:actionerror /&gt; &lt;/s:if&gt;
has title: Ajax error struts2?
upvote count: 2
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20796174
tagged with: java
has comment: http://stackoverflow.com/comment/31179558
type: Question
answer count: 2
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: struts2
tagged with: ajax
has answer: http://stackoverflow.com/a/20796174
has answer: http://stackoverflow.com/a/20797567

http://stackoverflow.com/a/20810313
answers question: http://stackoverflow.com/q/20804043
score: 0
type: Answer
has body: You can use Openshift cloud host. 1. Create an Openshift account. https://openshift.redhat.com 2. Enable applications you need in your project. (JBOSS , Tomcat , MySQL etc) 3. Install Client tools to enable remote access to the cloud server. Follow steps in below wiki. https://www.openshift.com/developers/rhc-client-tools-install 4. Follow this wiki to create public and private keys. https://www.openshift.com/developers/remote-access 5. Connect to your server and deploy the build.

http://stackoverflow.com/a/20734605
type: Answer
has body: This has already been answered in the comments really :) A String is a collection of Chars. Without Chars you would have nothing to build Strings from. Because Char[] and dealing with Char[] is so important they warrant having their own class to handle the processing of them - hence String. In your coding you are unlikely to use the Char datatype directly unless you are processing Strings or handling passwords. The only reason Char[] is used for passwords is because it's harder to accidentally print them into logs/view them in memory/put them into string caches, etc and because once you have finished with it you can explicitly zero the elements in the Array so it never stays in memory longer than needed.
has comment: http://stackoverflow.com/comment/31067518
type: AcceptedAnswer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31066977
accepted answer of: http://stackoverflow.com/q/20734504
upvote count: 2
answers question: http://stackoverflow.com/q/20734504

http://stackoverflow.com/q/20847144
tagged with: java
has answer: http://stackoverflow.com/a/20847194
type: Question
possible better answer: http://stackoverflow.com/a/20847233
has body: this may be a a silly question, but I'm going through an old exam paper for revision and there is a question. Write appropriate Java calls for the following Methods: (a) public void sendMessage(){} (b) public void mergeWords(String word1, String Word2){} This question is slightly confusing me as i believe a java call to simply be calling the method eg. under the main(String[]args){ sentMessage() } , this would be the method call, and mergeWords(word1,word2){ return word1+word2; } Can I get other opinions on this, please note this is only revision from a past paper.
accepted answer: http://stackoverflow.com/a/20847231
has comment: http://stackoverflow.com/comment/31270793
upvote count: 1
has answer: http://stackoverflow.com/a/20847315
has answer: http://stackoverflow.com/a/20847231
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31271171
has answer: http://stackoverflow.com/a/20847233
has title: What exactly is a java call
has comment: http://stackoverflow.com/comment/31270809
type: AnsweredQuestion
tagged with: call
downvote count: 0
score: 1

http://stackoverflow.com/comment/31130434
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20770045
type: Comment
has text: For better help sooner, post an [SSCCE](http://sscce.org/).

http://stackoverflow.com/q/20684518
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/20740633
has title: Why multiple PropertyPlaceholderConfigurer is not working?
type: Question
has body: I have created applicationContext with two PropertyPlaceholderConfigurer beans and accessing only one based on my input using context object. But, while accessing for the properties from "Service2Record" instance I am getting "Service1Record" properties values. Below is my sample code. ApplicationContext.xml <beans > <context:component-scan base-package="com.test.record" /> classpath:service_1.properties service1.class=com.test.record.ServiceRecord classpath:service_2.properties service2.class=com.test.record.ServiceRecord ServiceRecord Bean : - @Configuration public class ServiceRecord { @Value("${request_queue_name}") private String requestQueueName; @Value("${reply_queue_name}") private String replyQueueName; public String getRequestQueueName() { return requestQueueName; } public String getReplyQueueName() { return replyQueueName; } } Test Main Class - public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "classpath:applicationContext.xml"); ServiceRecord serviceRecord = null; String inputService = "SERVICE2"; if(inputService.equals("SERVICE1")){ serviceRecord = (ServiceRecord)context.getBean("service1record"); } else { serviceRecord = (ServiceRecord)context.getBean("service2record"); } System.out.println(" RequestQueueName : " + serviceRecord.getRequestQueueName()); } And service_1.properties request_queue_name=SERVICE1.REQUEST reply_queue_name=SERVICE1.REPLY service_2.properties request_queue_name=SERVICE2.REQUEST reply_queue_name=SERVICE2.REPLY Here, every time output is "RequestQueueName : SERVICE2.REQUEST". Can you please tell how to get the respective values based on the properties file? Modified - I have single PPHC, within that setting multiple prop files for the location property and multiple propertieArray as below. classpath:common-service.properties classpath:search-service.properties classpath:update-service.properties common.class=com.xyz.rabbitmq.record.CommonUtil search.class=com.xyz.rabbitmq.rec…
accepted answer: http://stackoverflow.com/a/20740633
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/20686150
has answer: http://stackoverflow.com/a/20686150
favorite count: 0
tagged with: spring
tagged with: properties

http://stackoverflow.com/comment/31159437
comment on: http://stackoverflow.com/a/20786794
has text: Right, it should. But does it? Perhaps the commandLink renderer duplicates the algorithm for clientId computation, and wasn't updated to respect prependId. In any case, the best way to discover why nothing is rendered is to set a breakpoint in the renderer, and check the clientId it expects.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31111318
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20754222
has text: Huh? :P You went on vacation between 19 hours ago and now? Enjoy it :)
score: 0

http://stackoverflow.com/comment/31097147
type: Comment
type: QuestionComment
has text: Tks for you reply @TheTerribleSwiftTomato . I've read a little about it. But is this enough? Can I use it as a library in my project and achieve some quality attibutes considered reactive?
comment on: http://stackoverflow.com/q/20751115
score: 0

http://stackoverflow.com/comment/31120510
type: QuestionComment
has text: can you show your code? Do you use a Custom Adapter? How do you populate gridview. not enough code
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20764646

http://stackoverflow.com/comment/31158423
comment on: http://stackoverflow.com/a/20783970
type: AnswerComment
score: 0
has text: No I have not considered the enum approach, thanks it seems very good. Any way not to write overridden method boolean cmp(Font a, Font b) in each enum value.
type: Comment

http://stackoverflow.com/q/20792887
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31170792
has comment: http://stackoverflow.com/comment/31170613
has comment: http://stackoverflow.com/comment/31170601
has answer: http://stackoverflow.com/a/28417952
tagged with: android
has body: I have 7 TextViews and one SeekBar I have the following code which is supposed to change the text color as I move the thumb in the SeekBar: import android.os.Bundle; import android.app.Activity; import android.graphics.Color; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.widget.EditText; import android.widget.NumberPicker; import android.widget.NumberPicker.OnValueChangeListener; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements SeekBar.OnSeekBarChangeListener { SeekBar sbOne, sbTwo; SeekBar sbSyst; TextView tvOne; TextView tvSOne, tvSTwo, tvSThree, tvSFour, tvSFive, tvSSix, tvSSeven; NumberPicker npO, npT; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); sbSyst = (SeekBar) findViewById(R.id.syst_bar); sbSyst.setOnSeekBarChangeListener(this); sbOne = (SeekBar) findViewById(R.id.sb1); sbOne.setOnSeekBarChangeListener(this); sbTwo = (SeekBar) findViewById(R.id.sb2); sbTwo.setOnSeekBarChangeListener(this); tvOne = (TextView) findViewById(R.id.tv1); tvSOne = (TextView) findViewById(R.id.tvFirst); tvSTwo = (TextView) findViewById(R.id.tvSecond); tvSThree = (TextView) findViewById(R.id.tvThird); tvSFour = (TextView) findViewById(R.id.tvFourth); tvSFive = (TextView) findViewById(R.id.tvFifth); tvSSix = (TextView) findViewById(R.id.tvSixth); tvSSeven = (TextView) findViewById(R.id.tvSeventh); /*npO = (NumberPicker) findViewById(R.id.np1); npO.setMinValue(70); npO.setMaxValue(190); npO.setWrapSelectorWheel(true); npO.setOnValueChangedListener(new OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // do something here tvOne.setText(String.valueOf(newVal)); } }); npT = (NumberPicker) findViewById(R.id.np2); npT.setMinValue(40); npT.setMaxValue(100); npT.setWrapSelectorWheel(true);*/ } publ…
has comment: http://stackoverflow.com/comment/31170734
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31170666
tagged with: seekbar
accepted answer: http://stackoverflow.com/a/20792895
has title: Change TextView color when SeekBar passes through value
possible better answer: http://stackoverflow.com/a/28417952
type: Question
has comment: http://stackoverflow.com/comment/31170678
has answer: http://stackoverflow.com/a/20792895

libgdx
tags question: http://stackoverflow.com/q/20685306
tags question: http://stackoverflow.com/q/20823906
tags question: http://stackoverflow.com/q/20731886
tags question: http://stackoverflow.com/q/20692838
tags question: http://stackoverflow.com/q/20761824
tags question: http://stackoverflow.com/q/20792872
tags question: http://stackoverflow.com/q/20693020
tags question: http://stackoverflow.com/q/20735262
tag name: libgdx
tags question: http://stackoverflow.com/q/20731463
tags question: http://stackoverflow.com/q/20765793
tags question: http://stackoverflow.com/q/20681563
tags question: http://stackoverflow.com/q/20777401
tags question: http://stackoverflow.com/q/20774828
tags question: http://stackoverflow.com/q/20796657
tags question: http://stackoverflow.com/q/20758218
type: Tag
tags question: http://stackoverflow.com/q/20848442
tags question: http://stackoverflow.com/q/20721301
tags question: http://stackoverflow.com/q/20796996
tags question: http://stackoverflow.com/q/20830760
tags question: http://stackoverflow.com/q/20712406
tags question: http://stackoverflow.com/q/20699383
tags question: http://stackoverflow.com/q/20845858
tags question: http://stackoverflow.com/q/20778022
tags question: http://stackoverflow.com/q/20834786
tags question: http://stackoverflow.com/q/20784482
tags question: http://stackoverflow.com/q/20765667
tags question: http://stackoverflow.com/q/20735000
tags question: http://stackoverflow.com/q/20786908
tags question: http://stackoverflow.com/q/20752240
tags question: http://stackoverflow.com/q/20767109
tags question: http://stackoverflow.com/q/20755518
tags question: http://stackoverflow.com/q/20786635
tags question: http://stackoverflow.com/q/20768523
tags question: http://stackoverflow.com/q/20801017
tags question: http://stackoverflow.com/q/20793113
tags question: http://stackoverflow.com/q/20696194
tags question: http://stackoverflow.com/q/20776670
tags question: http://stackoverflow.com/q/20798403
tags question: http://stackoverflow.com/q/20750984
tags question: http://stackoverflow.com/q/20696074
tags question: http://stackoverflow.com/q/20705346

http://stackoverflow.com/comment/31170734
has text: there you go, in the xml, you have android:max="120", make it android:max="190"
comment on: http://stackoverflow.com/q/20792887
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31236579
type: QuestionComment
has text: Why not use the Commons method?
comment on: http://stackoverflow.com/q/20782919
score: 2
type: Comment

http://stackoverflow.com/comment/31163197
comment on: http://stackoverflow.com/q/20788447
score: 1
type: QuestionComment
type: Comment
has text: @biip - Google it!! I did, and I found this: http://www.ibm.com/developerworks/opensource/library/os-eclipse-javadebug/

jsp
tags question: http://stackoverflow.com/q/20732398
tags question: http://stackoverflow.com/q/20806460
tags question: http://stackoverflow.com/q/20799512
tags question: http://stackoverflow.com/q/20709655
tags question: http://stackoverflow.com/q/20689865
tags question: http://stackoverflow.com/q/20729940
tags question: http://stackoverflow.com/q/20772405
tags question: http://stackoverflow.com/q/20742666
tags question: http://stackoverflow.com/q/20726920
tags question: http://stackoverflow.com/q/20715181
tags question: http://stackoverflow.com/q/20709045
tags question: http://stackoverflow.com/q/20695817
tags question: http://stackoverflow.com/q/20750938
tags question: http://stackoverflow.com/q/20756970
tags question: http://stackoverflow.com/q/20838507
tags question: http://stackoverflow.com/q/20723351
tags question: http://stackoverflow.com/q/20834394
tags question: http://stackoverflow.com/q/20795421
tags question: http://stackoverflow.com/q/20819753
tags question: http://stackoverflow.com/q/20794756
tags question: http://stackoverflow.com/q/20700297
tags question: http://stackoverflow.com/q/20742749
tags question: http://stackoverflow.com/q/20844472
tags question: http://stackoverflow.com/q/20822987
tags question: http://stackoverflow.com/q/20827284
tags question: http://stackoverflow.com/q/20741752
tags question: http://stackoverflow.com/q/20684428
tags question: http://stackoverflow.com/q/20782867
tags question: http://stackoverflow.com/q/20728953
tags question: http://stackoverflow.com/q/20738911
tags question: http://stackoverflow.com/q/20731491
tags question: http://stackoverflow.com/q/20701199
tags question: http://stackoverflow.com/q/20704498
tags question: http://stackoverflow.com/q/20681530
tags question: http://stackoverflow.com/q/20778968
tags question: http://stackoverflow.com/q/20799801
tags question: http://stackoverflow.com/q/20760928
tags question: http://stackoverflow.com/q/20738796
tags question: http://stackoverflow.com/q/20730967
tags question: http://stackoverflow.com/q/20809264
tags question: http://stackoverflow.com/q/20833761
tags question: http://stackoverflow.com/q/20848291
tags question: http://stackoverflow.com/q/20761864
tags question: http://stackoverflow.com/q/20717425
tags question: http://stackoverflow.com/q/20804927
tags question: http://stackoverflow.com/q/20730971
type: Tag
tags question: http://stackoverflow.com/q/20838386
tags question: http://stackoverflow.com/q/20748391
tags question: http://stackoverflow.com/q/20771268
tags question: http://stackoverflow.com/q/20689800
tags question: http://stackoverflow.com/q/20834999
tags question: http://stackoverflow.com/q/20806092
tags question: http://stackoverflow.com/q/20798570
tags question: http://stackoverflow.com/q/20763515
tags question: http://stackoverflow.com/q/20775350
tags question: http://stackoverflow.com/q/20756418
tags question: http://stackoverflow.com/q/20756247
tags question: http://stackoverflow.com/q/20747647
tags question: http://stackoverflow.com/q/20700038
tags question: http://stackoverflow.com/q/20817250
tags question: http://stackoverflow.com/q/20721576
tags question: http://stackoverflow.com/q/20725308
tags question: http://stackoverflow.com/q/20724707
tags question: http://stackoverflow.com/q/20721541
tags question: http://stackoverflow.com/q/20802349
tags question: http://stackoverflow.com/q/20707373
tags question: http://stackoverflow.com/q/20741883
tag name: jsp
tags question: http://stackoverflow.com/q/20698299
tags question: http://stackoverflow.com/q/20780945
tags question: http://stackoverflow.com/q/20709625
tags question: http://stackoverflow.com/q/20845862
tags question: http://stackoverflow.com/q/20744260
tags question: http://stackoverflow.com/q/20776600
tags question: http://stackoverflow.com/q/20680955
tags question: http://stackoverflow.com/q/20742012
tags question: http://stackoverflow.com/q/20756121
tags question: http://stackoverflow.com/q/20831457
tags question: http://stackoverflow.com/q/20702695

http://stackoverflow.com/q/20741405
has answer: http://stackoverflow.com/a/33107900
linked to: http://stackoverflow.com/q/11021551
favorite count: 0
has answer: http://stackoverflow.com/a/20742168
upvote count: 20
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8472556
tagged with: android
answer count: 4
has comment: http://stackoverflow.com/comment/39619234
has answer: http://stackoverflow.com/a/20745624
downvote count: 0
tagged with: java
has title: javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice Android
has answer: http://stackoverflow.com/a/45028767
tagged with: web-services
has comment: http://stackoverflow.com/comment/50801355
linked to: http://stackoverflow.com/q/30538640
tagged with: https
type: Question
has body: I am calling https webservice and its works fine before, but now when i am trying to call it its give me following errors. Log Errors : 12-23 06:28:11.969: W/System.err(3014): javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x1cc160: I/O error during system call, Connection reset by peer 12-23 06:28:11.979: W/System.err(3014): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method) 12-23 06:28:11.979: W/System.err(3014): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:474) 12-23 06:28:11.979: W/System.err(3014): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.&lt;init&gt;(OpenSSLSocketImpl.java:750) 12-23 06:28:11.979: W/System.err(3014): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:692) 12-23 06:28:11.979: W/System.err(3014): at crittercism.android.aa.getInputStream(Unknown Source) 12-23 06:28:11.979: W/System.err(3014): at org.apache.http.impl.io.SocketInputBuffer.&lt;init&gt;(SocketInputBuffer.java:93) 12-23 06:28:11.979: W/System.err(3014): at org.apache.http.impl.SocketHttpClientConnection.createSessionInputBuffer(SocketHttpClientConnection.java:83) 12-23 06:28:11.979: W/System.err(3014): at org.apache.http.impl.conn.DefaultClientConnection.createSessionInputBuffer(DefaultClientConnection.java:170) 12-23 06:28:11.979: W/System.err(3014): at org.apache.http.impl.SocketHttpClientConnection.bind(SocketHttpClientConnection.java:106) 12-23 06:28:11.979: W/System.err(3014): at org.apache.http.impl.conn.DefaultClientConnection.openCompleted(DefaultClientConnection.java:129) 12-23 06:28:11.979: W/System.err(3014): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:171) 12-23 06:28:11.989: W/System.err(3014): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 12-23 06:28:11.989: W/System.err(3014): at org.apache.http.im…
tagged with: ssl
linked to: http://stackoverflow.com/q/12885247
linked to: http://stackoverflow.com/q/11478814
has comment: http://stackoverflow.com/comment/31078668
score: 20
has comment: http://stackoverflow.com/comment/58659738

http://stackoverflow.com/q/20846802
has comment: http://stackoverflow.com/comment/31272627
has comment: http://stackoverflow.com/comment/31274451
has comment: http://stackoverflow.com/comment/31270309
favorite count: 0
upvote count: 2
has title: How to notify a running thread of a change
tagged with: multithreading
linked to: http://stackoverflow.com/q/13744450
tagged with: design-patterns
has answer: http://stackoverflow.com/a/20849502
possible better answer: http://stackoverflow.com/a/20849216
has comment: http://stackoverflow.com/comment/31272598
has answer: http://stackoverflow.com/a/20849216
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20849504
tagged with: java
has comment: http://stackoverflow.com/comment/31273714
type: Question
has comment: http://stackoverflow.com/comment/31272518
downvote count: 0
has comment: http://stackoverflow.com/comment/31270265
accepted answer: http://stackoverflow.com/a/20849504
has body: I am working on a client/server project which watches a system event in the server and sends a notification change to clients. It consists of a Watcher object which does the watching, and the server object which creates threads for each client connecting to it. Considering the simplified code below (I included all of the necessary code) Now, the problem is that the notification is received from the mySrv object and the propertyChange of mySrv is executed properly and disMsg is populated. However, I don't know how to reach the run method of the ClientHandler to execute the notifyStatusChange() to send out the change to clients. I tried joining threads and many different things but none worked. I would really appreciate if someone knows a better approach or point me to my mistakes and best practices perhaps) or show me specifically how to achieve that. Thanks, class MyServer implements PropertyChangeListener { // all the fields and imports are removed for the sake of brevity public class ClientHandler implements Runnable { BufferedReader reader; Socket socket; InputStreamReader iReader; public ClientHandler(Socket ClientSocket) { try { socket = ClientSocket; iReader = new InputStreamReader(socket.getInputStream()); reader = new BufferedReader(iReader); } catch (Exception ex) { ex.printStackTrace(); } } public void run() { String clientMessage; try { while (true) { if (((clientMessage = reader.readLine()) != null)) { System.out.println("Client: " + clientMessage); } if (isChanged) { System.out.println("Server1: " + dispMsg); notifyStatusChange(); isChanged = false; } } } catch (IOException ex) { Logger.getLogger(MyServer.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(MyServer.class.getName()).log(Level.SEVERE, null, ex); } } } public void goServer() { try { ss = new ServerSocket(1234); while (true) { s = ss.accept(); PrintWriter writer = new PrintWriter(s.getOutputStream(), true); Thread t = new Thread(new ClientHandl…
answer count: 3

http://stackoverflow.com/comment/30984824
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20686869
has text: @user3117785 pls check the edited post and if it helps mark the answer as accepted by clicking on the tick next to the answer once
type: AnswerComment

http://stackoverflow.com/q/20818230
has answer: http://stackoverflow.com/a/20818761
favorite count: 0
has body: I am a beginner in learning image processing and I am a bit confused with the concept of spatial and temporal characterization. So, for Spatial characterization, is it like a 2D map which contains some statistical information about the map? And in terms of the temporal characterization, is the value with respect to time? What does it mean and why do we care? Thanks!
tagged with: python
upvote count: 13
accepted answer: http://stackoverflow.com/a/20818761
score: 13
tagged with: matlab
type: Question
type: AnsweredQuestion
has title: what's the difference between spatial and temporal characterization in terms of image processing?
tagged with: java
tagged with: image-processing
tagged with: image
possible better answer: http://stackoverflow.com/a/33393680
has answer: http://stackoverflow.com/a/33393680
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/70253700

http://stackoverflow.com/comment/30987052
comment on: http://stackoverflow.com/q/20690359
score: 0
type: Comment
type: QuestionComment
has text: @Stopforgettingmyaccounts...: _All_ arrays are created using `new`. There is no such thing as a "normal" array.

http://stackoverflow.com/q/20765700
has body: I have a long list of compiled classes in java. I want to use them in my project. How to add all those classes in jar file? Or maybe there is possibility to get java sourse files from compiled java class files? I find I can generate jar using: jar cf jarname input-files And as I understand instaed of input-filesI need to specafy the whole list of my compiled classes. But it would be very uncomfortable. I have near 50 classes.
has comment: http://stackoverflow.com/comment/31122499
possible better answer: http://stackoverflow.com/a/20766126
has answer: http://stackoverflow.com/a/20766126
favorite count: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31122377
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20766259
has title: java: how to include long list of compiled class files to jar
type: Question
answer count: 2
tagged with: jar
has comment: http://stackoverflow.com/comment/31123256
score: 0
accepted answer: http://stackoverflow.com/a/20766259

http://stackoverflow.com/q/20711084
has comment: http://stackoverflow.com/comment/31023554
has body: I'm wondering whether it's a good practice to produce the code which being used like this: new TemplateProcessor(inputStream).processTemplate("output-path.xhtml"); Here, TemplateProcessor contains only one public method. It seems the code above can be expressed with a static method, but I would like to avoid that. The reason is simple: object may contain encapsulated state, (maybe now, maybe in the future). Dear experts what would You prefer in this case?
type: AnsweredQuestion
tagged with: object
tagged with: oop
downvote count: 0
has comment: http://stackoverflow.com/comment/31023712
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/31023675
favorite count: 0
has title: Is this appropriate to create a class with one method?
type: Question
has comment: http://stackoverflow.com/comment/31023499
has comment: http://stackoverflow.com/comment/31023520
answer count: 2
accepted answer: http://stackoverflow.com/a/20711289
tagged with: class
possible better answer: http://stackoverflow.com/a/20711205
tagged with: static
has comment: http://stackoverflow.com/comment/31023498
has answer: http://stackoverflow.com/a/20711205
upvote count: 7
has answer: http://stackoverflow.com/a/20711289

http://stackoverflow.com/q/20817822
tagged with: java
has answer: http://stackoverflow.com/a/20818514
tagged with: intellij-idea
downvote count: 0
type: UnansweredQuestion
has title: Create a live template for Java in Intellij
favorite count: 0
type: Question
has body: I would like to create a template to automatically make my Javadoc documentation when I create a method. For example if I create a method: protected User createUser_1P(String uname, String[] stocks) throws ElementAlreadyExists { ... return u; } I would like the template to generate something like this: /* * @param uname user name * @param stocks list of stocks * @return User * @throws ElementAlreadyExists */ Any help will be apreciated. Thanks
score: 1
tagged with: templates
upvote count: 1
answer count: 1

http://stackoverflow.com/q/20778231
answer count: 1
type: UnansweredQuestion
tagged with: android-xml
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/20778583
type: Question
linked to: http://stackoverflow.com/q/20913058
has title: Unable To Increase UrlImageView Size! (Android)
tagged with: android-layout
has body: I have a customized imageWiew (UrlImageView) which is a thumbnail which is being pulled from YouTube via JSON. It's acting VERY unusual though... I'm familiar with the usual culprits - not setting an android:scaleType (fillXY or centerCrop) or perhaps forgetting match_parent - however I've tried many combinations of of these. Nothing seems to make the thumbnail in the app larger. This lead me to think... hmmm - perhaps I'm getting a tiny thumbnail from YouTube! Nope... It's using and returning hqdefault: http://img.youtube.com/vi/jXE6G9CYcJs/hqdefault.jpg I've really been struggling with this for a while and I think I need to figure out a way to control/modify/tweak whatever layout or layout parameter is shown here with the layout framework developer option turned on: I'm thinking it's either: A. An incorrect combination of layout_width and layout_height parameters (perhaps a parent affecting a child in a manner I'm unaware of) B. A conflict between java and XML parameters C. Something obvious (which I accidentally overlooked) D. A modification or difference between my source and the sourced I used as an example to build what I have (the entire package is available at this link - it should be helpful if someone wants to download it and nail it down quickly) http://blog.blundell-apps.com/show-youtube-user-videos-in-a-listview/ E. Something abnormal/unusual (I'm doing most of testing on a device with a 5 inch screen - it's a Star N920e [strange - eh? I know... but the development has to be done on this device. I'll try any solutions in the emulator to avoid any twilight zone issues - but I just want to be clear that's what I did most of my testing on thus far - which may have been a mistake. Given that - feel free to suggest and vote on your favorite responses - let's see what floats to the top on this one!]) P.S. Pardon the debatably long post - I think I have parent/child issues going on plus the tutorial uses 2 xml files to instantiate everything so I included that…
score: 0

datetime
tags question: http://stackoverflow.com/q/20819872
tags question: http://stackoverflow.com/q/20733472
tags question: http://stackoverflow.com/q/20806032
tags question: http://stackoverflow.com/q/20733014
tags question: http://stackoverflow.com/q/20741426
tags question: http://stackoverflow.com/q/20816701
tags question: http://stackoverflow.com/q/20750097
tag name: datetime
tags question: http://stackoverflow.com/q/20790546
tags question: http://stackoverflow.com/q/20786418
tags question: http://stackoverflow.com/q/20755666
type: Tag
tags question: http://stackoverflow.com/q/20736336

http://stackoverflow.com/comment/31235602
comment on: http://stackoverflow.com/a/20827496
score: 0
type: AnswerComment
type: Comment
has text: hmmm I cant seem to get this to work - it just delays it initally - for whatever interval - and then just goes really quickly afterwards.

http://stackoverflow.com/comment/31103112
comment on: http://stackoverflow.com/a/20754609
score: 1
has text: @peeskillet You can use `Character[][]`
type: AnswerComment
type: Comment

jdwp
tags question: http://stackoverflow.com/q/20751958
type: Tag
tag name: jdwp

http://stackoverflow.com/q/20833673
answer count: 3
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20833879
favorite count: 0
possible better answer: http://stackoverflow.com/a/20833758
has answer: http://stackoverflow.com/a/20833816
tagged with: sms
has comment: http://stackoverflow.com/comment/31246144
accepted answer: http://stackoverflow.com/a/20833816
tagged with: android
has comment: http://stackoverflow.com/comment/31246138
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm making an android application. in IncomingSMS.java there's this string called the senderNum. senderNum is generated when a message is received and senderNum string is the sender of the message. i want to call senderNum to another class. it is said that i need to return the value of the string. but i don't know how. Shown below are part of the codes. CODE: IncomingSMS.java public class IncomingSms extends BroadcastReceiver { private static final byte TARGET_PIN_2 = 0x2; private String message = ""; private static boolean ledstate = false; // Get the object of SmsManager final SmsManager sms = SmsManager.getDefault(); public void onReceive(Context context, Intent intent) { // Retrieves a map of extended data from the intent. final Bundle bundle = intent.getExtras(); try { if (bundle != null) { final Object[] pdusObj = (Object[]) bundle.get("pdus"); for (int i = 0; i &lt; pdusObj.length; i++) { SmsMessage currentMessage = SmsMessage .createFromPdu((byte[]) pdusObj[i]); String phoneNumber = currentMessage .getDisplayOriginatingAddress(); String senderNum = phoneNumber; message = currentMessage.getDisplayMessageBody(); Log.i("SmsReceiver", "senderNum: " + senderNum + "; message: " + message); int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, "senderNum: "+ senderNum + ", message: " + message, duration); toast.show(); // call led here toggleLed(); } // end for loop } // bundle is null } catch (Exception e) { Log.e("SmsReceiver", "Exception smsReceiver" + e); } }[/CODE] below is the class where i want to call the senderNum string: MainActivity.java public void sendLOCKED() { SmsManager smsManager = SmsManager.getDefault(); // i want to call the senderNum below smsManager.sendTextMessage("senderNum", null, "LOCKED", null, null); } public void sendUNLOCKED() { SmsManager smsManager = SmsManager.getDefault(); // i want to call the senderNum below smsManager.sendTextMessage("senderNum", null, "UNLOCKED", null, null); }
has comment: http://stackoverflow.com/comment/31246141
type: Question
has comment: http://stackoverflow.com/comment/31246123
has answer: http://stackoverflow.com/a/20833758
has title: How to call a string from another class

http://stackoverflow.com/comment/31158819
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20785977
has text: Did you try using relative path instead of absolute path ? Show Below: xmlhttp.open("POST", "http://localhost:8080/TestJSF/" + servlet + "?fileType="+fileType , true);

http://stackoverflow.com/a/20737928
type: Answer
has body: try this int j = 10; for (int i = 1; i &lt;= 10; i++) { if(i&lt;10) System.out.print(" " +i); if(i==10){ i--; System.out.print(" " +j); if(j==1){ i++; } j--; } } OutPut 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1
answers question: http://stackoverflow.com/q/20737798
score: 0

http://stackoverflow.com/q/20703222
type: Question
tagged with: c#
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20703533
tagged with: java
tagged with: xamarin.android
score: -1
upvote count: 0
has title: Equivalent of C# InvokeMapType in Java?
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20703533
tagged with: android
tagged with: xamarin
has body: I am currently converting a C# Xamarin project but cannot find the equivalent of the following in Java for Android? Does anyone have any ideas? GoogleMapOptions mapOptions = new GoogleMapOptions() .InvokeMapType(GoogleMap.MapTypeSatellite) .InvokeZoomControlsEnabled(false) .InvokeCompassEnabled(true);
downvote count: 1

http://stackoverflow.com/comment/31160854
type: QuestionComment
comment on: http://stackoverflow.com/q/20780649
score: 0
has text: for the "No EntityManager bound" problem, you could use a plugin where you instantiate an EntityManager and expose it as service. -Don't forget to load the plugin before play-authenticate plugin.
type: Comment

http://stackoverflow.com/q/20733787
score: 0
tagged with: java
answer count: 1
has body: I'm trying to create a Java program that uses a Cassandra database. I'm 'trying' to use Hector client but when I run I'm getting some errors. I have searched on the internet but could find a fix that worked for me (it's probably something obvious). Libs I included in my build path: hector libthrift-0.9.1 slf4j-simple-1.75 Errors im getting: [main] INFO me.prettyprint.cassandra.connection.CassandraHostRetryService - Downed Host Retry service started with queue size -1 and retry delay 10s [main] INFO me.prettyprint.cassandra.service.JmxMonitor - Registering JMX me.prettyprint.cassandra.service_Test Cluster:ServiceType=hector,MonitorType=hector Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cassandra/thrift/InvalidRequestException at me.prettyprint.cassandra.connection.factory.HThriftClientFactoryImpl.createClient(HThriftClientFactoryImpl.java:42) at me.prettyprint.cassandra.connection.ConcurrentHClientPool.createClient(ConcurrentHClientPool.java:179) at me.prettyprint.cassandra.connection.ConcurrentHClientPool.&lt;init&gt;(ConcurrentHClientPool.java:61) at me.prettyprint.cassandra.connection.RoundRobinBalancingPolicy.createConnection(RoundRobinBalancingPolicy.java:68) at me.prettyprint.cassandra.connection.HConnectionManager.&lt;init&gt;(HConnectionManager.java:56) at me.prettyprint.cassandra.service.AbstractCluster.&lt;init&gt;(AbstractCluster.java:67) at me.prettyprint.cassandra.service.ThriftCluster.&lt;init&gt;(ThriftCluster.java:21) at me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:197) at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:144) at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:133) at org.codox.lobbyserver.data.CassandraAccess.test(CassandraAccess.java:39) at org.codox.lobbyserver.Server.main(Server.java:22) Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.thrift.InvalidRequestException at java.net.URLClassLoader$1.run(Unknown Sou…
has answer: http://stackoverflow.com/a/20733823
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20733823
tagged with: cassandra
type: Question
has title: Errors when trying to get a connection to cassandra
tagged with: hector

http://stackoverflow.com/comment/31052056
type: QuestionComment
has text: Sorry for some reason the full class wasnt coppied over. I have `package parsewebpage; import org.jsoup.Jsoup; import org.jsoup.helper.Validate; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException;` At the top of the class, not sure why that didnt get coppied over on the initial post
comment on: http://stackoverflow.com/q/20726365
score: 0
type: Comment

http://stackoverflow.com/comment/31264302
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20843815
has text: @Mohsen Thank You so Much!! JesperBangsholt I just have basic idea about StringTokenizer and wasn't understanding this part(i had seen this in some program). BUt thanks!! :)
score: 0

http://stackoverflow.com/q/20753873
has title: Menu Button Won't Work?
tagged with: mouselistener
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/31106383
has body: I have a menu button that is supposed to transition into the game state once you click on it, but it won't work. Here is my MouseInput class. Ignore all of the methods except for the MousePressed method. package com.game.src.main; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class MouseInput implements MouseListener { @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent e) { int mx = e.getX(); int my = e.getY(); /** public Rectangle playButton = new Rectangle(Game.WIDTH/2 + 120, 150, 100, 50); public Rectangle helpButton = new Rectangle(Game.WIDTH/2 + 120, 250, 100, 50); public Rectangle quitButton = new Rectangle(Game.WIDTH/2 + 120, 350, 100, 50); */ if (mx &gt;= Game.WIDTH/2 + 120 &amp;&amp; mx &lt;= Game.WIDTH/2 + 220) { if (my &gt;= 150 &amp;&amp; mx &lt;= 200) Game.State = Game.STATE.GAME; } } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } } Here is the init method, which is part of the Game class. I bolded and italicized the line of code where I supposedly use the addMouseListener method to enable the mouse functionality (but clearly it doesn't work). public static enum STATE { MENU, GAME }; public static STATE State = STATE.MENU; public void init() { requestFocus(); BufferedImageLoader loader = new BufferedImageLoader(); try { spriteSheet = loader.loadImage("/spritesheettemplate.png"); background = loader.loadImage("/bkg.png"); } catch(IOException e) { e.printStackTrace(); } addKeyListener(new KeyInput(this)); ***addMouseListener(new MouseInput());*** tex = new Textures(this); p = new Player(WIDTH/2*SCALE - 16, HEIGHT/2*SCALE - 16, tex); c = new Controller(this, tex); menu = new Menu(); eA = c.getEntityA(); eB = c.getEntityB(); c.addEnemy(enemy…
type: Question
has comment: http://stackoverflow.com/comment/31105022
score: 0
answer count: 1
tagged with: awt
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20757452

background
tags question: http://stackoverflow.com/q/20814756
tag name: background
type: Tag
tags question: http://stackoverflow.com/q/20715602
tags question: http://stackoverflow.com/q/20687056

http://stackoverflow.com/q/20781934
tagged with: war
has comment: http://stackoverflow.com/comment/31154997
has title: Programatically stopping a servlet in Tomcat
tagged with: java
has answer: http://stackoverflow.com/a/20781949
has body: I wish to stop/prevent the deployment of my WAR if certain properties are missing from my Properties file. I have implemented a ServletContextListener class and in it's contextInitialized method, I need to be sure that a couple of properties are defined before any operations are carried out on my servlet. In other words, I don't want Tomcat to deploy the WAR at all. Is this possible? Is this advisable?
type: Question
has comment: http://stackoverflow.com/comment/31176185
answer count: 1
tagged with: tomcat
tagged with: servlets
has comment: http://stackoverflow.com/comment/31178634
has comment: http://stackoverflow.com/comment/31175383
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/20782919
downvote count: 0
type: UnansweredQuestion
tagged with: java
has title: Does guava have a method to generate random strings?
type: Question
score: 15
has comment: http://stackoverflow.com/comment/31162841
has comment: http://stackoverflow.com/comment/31236579
tagged with: random
answer count: 1
favorite count: 0
upvote count: 15
has answer: http://stackoverflow.com/a/20828660
has body: Apache Commons has a method to generate random string RandomStringUtils.randomAlphanumeric(10) Does guava hava a similar method?
tagged with: guava

http://stackoverflow.com/comment/31137318
comment on: http://stackoverflow.com/a/20774205
score: 0
type: Comment
has text: Yes, starting value is 0, I only set it to 1 looking for the error. And testing and testing I forgot set it to 0 again. Thankyou and Happy Christmas!
type: AnswerComment

http://stackoverflow.com/comment/31305161
score: 0
type: Comment
has text: What a great example!
comment on: http://stackoverflow.com/a/20865041
type: AnswerComment

http://stackoverflow.com/a/20688038
has body: Create a main method inside GRectExample class, for examle import acm.graphics.*; import acm.program.*; import java.awt.*; public class GRectExample extends GraphicsProgram { public void run() { GRect rect = new GRect(100, 50, 125, 60); rect.setFilled(true); rect.setColor(Color.RED); add(rect); } public static void main(String args[]) { new GRectExample().run(); } }
score: 1
has comment: http://stackoverflow.com/comment/30983505
upvote count: 1
answers question: http://stackoverflow.com/q/20687958
has comment: http://stackoverflow.com/comment/30982196
type: Answer
has comment: http://stackoverflow.com/comment/30982118
downvote count: 0

http://stackoverflow.com/q/20705527
tagged with: python
tagged with: z3
tagged with: java
has answer: http://stackoverflow.com/a/21167480
tagged with: eclipse
type: Question
has body: I am trying to using Z3 (http://z3.codeplex.com/) within Eclipse IDE. I installed PyDev and downloaded the Z3's pre-compiled Windows binaries. I also added the "bin" subdirectory to the environment variables PYTHONPATH and PATH. In this very simple example, from z3 import * x = Real('x') y = Real('y') s = Solver() s.add(x + y &gt; 5, x &gt; 1, y &gt; 1) print s.check() print s.model() Eclipse says that Real e Solver are undefined variables. Running this code I got this error msg: "ImportError: Bad magic number in ...\bin\z3.pyc" It seems that this is a problem of different version of python (usually later) than the interpreter (see: What&#39;s the bad magic number error?). Any help? Do I need to compile and install Z3Py rather than using the pre-compiled Windows binaries? Thanks.
linked to: http://stackoverflow.com/q/14854956
has comment: http://stackoverflow.com/comment/31796242
score: 0
has title: Z3 and Eclipse IDE
answer count: 1
has comment: http://stackoverflow.com/comment/31039803
tagged with: theorem
type: UnansweredQuestion

http://stackoverflow.com/a/20802471
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20802316
has comment: http://stackoverflow.com/comment/31187551
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31187642
has comment: http://stackoverflow.com/comment/31187522
has comment: http://stackoverflow.com/comment/31199627
has comment: http://stackoverflow.com/comment/31187609
has comment: http://stackoverflow.com/comment/31187595
answers question: http://stackoverflow.com/q/20802316
has comment: http://stackoverflow.com/comment/31187902
has body: There is no possibility to access the data directly, but you can use (in general): Object[] o = new Object[adapter.getCount()]; for (int i = 0; i &lt; adapter.getCount(); i++) { o[i] = adapter.getItem(i); } to create a copy of your Adapter data. If you want just to extract specific values use: String[] hospFields = new String[adapter.getCount()]; for (int i = 0; i &lt; adapter.getCount(); i++) { HashMap&lt;String, String&gt; rowData = adapter.getItem(i); //gets HashMap of a specific row String name = rowData.get("name"); //gets the field name of that row hospFields[i] = name; // copies field into your array }
has comment: http://stackoverflow.com/comment/31190368

http://stackoverflow.com/q/20706726
has title: JList putting text into specific textfields based on how many are clicked
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20707093
has body: I'm currently creating a soundboard application where the person is going to click one of the items in my JList and its going to set the name of the next available text field as what was just clicked then i'm going to add buttons later. For example, if my first click is the 2nd item in the JList it will go into the first JTextfield and my second click will go into the second JTextfield. The program will have around 100 items in the JList by the time the app is done. Also there is a problem that when the top one and a different JList item is clicked the top one will display first. Not necessarily a problem if I can get the problem fully functional but it makes it feel a little wonky. package com.leagueoflegends.soundboard; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; public class Soundboard implements ListSelectionListener { static JList&lt;Object&gt; list; String[] text = { "hello", "testing1", "testing2" }; Icon icon; JLabel pictureLabel; JPanel insidePanel; JTextField inlineText; JTextField field[] = new JTextField[6]; public Soundboard() { JFrame f = new JFrame("soundboard!"); JPanel masterPanel = new JPanel(new BorderLayout()); //icon = new ImageIcon(getClass().getResource("Tray.png")); //pictureLabel = new JLabel(icon); list = new JList&lt;Object&gt;(text); // data has type Object[] list.setSelectionModel(new DefaultListSelectionModel(){ public void setSelectionInterval(int index0, int index1){ if(super.isSelectedIndex(index0)){ super.removeSelectionInterval(index0,index1); }else{ super.addSelectionInterval(index0,index1); } } }); list.setLayoutOrientation(JList.VERTICAL_WRAP); list.setVisibleRowCount(-1); list.addListSelectionListener(this); JScrollPane listScroller = new JScrollPane(list); listScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); listScroller.setPrefer…
type: UnansweredQuestion
tagged with: jlist
tagged with: onclick
tagged with: java
tagged with: swing
type: Question
tagged with: jpanel

http://stackoverflow.com/comment/31154496
score: 0
has text: What is supposed to be updated in `<h:outputText id="mon" value="#{newRecord.totalSun}" />` if nothing is changed when `blur` event happens?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20782958

http://stackoverflow.com/q/20751185
has comment: http://stackoverflow.com/comment/31096895
has comment: http://stackoverflow.com/comment/31097213
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/31097427
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31097103
tagged with: swing
tagged with: uimanager
has title: Set ComboBoxUI for all JComboBoxes
type: Question
has body: Hi I want to change look for all ComboBoxes in my app. MyComboBox class: class MyComboBoxUI extends BasicComboBoxUI { public static ComponentUI createUI(JComponent c) { return new MyComboBoxUI(); } protected JButton createArrowButton() { JButton button = new BasicArrowButton(BasicArrowButton.EAST); return button; } } And i call it like this: UIManager.put("ComboBoxUI", "MyComboBoxUI"); It produces this error: UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JComboBox When i use: someComboBox.setUI((ComboBoxUI) MyComboBoxUI.createUI(someComboBox)); It works like a charm
has comment: http://stackoverflow.com/comment/31097182
has comment: http://stackoverflow.com/comment/31097056
has comment: http://stackoverflow.com/comment/31097214
score: 0

illegalaccessexception
tags question: http://stackoverflow.com/q/20775826
tag name: illegalaccessexception
tags question: http://stackoverflow.com/q/20803032
type: Tag

http://stackoverflow.com/a/20768674
score: 8
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/20768653
downvote count: 0
has body: "I want to restrict the JTextField deg to only integers." Try this. Use a Document Filter ((AbstractDocument) deg.getDocument()).setDocumentFilter(new DocumentFilter() { Pattern regEx = Pattern.compile("\\d+"); @Override public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { Matcher matcher = regEx.matcher(text); if (!matcher.matches()) { return; } super.replace(fb, offset, length, text, attrs); } });

http://stackoverflow.com/q/20810210
linked to: http://stackoverflow.com/q/17728710
has comment: http://stackoverflow.com/comment/31201974
has comment: http://stackoverflow.com/comment/31201951
has title: Java Thread Safety of Initialized Objects
linked to: http://stackoverflow.com/q/6457109
downvote count: 0
has comment: http://stackoverflow.com/comment/31201923
possible better answer: http://stackoverflow.com/a/20815174
favorite count: 0
has answer: http://stackoverflow.com/a/20815174
has comment: http://stackoverflow.com/comment/31201957
linked to: http://stackoverflow.com/q/10528572
has body: Consider the following class: public class MyClass { private MyObject obj; public MyClass() { obj = new MyObject(); } public void methodCalledByOtherThreads() { obj.doStuff(); } } Since obj was created on one thread and accessed from another, could obj be null when methodCalledByOtherThread is called? If so, would declaring obj as volatile be the best way to fix this issue? Would declaring obj as final make any difference? Edit: For clarity, I think my main question is: Can other threads see that obj has been initialized by some main thread or could obj be stale (null)?
has comment: http://stackoverflow.com/comment/31201959
has answer: http://stackoverflow.com/a/68203641
has comment: http://stackoverflow.com/comment/31201921
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20810284
tagged with: java
has comment: http://stackoverflow.com/comment/31201979
type: Question
has answer: http://stackoverflow.com/a/20827477
tagged with: thread-safety
answer count: 6
score: 4
tagged with: concurrency
upvote count: 4
accepted answer: http://stackoverflow.com/a/20810284
has answer: http://stackoverflow.com/a/20810285
has comment: http://stackoverflow.com/comment/31202002
has answer: http://stackoverflow.com/a/20810320

http://stackoverflow.com/q/20757011
tagged with: java
has answer: http://stackoverflow.com/a/20757588
type: Question
score: 0
answer count: 1
has title: Ibatis out params from stored procedure in Oracle 11g
tagged with: ibatis
type: UnansweredQuestion
tagged with: oracle-database
has body: I have a stored procedure which has three out params all user defined types. I use ibatis as ORM from java code to call the stored procedure. How do i configure this stored procedure call in ibatis xml and how do I get the results back in my java code. procedure test( p_a in int default 0 , p_b in number default 0, p_criteria out TBL_A, p_baseline out TBL_B, p_results out TBL_C); Any help would be highly appreciated. thanks, gagan suri

http://stackoverflow.com/q/20761020
has comment: http://stackoverflow.com/comment/31114057
has answer: http://stackoverflow.com/a/20761253
has comment: http://stackoverflow.com/comment/31113826
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2659253
has answer: http://stackoverflow.com/a/20761112
has body: I want to SELECT the last row in a MySQL table. I don't have any auto increment key in that table. public String getLastLeaveId() { try { Statement stmt = getConnection(); String sql="select leaveID from applied leave"; // here I want some logic that will fetch only leave_id from last row only stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); } return null; } //Table Structure ---&gt; (leave_id varchar(50) primary key,emp_id varchar(40),birthday varchar(20),anniv varchar(20),rh varchar(200),total int,foriegn key(emp_id) reference employee);
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/31113866
has title: How can I SELECT the last row in a MySQL table ? I don't have any auto increment key
has comment: http://stackoverflow.com/comment/31116064
has answer: http://stackoverflow.com/a/20761046
score: 0
has comment: http://stackoverflow.com/comment/31113902
has answer: http://stackoverflow.com/a/20761119
answer count: 5
has comment: http://stackoverflow.com/comment/31113803
has answer: http://stackoverflow.com/a/20761345
has comment: http://stackoverflow.com/comment/31113907

http://stackoverflow.com/comment/31121588
comment on: http://stackoverflow.com/q/20764923
score: 0
type: QuestionComment
type: Comment
has text: Wait. What do you mean by "The main server thread work, he is dooing an job in one of that timers"? The main server thread must only listen for connection and create thread childs and assign them the connection. NOTHING else, or the server will appear busy (as it does).

tabs
tags question: http://stackoverflow.com/q/20799024
type: Tag
tags question: http://stackoverflow.com/q/20769425
tags question: http://stackoverflow.com/q/20768467
tags question: http://stackoverflow.com/q/20826227
tags question: http://stackoverflow.com/q/20800801
tags question: http://stackoverflow.com/q/20719244
tags question: http://stackoverflow.com/q/20811206
tag name: tabs
tags question: http://stackoverflow.com/q/20740226

http://stackoverflow.com/comment/31229395
has text: I wish I could, but everytime I implement code in that section, I get an error. for example: `t=(TextView)findViewById(R.id.resulttext); t.setText(responseString);` returns: The method findViewById(int) is undefined for the type RequestTask
score: 0
comment on: http://stackoverflow.com/q/20824892
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20720762
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20716424
score: 1
answers question: http://stackoverflow.com/q/20716424
has body: The program can run without the error but It doesn't show the column name. The column names are only displayed when you add the table to a JScrollPane. So somewhere in your code you need something like: JTable table = new JTable(...); JScrollPane scrollPane = new JScrollPane( table ); panel.add( scrollPane ); For a complete working example you can use the Table From Database Example found in Table From Database.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31074723
has text: Thanks kelmer for your comment. If I do so, Nothing will happened more than the map loaded. actually commenting or uncommenting result the same.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20739029

http://stackoverflow.com/a/20769211
has comment: http://stackoverflow.com/comment/31129301
answers question: http://stackoverflow.com/q/20768766
has comment: http://stackoverflow.com/comment/31130258
has comment: http://stackoverflow.com/comment/31130312
type: Answer
has body: @Override// This must be in above in your fragment implementing class public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle saedInstanceState) { View rootView = inflater.inflate(R.layout.gallery_layout, parent, false); GridView gridView = (GridView) rootView.findViewById(R.id.photos); // Instance of ImageAdapter Class gridView.setAdapter(new ImageAdapter(getActivity())); gridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { // Sending image id to FullScreenActivity Intent i = new Intent(getActivity(), FullImageActivity.class); // passing array index i.putExtra("id", position); startActivity(i); } } ); } return rootView; } Remove this from your code : @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } //setContentView(R.layout.gallery_layout); This is also not a good approach you should put your fragment code after activity has been created. Inside this method: @Override public void onActivityCreated(Bundle savedInstanceState) {
has comment: http://stackoverflow.com/comment/31130279
has comment: http://stackoverflow.com/comment/31129775
has comment: http://stackoverflow.com/comment/31130216
score: 0

http://stackoverflow.com/comment/31273021
has text: @programmer, `i don't have access to the JList object but only to the DefaultListModel,` - then change your code so that you do have access to the JList. Either you make the JList an instance variable or you can always pass in the JList as a parameter when you create your custom ListSelectionListener.
comment on: http://stackoverflow.com/a/20847304
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20707373
has comment: http://stackoverflow.com/comment/31016451
tagged with: java
tagged with: javascript
type: Question
score: 0
answer count: 1
tagged with: jsp
has body: I use Spring MVC 3 in my project. This is my AddressController : @Controller public class AddressController { private static Logger logger = Logger.getLogger(AddressController.class); @RequestMapping(value="/address",method=RequestMethod.GET) public ModelAndView init( @RequestParam(value="language",required=false,defaultValue="fr") String language){ Locale locale = new Locale(language); logger.info("here"); String[] isoCountries = locale.getISOCountries(); Map&lt;String,String&gt; treeMap = new TreeMap&lt;String,String&gt;(); for(String isoCountry : isoCountries){ Locale countryLoc = new Locale(language, isoCountry); String name = countryLoc.getDisplayCountry(locale); if(!"".equals(name)){ treeMap.put(name,name); } } Map&lt;String,String&gt; tree = new TreeMap&lt;String,String&gt;(treeMap); ModelAndView modelAndView = new ModelAndView("address"); modelAndView.addObject("address",new Address()); modelAndView.addObject("countriesList", tree); return modelAndView; } } The first time, when I executed /address, it's going well to my controller and it returns my address.jsp by executing the javascript in this last one. But when I execute /address?language=fr or /address?language=en, the javascript code of my address.jsp is not executed. This is a part of my address.jsp : &lt;%@page import="org.springframework.context.i18n.LocaleContextHolder"%&gt; &lt;%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %&gt; &lt;%@ taglib prefix="forms" uri="http://www.springframework.org/tags/form" %&gt; &lt;%@page import="com.application.myGoogleAppEngine.Internationale"%&gt; &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ page import="java.util.Locale" %&gt; &lt;%@ page import="java.util.List" %&gt; &lt;%@ page import="java.util.ArrayList" %&gt; &lt;%@ page import="java.util.Collections" %&gt; &lt;html&gt; &lt;head&gt; &lt;jsp:include page="ressources.jsp"&gt;&lt;/jsp:include&gt; &lt;link rel="stylesheet" typ…
has answer: http://stackoverflow.com/a/20707514
has title: spring doesn't execute javascript
tagged with: spring
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31023975
has comment: http://stackoverflow.com/comment/31016469

http://stackoverflow.com/q/20743990
favorite count: 0
has title: how to change List view for Parse JSONarray inside JSONarray in android? changes in list view
tagged with: android
tagged with: parsing
has body: I recently asked the question regarding android Json error No value for variation_id? so i am using the answer of that in this example but here i am unable to parse images because. in the example images are not the array. they are in JSONObject.. so i am parsing them in like JSONObject il = vo.getJSONObject("flag"); map.put("flag", il.optString("flag")); But i have this in inside a array.. so i am parsing this like JSONArray flag = c.getJSONArray("flag "); for(int s=0;s&lt;flag .length();s++) { System.out.println("URL"+flag .getString(s)); } Till here Imageloader.java file is also clear.. as it is avaliable here But Before that its entering into ListViewAdapter.java you can see the entire source code(imageloader,ListviewAdaper) at here SO at the List view Image is declaring as an object like intent.putExtra("flag", resultp.get(MainActivity.FLAG)); // Start SingleItemView Class context.startActivity(intent); SO i want it for a JSONARRAY i am unable to reach please help..
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31083411
has comment: http://stackoverflow.com/comment/31083267
type: Question
downvote count: 0
tagged with: url

http://stackoverflow.com/comment/52285607
type: Comment
comment on: http://stackoverflow.com/a/20727916
type: AnswerComment
score: 0
has text: @kylejmcintyre: Yes, the "custom query parts" link is what I meant by doing this via a `CustomTable`. It's still a bit verbose but it'll do what you want

http://stackoverflow.com/comment/31165125
type: Comment
comment on: http://stackoverflow.com/q/20789906
score: 0
type: QuestionComment
has text: How? I've trimmed as much white as I can off the picture so it is just a square. Please note all I have to edit with is Paint.

http://stackoverflow.com/a/20845424
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31271660
has comment: http://stackoverflow.com/comment/31271562
type: Answer
has comment: http://stackoverflow.com/comment/31270278
has body: You have a local variable called y and a class variable with the same name y. That seems to be the problem. You are using the local y but you meant to use the class y, I think. OK, your code had lots of problems. Here is the fixed version. public class AssignGrades { private int[] y; public AssignGrades(int[] num1) { y = num1; } // method to set grades void setGrades() { for (int i = 0; i &lt; y.length; i++) { // assign grades if (y[i] &lt; 50) System.out.println("FAIL" + y[i]); else if (y[i] &lt; 60) System.out.println("grade is C" + y[i]); else if (y[i] &lt; 70) System.out.println("grade is B" + y[i]); else if (y[i] &lt; 80) { System.out.println("grade is A" + y[i]); } } } // method to show student grades void showGrades() { for (int u : y){ System.out.println(u); } } } import java.util.Scanner; public class AssignGradesDemo { public static void main(String[] args) { int t = 0; System.out.println("enter no of students"); Scanner input = new Scanner(System.in); t = input.nextInt(); int[] num1 = new int[t]; System.out.println("enter grades"); for (int i = 0; i &lt; num1.length; i++) { num1[i] = input.nextInt(); } input.close(); AssignGrades ag = new AssignGrades(num1); ag.setGrades(); ag.showGrades(); } }
accepted answer of: http://stackoverflow.com/q/20845388
has comment: http://stackoverflow.com/comment/31269135
upvote count: 3
has comment: http://stackoverflow.com/comment/31270183
has comment: http://stackoverflow.com/comment/31272438
has comment: http://stackoverflow.com/comment/31271859
answers question: http://stackoverflow.com/q/20845388
has comment: http://stackoverflow.com/comment/31269009
score: 3
has comment: http://stackoverflow.com/comment/31270644

http://stackoverflow.com/a/20732637
upvote count: 5
score: 4
has comment: http://stackoverflow.com/comment/55366016
has comment: http://stackoverflow.com/comment/31064964
has comment: http://stackoverflow.com/comment/31063724
type: Answer
answers question: http://stackoverflow.com/q/20732282
downvote count: 1
has body: You should retrieve an OAuthAppId from facebook. To do this, create an App on Facebook Developers and click "Create new app". Fill in the form, then copy paste the AppId and Appsecret from the page that appears in your code. Example: confBuilder.setOAuthAppId("YOUR APPID HERE"); confBuilder.setOAuthAppSecret("YOUR APPSECRET HERE"); To get the AccessToken, you have to build a login flow as described here

http://stackoverflow.com/a/20770842
has body: OK, Its working: right click on project - > properties - > edit\create new - > arguments -> add the javaagent line.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20764468
score: 1
upvote count: 1

c3p0
tags question: http://stackoverflow.com/q/20799988
tags question: http://stackoverflow.com/q/20755264
tag name: c3p0
type: Tag
tags question: http://stackoverflow.com/q/20716017

http://stackoverflow.com/a/20744530
answers question: http://stackoverflow.com/q/20744459
score: 4
type: Answer
upvote count: 4
has body: I tried Using ICUJ library but It only works for input stream. You can get the byte array from the ByteArrayOutputStream, and then wrap it in a ByteArrayInputStream ... and pass that to the ICUJ method. (Bear in mind that there is a chance that ICUJ will intuit the wrong encoding. Or that the bytes might not represent text in any known encoding.)
downvote count: 0

http://stackoverflow.com/a/20732466
answers question: http://stackoverflow.com/q/20731869
type: Answer
score: 2
downvote count: 0
has body: Are cookies instantiated via an Http(s)UrlConnection then available system wide? No. They are as wide as one running instance of JVM. And the most common model is that each application runs in its own JVM so they don't share the cookies this way.
upvote count: 2

input
tags question: http://stackoverflow.com/q/20827284
tags question: http://stackoverflow.com/q/20723340
tags question: http://stackoverflow.com/q/20780471
tags question: http://stackoverflow.com/q/20721961
tags question: http://stackoverflow.com/q/20687441
tags question: http://stackoverflow.com/q/20723422
tag name: input
type: Tag
tags question: http://stackoverflow.com/q/20830637

http://stackoverflow.com/q/20819226
type: AnsweredQuestion
has title: How to correctly read and write data using JakeWharton's DiskLruCache?
tagged with: java
linked to: http://stackoverflow.com/q/16054007
type: Question
upvote count: 4
has body: I'm trying to use Jake Wharton's DiskLruCache in my Android app, but I can't seem to figure out how to properly serialize and deserialize objects using the cache. Using the following code in a basic command line Java program: DiskLruCache.Editor editor = null; try { editor = diskLruCache.edit("objects"); OutputStream timeOs = editor.newOutputStream(0); OutputStream dataOs = editor.newOutputStream(1); OutputStream timeBos = new BufferedOutputStream(timeOs); OutputStream dataBos = new BufferedOutputStream(dataOs); ObjectOutputStream timeOos = new ObjectOutputStream(timeBos); ObjectOutputStream dataOos = new ObjectOutputStream(dataBos); long createTime = System.currentTimeMillis(); String str = "testString"; ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("item1"); list.add("item2"); timeOos.writeLong(createTime); // this works: dataOos.writeObject(str); // this does not work: //dataOos.writeObject(list); timeOos.close(); dataOos.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (editor != null) try { editor.commit(); } catch (IOException e) { e.printStackTrace(); } } timeOos.writeLong(createTime) and dataOos.writeObject(str) successfully write data to the cache, but replacing dataOos.writeObject(str) with dataOos.writeObject(list) does not work. I have tried ArrayLists and HashMaps, and it appears that these are not serialized and written to the cache. The program executes all of the code, then hangs for around a minute before returning, leaving only the journal file in the cache directory. I'm not sure if this would be an issue with DiskLruCache being unable to handle container objects. The full source and original post can be found here EDIT (2014-01-03): Here's a JUnit test using the Android SDK. testStoreLong(), testStoreString(), and testStoreArrayList() pass but testPersistArrayListSnapshot() and testPersistArrayListEditor() fail. It's a strange issue; if I put a breakpoint at line 101 (editor.commit();) then step over…
answer count: 2
has answer: http://stackoverflow.com/a/20923255
downvote count: 0
score: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/20861214
has answer: http://stackoverflow.com/a/20861214
tagged with: android
accepted answer: http://stackoverflow.com/a/20923255

http://stackoverflow.com/comment/31197641
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20807647
has text: Thank you and I know that but the way I hack kind off limits my ability to make it look pretty.
score: 0

http://stackoverflow.com/q/20751958
accepted answer: http://stackoverflow.com/a/20752951
tagged with: weblogic-10.x
upvote count: 2
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
tagged with: debugging
tagged with: weblogic
has answer: http://stackoverflow.com/a/20752951
downvote count: 0
has answer: http://stackoverflow.com/a/21114061
has title: Enabling debugging for a Node in Weblogic Cluster
tagged with: jdwp
possible better answer: http://stackoverflow.com/a/20843858
has answer: http://stackoverflow.com/a/20843858
has answer: http://stackoverflow.com/a/27526404
favorite count: 0
has body: I have a Weblogic (10.3.5) AdminServer instance and two nodes running as a part of the cluster. I followed the instructions on this page and added a setting in startweblogic.cmd to enable debugging at port 4000. All is fine and I'm able to connect to this port to debug. But when I fire up a node in the cluster using the following command, I get an error saying that 4000 is used up. Here is the command I use to start the node and the error I get c:\Oracle\Middleware\user_projects\domains\base_domain\bin\startManagedWebLogic.cmd server1 http://adminServer_host_name:7001 starting weblogic with Java version: java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b50) Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode) Starting WLS with line: C:\Oracle\MIDDLE~1\JDK160~1\bin\java -client -Xms256m -Xmx512m -XX:CompileThre shold=8000 -XX:PermSize=1028m -XX:MaxPermSize=1024m -Dweblogic.Name=myhealth1 - Djava.security.policy=C:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.policy - Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n - Xverify:none -da -Dplatform.home=C:\Oracle\MIDDLE~1\WLSERV~1.3 -Dwls.home=C:\Or acle\MIDDLE~1\WLSERV~1.3\server -Dweblogic.home=C:\Oracle\MIDDLE~1\WLSERV~1.3\se rver -Dweblogic.management.discover=false -Dweblogic.management.server=http:// DJX09cs1.co.ihc.com:7001 -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw .logErrorsToConsole=false -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1035\p rofiles\default\sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp360\profil es\default\sysext_manifest_classpath -Dweblogic.management.username=weblogic -Dw eblogic.management.password=weblogic1 weblogic.Server ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../. ./../src/share/back/debugInit.c:690] FATAL ERROR in native method: JDWP No…

http://stackoverflow.com/q/20806617
type: UnansweredQuestion
tagged with: http-redirect
has comment: http://stackoverflow.com/comment/31196476
has comment: http://stackoverflow.com/comment/31197648
linked to: http://stackoverflow.com/q/14951696
has answer: http://stackoverflow.com/a/61576515
tagged with: java
has comment: http://stackoverflow.com/comment/31197033
has answer: http://stackoverflow.com/a/20806961
type: Question
has answer: http://stackoverflow.com/a/20807481
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31196596
has comment: http://stackoverflow.com/comment/31199337
has comment: http://stackoverflow.com/comment/31200357
has title: Retrieve the final location of a given URL in Java
linked to: http://stackoverflow.com/q/1884230
has body: I am trying to retrieve the final location of a given URL (String ref) as follows: HttpURLConnection con = (HttpURLConnection)new URL(ref).openConnection(); con.setInstanceFollowRedirects(true); con.setRequestProperty("User-Agent",""); int responseCode = con.getResponseCode(); return con.getURL().toString(); It works in most cases, but rarely returns a URL which yet contains another redirection. What am I doing wrong here? Why do I get responseCode = 3xx, even after calling setInstanceFollowRedirects(true)? UPDATE: OK, responseCode can sometimes be 3xx. If it happens, then I will return con.getHeaderField("Location") instead. The code now is: HttpURLConnection con = (HttpURLConnection)new URL(ref).openConnection(); con.setInstanceFollowRedirects(true); con.setRequestProperty("User-Agent",""); int responseType = con.getResponseCode()/100; while (responseType == 1) { Thread.sleep(10); responseType = con.getResponseCode()/100; } if (responseType == 3) return con.getHeaderField("Location"); return con.getURL().toString(); Will appreciate comment should anyone see anything wrong with the code above. UPDATE Removed the handling of code 1xx, as according to most commenters it is not necessary. Testing if the Location header exists before returning it, in order to handle code 304. HttpURLConnection con = (HttpURLConnection)new URL(ref).openConnection(); con.setInstanceFollowRedirects(true); con.setRequestProperty("User-Agent",""); if (con.getResponseCode()/100 == 3) { String target = con.getHeaderField("Location"); if (target != null) return target; } return con.getURL().toString();
tagged with: httpurlconnection
favorite count: 0
has answer: http://stackoverflow.com/a/20825803
has comment: http://stackoverflow.com/comment/31196923
has answer: http://stackoverflow.com/a/20807538
answer count: 5

http://stackoverflow.com/a/20775806
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20775604
upvote count: 1
has body: You are calling the Activity's findViewById, you should have more luck by calling Menu findItem. public boolean onPrepareOptionsMenu(Menu menu) { MenuItem myMenuItem = menu.findItem(R.id.myMenuItemId); myMenuItem.setIcon(R.drawable.ic_myAction); return true; }
answers question: http://stackoverflow.com/q/20775604
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/20746040
downvote count: 0
upvote count: 39
has body: You opened a lot of connections and that's the issue. I think in your code, you did not close the opened connection. A database bounce could temporarily solve, but will re-appear when you do consecutive execution. Also, it should be verified the number of concurrent connections to the database. If maximum DB processes parameter has been reached this is a common symptom. Courtesy of this thread: https://community.oracle.com/thread/362226?tstart=-1
type: AcceptedAnswer
score: 39
accepted answer of: http://stackoverflow.com/q/20742794
has comment: http://stackoverflow.com/comment/94464293
type: Answer
answers question: http://stackoverflow.com/q/20742794

http://stackoverflow.com/a/20780297
type: Answer
answers question: http://stackoverflow.com/q/20778881
has comment: http://stackoverflow.com/comment/31330185
has comment: http://stackoverflow.com/comment/31158684
has body: it's just Reference problem. All three are referring to same object static book so represent the same details which are inserted last. The change is only create new object of Book() instead of using same object for different detail. try below code Loan loan = new Loan(); loan.user.setFirstName(loan_User[0]); loan.user.setSurname(loan_User[1]); loan.user.setPersonalID(loan_User[2]); for (int i = 1; i &lt;= Integer.parseInt(splitOut[1]); i++) { book = new Book(); // added this line book.setName(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)]); book.setAuthorFirstname(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+1]); book.setAuthorSurname(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+2]); book.setISBN(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+3]); loan.currentLoans.put(i, book); } for (int i = 1; i &lt;= Integer.parseInt(splitOut[3]); i++) { book = new Book(); // added this line book.setName(loan_Returned[((Integer.parseInt (splitOut[3])-1)*4)]); book.setAuthorFirstname(loan_Returned[((Integer.parseInt (splitOut[3])-1)*4)+1]);
score: 0

http://stackoverflow.com/comment/31171167
score: 1
comment on: http://stackoverflow.com/a/20792633
type: AnswerComment
has text: @SotiriosDelimanolis Ok that's right it depends on the point of view
type: Comment

http://stackoverflow.com/q/20782815
tagged with: command-pattern
has answer: http://stackoverflow.com/a/20782923
tagged with: refactoring
tagged with: java
linked to: http://stackoverflow.com/q/437093
accepted answer: http://stackoverflow.com/a/20782923
type: Question
upvote count: 4
score: 4
tagged with: optimization
has answer: http://stackoverflow.com/a/20782932
has answer: http://stackoverflow.com/a/20783970
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31152835
possible better answer: http://stackoverflow.com/a/20783970
has title: Long list of if comparisons in java
has answer: http://stackoverflow.com/a/20782955
tagged with: design-patterns
answer count: 4
has body: I need to compare two Objects. If there is a difference I need to log it corresponding to particular difference and return the true. For example: private boolean compTwoObjects(Object objA, Object ObjB) { if(objA.getType() != objB.getType()) { logTheDifference("getType is differing"); return true; } . . . // Now this could invoke other composite methods if(checkFont(objA.getFont(), objB.getFont()) { logTheDifference("Font is differing"); return true; } } private boolean checkFont(Font fontObjA, Font fontObjB) { if(fontObjA.getBold() != fontObjB.getBold()) { logTheDifference("font bold formatting differs"); return true; } . . . if(fontObjA.getAllCaps() != fontObjB.getAllCaps()) { logTheDifference("font all caps formatting differs"); return true; } . . . if(checkBorderDiff(fontObjA.getBorder(), fontObjB.getBorder())) { logTheDifference("border diff"); return true; } } private boolean checkBorderDiff(Border borderObjA, Border borderObjB) { if (borderObjA.getColor() != null || borderObjB.getColor() != null) { if (!borderObjA.getColor().equals(borderObjB.getColor())) { logIt("border color differing"); return true; } } if (borderObjA.getDistanceFromText() != borderObjB.getDistanceFromText()) { logIt("distance of the border from text or from the page edge in points differing"); return true; } if (borderObjA.isVisible() != borderObjB.isVisible()) { logIt("border visibility differing"); return true; } if (borderObjA.getLineStyle() != borderObjB.getLineStyle()) { logIt("line style differing for border"); return true; } if (borderObjA.getLineWidth() != borderObjB.getLineWidth()) { logIt("border width in points differing"); return true; } if (borderObjA.getShadow() != borderObjB.getShadow()) { logIt("border shadow differing"); return true; } } //And it is going like this. My problem is I want to avoid multiple if statements in the methods. Also I want to log the messages corresponding to particular difference. I have read few similar type of problems on stackoverflow solved eit…
type: AnsweredQuestion

http://stackoverflow.com/comment/31051706
has text: Thanks friend. i changed the code as u said for encrypted string it is giving this exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
type: Comment
comment on: http://stackoverflow.com/a/20726101
score: 0
type: AnswerComment

http://stackoverflow.com/a/28745618
answers question: http://stackoverflow.com/q/20713699
type: Answer
score: 0
has body: If you're using one of ReadMessage overloads inside custom encoder, for example public override Message ReadMessage(ArraySegment&lt;byte&gt; buffer, BufferManager bufferManager, string contentType) and you return decrypted message in an expected format, for example you re-create it using return Message.CreateMessage(MessageVersion.Soap11, String.Empty, XElement.Parse(plainTextData)); you should set AsymmetricSecurityBindingElement.EnableUnsecuredResponse to true, it is used exactly to allow encrypted request and decrypted (plaint text) response, important thing is there are no security headers in a returned response (which is how the new response is created in a code example above).

http://stackoverflow.com/comment/31120796
comment on: http://stackoverflow.com/q/20764682
score: 0
type: QuestionComment
type: Comment
has text: That being said, when I double to original file size to say 6000 pixels wide, it greatly increases the resize time...to around 13 seconds, which would be unacceptable. So the trick will be determining the best max resolution.

http://stackoverflow.com/q/20765332
has comment: http://stackoverflow.com/comment/31122657
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31122471
score: 0
has comment: http://stackoverflow.com/comment/31122150
has comment: http://stackoverflow.com/comment/31122347
answer count: 1
has body: EDIT - I fixed it while I was waiting for this to be answered. I will leave this here for others who will run into thsi problem. The problem was that the image i was loading was 1280 x 100, and that was not a proper aspect ratio, so when I changed it to 1280 x 720, it fixed itself. When I render the ground-layer quad, it draws a textured line above it. It is the only one of my textures that does that. And I even checked if maybe I drew an extra line in PAINT.NET but no, it looks normal outside the game. //Ground GL11.glPushMatrix(); Color.white.bind(); TextureBuffer.Level_TutorialGround.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(-100, 650); GL11.glTexCoord2f(1, 0); GL11.glVertex2f(1950, 650); GL11.glTexCoord2f(1, 1); GL11.glVertex2f(1950, 500); GL11.glTexCoord2f(0, 1); GL11.glVertex2f(-100, 500); GL11.glEnd(); GL11.glPopMatrix(); That is my rendering code, in case it matters. And a weird thing is that when I first placed the quad in the scene it looked fine, but after I re-positioned it via Hot Code swap(Debug mode in eclipse) it added the line. EDIT: My texture loading stuff: (I removed the other texture's loading stuff for the sake of space) public static void loadTextures() throws IOException { try { Level_TutorialGround = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/textures/Level_TutorialGround.png")); System.out.println("Texture loaded: " + "Level_TutorialGround"); System.out.println("&gt;&gt; Image width: " + Level_TutorialGround.getImageWidth()); System.out.println("&gt;&gt; Image height: " + Level_TutorialGround.getImageHeight()); System.out.println("&gt;&gt; Texture width: " + Level_TutorialGround.getTextureWidth()); System.out.println("&gt;&gt; Texture height: " + Level_TutorialGround.getTextureHeight()); System.out.println("&gt;&gt; Texture ID: " + Level_TutorialGround.getTextureID()); } finally { doneLoading = true; }
has comment: http://stackoverflow.com/comment/31122489
has comment: http://stackoverflow.com/comment/31122222
favorite count: 0
has answer: http://stackoverflow.com/a/20765821
has title: LWJGL adds line above my texture
tagged with: opengl
type: UnansweredQuestion
tagged with: java
tagged with: slick2d
tagged with: lwjgl
tagged with: render
upvote count: 1

http://stackoverflow.com/q/20796784
has comment: http://stackoverflow.com/comment/31177803
has answer: http://stackoverflow.com/a/20798950
tagged with: java
type: Question
has body: i have a java applet that i have written that draws a representation of a game tile. here is the code: import javax.swing.*; import java.awt.*; public class TestApplet extends JApplet { Tile tile01; Drawer drawer; public void init() { tile01 = new Tile("tile01", 4, 2, 1, 7, 0, 6, 5, 3); drawer = new Drawer(); } public void paint(Graphics g) { drawer.drawTile(g, tile01); } } it all works fine to draw one tile, but what i was wanting to do is to have a grid of drawing areas, that a tile can be drawn onto each. sorry, im not sure if i am explaining it properly, but i want to use swing to divide the space up into a grid of tile-sized panels that a tile can be placed into on a players turn, and when that happens, it re-draws the board with the new tile there. i am just having a bit of trouble working out how the paint method works, is it possible to use the same paint method for multiple panels? would i have to have a separate graphics object for each panel so that they can have their own local coordinate systems? anyway, any help would be appreciated, if any clarifications are needed then please let me know. thanks
accepted answer: http://stackoverflow.com/a/20798950
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
upvote count: 2
tagged with: swing
score: 2
type: AnsweredQuestion
has title: multiple drawing areas in java applet

scala
tags question: http://stackoverflow.com/q/20751295
tags question: http://stackoverflow.com/q/20726260
tags question: http://stackoverflow.com/q/20848006
tags question: http://stackoverflow.com/q/20689122
tags question: http://stackoverflow.com/q/20742257
tags question: http://stackoverflow.com/q/20771996
tags question: http://stackoverflow.com/q/20740122
tags question: http://stackoverflow.com/q/20841342
tags question: http://stackoverflow.com/q/20849034
tags question: http://stackoverflow.com/q/20753886
tags question: http://stackoverflow.com/q/20762663
tag name: scala
tags question: http://stackoverflow.com/q/20840256
tags question: http://stackoverflow.com/q/20742238
tags question: http://stackoverflow.com/q/20696299
tags question: http://stackoverflow.com/q/20826786
type: Tag
tags question: http://stackoverflow.com/q/20832940

http://stackoverflow.com/comment/31045520
type: QuestionComment
comment on: http://stackoverflow.com/q/20722813
has text: No exceptions are being produced and I am running this from within Eclipse, so a .class
score: 0
type: Comment

http://stackoverflow.com/q/20844285
type: Question
has answer: http://stackoverflow.com/a/20844435
accepted answer: http://stackoverflow.com/a/20844435
has body: I'm able to pass String (which is an object) to another activity through intent. But whenever I tried to pass some other class object (eg: "LatLng" class object) through intent to another activity, seeing runtime errors. What is the difference between sting object and LatLng class object in this context? Note: I'm able to pass LatLng class object through bundle without any issues, but I just wanted to know the reason.
score: 0
has title: Android : Bundle Vs Intent
tagged with: android
answer count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31238805
has text: [This](http://stackoverflow.com/a/16683950/354831) answer will help you.
score: 1
comment on: http://stackoverflow.com/q/20829526
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31342375
score: 0
type: Comment
has text: there are couple of think noticed in your implementation. 1. you should not return/write response in servlet thread ( if you are going with asyn mode) put those in run block before / after ac.complete. second you should read the stream ( file stream) which ever is uploaded in run method. basic thumb rule, you cannot submit response multiple time.
comment on: http://stackoverflow.com/a/20808380
type: AnswerComment

http://stackoverflow.com/comment/31101794
comment on: http://stackoverflow.com/q/20752143
has text: Long story short, Nagle's algorithm works by buffering small packets of data and sending them all at once in order to reduce overhead. That delay you were experiencing could very well be Nagle's algorithm buffering data prior to be sent. Good catch, btw.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31159258
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20786822
has text: You already using `FilenameFilter`, along with `fileName2.startsWith(filePrefix)` add a check for created-date as well..
score: 0

http://stackoverflow.com/comment/31010383
comment on: http://stackoverflow.com/q/20704047
type: Comment
type: QuestionComment
has text: Oh... I mean public not global variables, sorry:/
score: 0

http://stackoverflow.com/q/20698280
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31000672
has body: This is my query which is written using HQL. My requirement is as follows. I've 45 records and I want to fetch 10 records each time. It gives successfully up to 40 records. But from 41-45 records, the query returns empty list. query1 = session .createQuery( "FROM mongo c where " + "c.ad='555rs5' and " + "c.cId='44444sf' and " + "c.langId='59ecc8' and c.date &lt; '" + tempDate + "' ORDER BY -date") .setMaxResults(10); Anything wrong in my query? Please let me know. Regards Naresh Veluri
has answer: http://stackoverflow.com/a/20699681
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20700780
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31002393
type: Question
tagged with: jakarta-ee
has title: set max results in hibernate not working as per requirement

http://stackoverflow.com/q/20770276
tagged with: java
has answer: http://stackoverflow.com/a/20775081
tagged with: memory-consumption
upvote count: 1
has title: how to replace multiple arrayList to single Collection Java
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/31132230
has comment: http://stackoverflow.com/comment/31132196
has answer: http://stackoverflow.com/a/20775189
has comment: http://stackoverflow.com/comment/31130946
has body: I am writing this utility code which dumps excel sheet into database (postgres in this case). I used poi's HSSF technique to deal with the excel sheet. I am storing each column of excel sheet into separate ArrayLists of type String. In this case when the number of columns in .xls are greater than 23 eclipse is generating an error 'heap memory full'. My question is can I combine these arraylists into one collection object and which method should I use? public ArrayList&lt;String&gt; getList(String path, String srnoStr, String nameStr, String dobStr, String genderStr, String addressStr, String pinStr, String mobStr, String eIdStr, String categoryStr, String branchStr) throws IOException, SQLException { ArrayList&lt;String&gt; errorList = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; cellError = null; // String error=null; // OrderedMap errorMap=new LinkedMap(); // errorMap=null; List&lt;Cell&gt; cells_srno = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_name = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_dob = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_gender = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_address = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_pin = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_mob = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_eId = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_category = new ArrayList&lt;Cell&gt;(); List&lt;Cell&gt; cells_branch = new ArrayList&lt;Cell&gt;(); try { int srnoIndex = 0; srnoIndex = getIndex(srno, path); cellError = fillList(srnoIndex, srNoId, cells_srno, path); if (cellError != null) errorList.addAll(cellError); cellError = null; int nameIndex = 0; nameIndex = getIndex(name, path); cellError = fillList(nameIndex, nameId, cells_name, path); if (cellError != null) errorList.addAll(cellError); cellError = null; int dobIndex = 0; dobIndex = getIndex(dob, path); cellError = fillList(dobIndex, dobId, cells_dob, path); if (cellError != null) error…
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: hssf
has comment: http://stackoverflow.com/comment/31138820
score: 1

http://stackoverflow.com/comment/31153495
type: AnswerComment
comment on: http://stackoverflow.com/a/20781792
has text: Check my edited answer. I put the details on the main answer body to be more easily accessible for other users.
type: Comment
score: 0

http://stackoverflow.com/comment/31128674
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20769015
score: 0
has text: Did you see this as a function parameter? If so that means variable number of arguments.

http://stackoverflow.com/comment/31256277
score: 0
type: AnswerComment
has text: in Java Eclipse you can add Getter and Setter by shortcut `Alt+Shift+s` and then pressing `r` on a variable
type: Comment
comment on: http://stackoverflow.com/a/20839462

http://stackoverflow.com/a/20827729
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20827638
score: 1
has body: It seems the variable cursor17 is null. Maybe in your situation this changed if-condition helps: if (cursor17 != null &amp;&amp; cursor17.moveToFirst()) { I don't know your DBAdapter class, but is the second parameter to your rawQuery()-method not set to null, meaning you get null if your table strategyTotal is empty? I would look if the table is empty and why and what result your query will then deliver.
downvote count: 0
has comment: http://stackoverflow.com/comment/31235475

http://stackoverflow.com/q/20739780
tagged with: spring
has title: Gradle - multi project compiles but shared project classes not found
has answer: http://stackoverflow.com/a/20740489
score: 0
type: UnansweredQuestion
has body: We are trying to setup a multi project build. We have 2 projects: 1) PlayerManager 2) Shared our project compiles and all the tests succeed when we run the gradle.test task Problem is when we try to run the project on the tomcat from whithin eclipse we get class not found error for all the files in the Shared project. Here is our gradle.build files: PlayerManager (root) ======================= apply plugin: 'war' apply plugin: 'jetty' apply plugin: 'eclipse-wtp' apply plugin: 'eclipse' apply from: 'dependencies.gradle' apply from: 'xmlHandler.gradle' apply plugin: 'base' dependsOn(":NGShared:NGShared") task wrapper(type: Wrapper) { gradleVersion = '1.9' } repositories { mavenCentral() } dependencies { providedCompile 'javax.servlet:servlet-api:2.5' compile 'org.springframework:spring-webmvc:3.2.2.RELEASE' runtime 'javax.servlet:jstl:1.1.2' } /* Change context path (base url). otherwise defaults to name of project */ jettyRunWar.contextPath = '' task cleanAndBuild(dependsOn: ['clean', 'assemble']) assemble.mustRunAfter clean tasks.withType(Test) { testLogging { events 'passed' } } task testSanity(type: Test, dependsOn: testClasses) { exclude '*/TimeBaseTest*' } Shared(sub project) ======================= apply plugin: 'java' apply plugin: 'eclipse' apply from: 'dependencies.gradle' task wrapper(type: Wrapper) { gradleVersion = '1.9' } settings.gradle include ":NGShared:NGShared" ====================================================== Our path for the project is: /NGPlayerManager/ /NGPlayerManager/NGShared/NGShared Any ideas why ? Thanks
tagged with: gradle
type: Question
tagged with: build
tagged with: java
answer count: 1

http://stackoverflow.com/comment/31191359
comment on: http://stackoverflow.com/a/20803820
has text: A relative path should be viable and if other devs want to move the files from there, they can write custom scripts. It's a tricky situation either way
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31058167
has text: How it becomes (n/2)*n and log2(n)*n? and finally, No, I dont know how to get this.
type: Comment
comment on: http://stackoverflow.com/a/20729761
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31061472
comment on: http://stackoverflow.com/a/20731032
score: 0
has text: That has imported it into the referenced libraries but when i attempt to open he class file it says "the JAR file has no source attachment.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31107221
type: QuestionComment
has text: show the query building code
comment on: http://stackoverflow.com/q/20756883
score: 0
type: Comment

http://stackoverflow.com/comment/31259671
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20785844
has text: Updated instructions.
score: 0

http://stackoverflow.com/comment/31050153
type: Comment
comment on: http://stackoverflow.com/a/20725169
type: AnswerComment
score: 0
has text: First, awesome answer, thank you. Couple questions: I don't see the numeric quantifier {n} on the page you linked. I see it used in the [0-9]{n} way, but that's a different case in that it matches what's between the bracket n times. In this case there are parentheses, and instead of matching n straight times it looks like it's saying to only store the nth match. ?? Second, what is the point of adding the initial ^? There are no spaces in the data, so it seems to me that everything is the start of the string. Third, what does *+ do in your correction? Haven't seen that before.

http://stackoverflow.com/comment/31181930
has text: @peeskillet, the OP actually wants a `boolean` check whither the `Add Button` is pressed before `Check button`. But i think you got the nail: the OP should not depend on such functionality on the controlling component which are to take input data rather on the data container itself whither their is required data exist or not
comment on: http://stackoverflow.com/q/20799131
score: 0
type: Comment
type: QuestionComment

sfml
tag name: sfml
tags question: http://stackoverflow.com/q/20687360
type: Tag

http://stackoverflow.com/comment/31269656
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20845869
type: AnswerComment
has text: Unless there is something extremely performance-critical about this operation, I think it's better to write readable code, i.e. using normal comparison operations rather than bit operations.

http://stackoverflow.com/q/20775623
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31140029
upvote count: 1
has comment: http://stackoverflow.com/comment/31140108
tagged with: swing
type: Question
has title: Java- JTable key bindings
tagged with: jtable
has body: I wanted to change the default action of ENTER key on the JTable so that it has the same function as the F2 key. So I used the key bindings and it works fine. Only one problem : if F2 key is a second time on the same cell editing is stopped, but the ENTER key don't do the same thing, it always start editing when pressed. Here's my code : InputMap im = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); KeyStroke f2 = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); im.put(enter, im.get(f2)); Thanks
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31142133
tagged with: key-bindings
answer count: 0
has comment: http://stackoverflow.com/comment/31139933

http://stackoverflow.com/q/20697183
tagged with: spring
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/30999335
tagged with: java
accepted answer: http://stackoverflow.com/a/20697940
type: Question
has title: Spring Annotation : Converting XML Configuration to Annotation
downvote count: 0
has comment: http://stackoverflow.com/comment/30999421
has comment: http://stackoverflow.com/comment/30999590
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20697940
upvote count: 2
has body: I am using xml configuration in my Spring Application. Now i would like to convert the existing classes to use annotation(like @service, @Repository etc) instead of xml configuration. Business Logic(Irrelevant for this question, just for understanding): Sevice connnects to Americas database and find the skus(products) and deactivates the skus. Sevice connnects to EMEA database and find the skus(products) and deactivates the skus. Here is the sample code. /* Service code, which has 2 instances of SkuDAO, one connecting to US database and one connecting to EMEA database */ public class DeactivationService { private static final Logger LOG = Logger.getLogger(DeactivationService.class); private SkuDAO amerdao; //Dependency Injection Amer private SkuDAO emeadao; //Dependency Injection EMEA public DeactivationService(SkuDAO amerdao,SkuDAO emeadao) { this.amerdao=amerdao; this.emeadao=emeadao; } /* * Step 1: find inactive sku in americas skudao1.find() * Step 2: find inactive sku in emea skudao2.find() * Step 3: deactivate sku in americas * Step 4: deactivate sku in emea */ public void deactivateSku() { List<Sku> totalList = new ArrayList<Sku>(); List<Sku> amerList = amerdao.find(); List<Sku> emeaList = emeadao.find(); amerdao.deactivate(amerList); emeaList.deactivate(emeaList); } } /* DAO interface */ public interface SkuDAO { public List<Sku> find(); public void deactivate(List<Sku>); } /* DAO Implementation Here one constructor in which DataSource is injected */ public class SkuDAOImpl implements SkuDAO { private DataSource datasource; //Dependency injection private JdbcTemplate jdbcTemplate; public SkuDAOImpl(DataSource datasource) { this.datasource=datasource; } public List<Sku> find() { //some processing to find the sku, purposely left empty as it is a sample code } public void deactivate(List<Sku>) { //some processing to deactivate the sku, purposely left empty as it is a sample code } } Spring Configuration: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http…
tagged with: spring-annotations

http://stackoverflow.com/a/76818958
answers question: http://stackoverflow.com/q/20786635
has body: Use Pixmap fun TextureRegion.toTexture(): Texture { val pixmap = Pixmap(regionWidth, regionHeight, Pixmap.Format.RGBA8888) if (texture.textureData.isPrepared.not()) texture.textureData.prepare() val texturePixmap = texture.textureData.consumePixmap() pixmap.drawPixmap(texturePixmap, 0, 0, regionX, regionY, regionWidth, regionHeight) val newTexture = Texture(pixmap) texturePixmap.dispose() pixmap.dispose() return newTexture } Don't forget to dispose the texture | pixmap! Be careful with pixmap.dispose(). If you use a texture bitmap after this conversion and convert that texture again, you may encounter memory errors. The solution is to simply pass the flag to use pixmap.dispose() or not.
score: 0
has comment: http://stackoverflow.com/comment/135985985
type: Answer

http://stackoverflow.com/a/20811784
downvote count: 0
answers question: http://stackoverflow.com/q/20811697
has body: The key is that timedRun cannot return until r.run() returns. If the Runnable r ignores the fact that it has been interrupted, then r.run() might return very late indeed. It is not the interrupt call being stuck (it will likely complete almost immediately), but rather that the interrupt can be ignored by its target, preventing timedRun from completing until the run method reaches its natural end, if any.
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31209272
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20811697

http://stackoverflow.com/comment/72755709
comment on: http://stackoverflow.com/a/42819940
type: AnswerComment
score: 0
type: Comment
has text: It's better late than never ;)

http://stackoverflow.com/q/20720483
tagged with: canvas
tagged with: awt
score: 0
has title: How to Access a Method When using KeyListeners?
has comment: http://stackoverflow.com/comment/31041039
has comment: http://stackoverflow.com/comment/31050766
has body: everyone! I want to do something with KeyListeners that cause the canvas to repaint whenever I press a button. However, the problem is that the KeyListener can't access any methods in the other classes because of encapsulation. What's the key to fixing this? Thank you! import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.*; import javax.imageio.*; import java.io.*; public class FaceFrame extends JFrame { private FaceCanvas face; public FaceFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 800); setVisible(true); setLayout(new BorderLayout()); KeyListenerTester bob = new KeyListenerTester(); face = new FaceCanvas(); face.addKeyListener(bob); add(face, BorderLayout.CENTER); } public static void main(String args[]) { JFrame faceFrame = new FaceFrame(); } } class FaceCanvas extends Canvas { private Face whiteGuy; private Face redGuy; public FaceCanvas() { setBackground( Color.BLUE); setSize( 800, 800 ); whiteGuy = new Face(50, 50, 150, 150, Color.WHITE, "White"); redGuy = new Face(300, 300, 150, 150, Color.RED, "Red"); } public void paint( Graphics g ) { // override paint method by re-defining it whiteGuy.paint(g); redGuy.paint(g); repaint(); } } class Face { int xpos, ypos; int width, height; Color skinTone; String tattoo; Font f; public Face(int xpos, int ypos, int width, int height, Color skinTone, String tattoo) { this.xpos = xpos; this.ypos = ypos; this.width = width; this.height = height; this.skinTone = skinTone; this.tattoo = tattoo; f = new Font( "Times New Roman", Font.ITALIC| Font.BOLD, 24 ); } public void paint(Graphics g) { g.setColor( skinTone ); g.drawOval( xpos, ypos, width, height ); g.drawLine( xpos+ 10, ypos+ height-30, xpos+ width-30, ypos + height- 30 ); g.setFont(f); g.drawString( tattoo, xpos + 60, ypos + 20 ); } } class KeyListenerTester extends JFrame implements KeyListener { JLabel label; public KeyListenerTester() { } @Override public void keyTyped(KeyEvent e) { if (e.getKeyCode() == KeyE…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31040749
tagged with: java
tagged with: keylistener
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/31041085

http://stackoverflow.com/q/20805559
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/20805635
has answer: http://stackoverflow.com/a/20805638
has title: Get slf4j NOP implementation to log to console
tagged with: slf4j
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/20805638
favorite count: 0
has body: I want slf4j NOP implementation to log to the console. Currently, it just doesnt log anything, instead is there a way to have it log to the console? My use case is I have a library (not an app) which just depends on slf4j-api. But some of the classes in there have main method for testing purposes. When I run those main methods, I want all the logs to go to the console without having to depend on slf4j-log4j binding. Thanks.
type: Question
tagged with: no-op
has answer: http://stackoverflow.com/a/20805635
upvote count: 2

http://stackoverflow.com/a/20718409
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20718337
upvote count: 3
score: 3
has body: While answer from Juned Ahsan is perfectly correct IMHO, I would probably modify your URLs pattern to something like GET /Smith/pets : return pets for Mr Smith Authorization can now be done one layer up in the URL and URLs always represent the same resource. I tend to prefer this solution because it will be easier to add a caching layer on top of it. Adding the user (from HTTP header) to the cache key is not efficient, nor is it easy to configure for some caching solution.

http://stackoverflow.com/q/20739644
tagged with: mobile
downvote count: 0
favorite count: 0
has body: I can find out OS Name,OS Manufacturer,DEVICE TYPE,Browser Type,Browser Name,Browser Version using UserAgentUtils api how can i findout Device Name/build ? example :HTC Sensation Build/IML74K and LG ..... String userAgentString ="Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"; UserAgent agent = UserAgent.parseUserAgentString(userAgentString); Browser browser = agent.getBrowser(); System.out.println("Browser Type :"+browser.getBrowserType()); System.out.println("Browser Name :"+browser.getName()); Version version = agent.getBrowserVersion(); System.out.println("Browser Version :"+version.getVersion()); OperatingSystem os = agent.getOperatingSystem(); System.out.println("OS Name :"+os.getName()); System.out.println("DEVICE TYPE : "+ os.getDeviceType()); System.out.println("OS Manufacturer :"+os.getManufacturer()); or anyother Java Api to find out all the value(Device Name,Device Type ,Browser Type,Browser Version,OS Name OS version)using USER AGENT String?
type: UnansweredQuestion
has title: How to findout Device Name/build Using UserAgentUtils-1.2.3 Java Api?
score: 3
answer count: 0
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/comment/31257836
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20839866
type: Comment
has text: Stop all the other applications running in the websphere and try.

http://stackoverflow.com/q/20719840
tagged with: java
tagged with: mysql
type: Question
has body: I installed MySQL database &amp; JDBC. I created a database called feedback through MySQL command line client, and I want to access that database through a java program. Here is the commands I used on MySQL command line client create the database. create database feedback; use feedback; CREATE USER sqluser IDENTIFIED BY 'sqluserpw'; grant usage on *.* to sqluser@localhost identified by 'sqluserpw'; grant all privileges on feedback.* to sqluser@localhost; CREATE TABLE COMMENTS (id INT NOT NULL AUTO_INCREMENT, MYUSER VARCHAR(30) NOT NULL); INSERT INTO COMMENTS values (default, 'lars'); Then, the code in Java: package de.vogella.mysql.first; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Date; import javax.swing.JOptionPane; public class MYSQLACCESS { private Connection connect = null; private Statement statement = null; private PreparedStatement preparedStatement = null; private ResultSet resultSet = null; public void readDataBase() throws Exception { JOptionPane.showMessageDialog(null, "Before try" ); try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB JOptionPane.showMessageDialog(null, "1" ); connect = DriverManager.getConnection("jdbc:mysql://localhost/feedback?" + "user=sqluser&amp;password=sqluserpw"); // Statements allow to issue SQL queries to the database statement = connect.createStatement(); // Result set get the result of the SQL query resultSet = statement.executeQuery("select * from FEEDBACK.COMMENTS"); // writeResultSet(resultSet); String my_user = resultSet.getString("MYUSER"); System.out.println(my_user); JOptionPane.showMessageDialog(null, my_user ); } catch (Exception e) { throw e; } } } The Main Class: package de.vogella.mysql.first; import de.vogella.mysql.first.MYSQLACCESS; public class Main { public static vo…
tagged with: database
has answer: http://stackoverflow.com/a/20719923
possible better answer: http://stackoverflow.com/a/20719928
score: 0
answer count: 2
has title: Can't Connect to Database from Java program
has answer: http://stackoverflow.com/a/20719928
accepted answer: http://stackoverflow.com/a/20719923
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31039605
has comment: http://stackoverflow.com/comment/31039555
has comment: http://stackoverflow.com/comment/31039675
has comment: http://stackoverflow.com/comment/31039706
has comment: http://stackoverflow.com/comment/31039945
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31039745

http://stackoverflow.com/a/20811989
has body: Catch your Exception by creating try and catch: try { JSONObject jsonObj = new JSONObject("{\"count\":3939,\"has_more\":true,\"map_location\":{\"lat\":0.60996950000000183,\"lon\":-27.568517000000003,\"panoramio_zoom\":16},\"photos\":[{\"height\":375,}]}"); System.out.println(jsonObj); } catch (JSONException e) { //some exception handler code. } Or either throws your exception to caller method: public String yourMethod(String jsonString) throws JSONException
score: 18
answers question: http://stackoverflow.com/q/20811948
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20811948
upvote count: 18
type: Answer
downvote count: 0

http://stackoverflow.com/a/20786677
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20786483
upvote count: 14
has body: First and foremost, your program is thread-unsafe because boolean started is a shared variable, but it is neither volatile nor accessed within synchronized blocks. Now, accidentally, PrintStream#print is a synchronized method and, on any actual architecture, entering and exiting a synchronized block is implemented using memory barrier CPU instructions, which cause a complete synchronization between the thread-local state and main memory. Therefore, by pure accident, adding the print call allows the setting of started flag by one thread (the EDT) to be visible by another (the main thread).
score: 14
has comment: http://stackoverflow.com/comment/31159026
accepted answer of: http://stackoverflow.com/q/20786483
type: AcceptedAnswer

http://stackoverflow.com/comment/81037747
type: Comment
score: 13
has text: Excellent ` false ` this line is necessary .
comment on: http://stackoverflow.com/a/20697237
type: AnswerComment

http://stackoverflow.com/comment/31054181
has text: Thanks a lot it works. But the pattern will also detect 1/2 which is a normal fraction. Is there anyway to just only capture the mixed number only?
comment on: http://stackoverflow.com/a/20727431
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20730070
has body: ı don't use ParseException and ı didn't find in internet. so please can you give example ParseException ??? ı am waiting your codes. please help me ??? //how is try?? catch(ParseException e){ }
score: -3
downvote count: 3
has answer: http://stackoverflow.com/a/20730132
has comment: http://stackoverflow.com/comment/31058440
type: AnsweredQuestion
tagged with: parseexception
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20730132
upvote count: 0
answer count: 1
favorite count: 0
has title: ParseException for number java

http://stackoverflow.com/q/20732677
answer count: 1
has comment: http://stackoverflow.com/comment/31079342
score: 0
has answer: http://stackoverflow.com/a/20753894
accepted answer: http://stackoverflow.com/a/20753894
has comment: http://stackoverflow.com/comment/31066341
has body: I've got a EOFException while decompress and deserialization a byte array. Stacktrace: java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2324) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2793) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:799) at java.io.ObjectInputStream.(ObjectInputStream.java:299) at com.chuck.pack.ResourcePacket.load(ResourcePacket.java:44) // Functions related to load public static ResourcePacket load(String packetName) { try { byte[] bytes = uncompress(fileToByteArray(new File(packetName))); ByteArrayInputStream in = new ByteArrayInputStream(bytes); ObjectInputStream objIn = new ObjectInputStream(in); // Error occured here return (ResourcePacket) objIn.readObject(); } catch (Exception ex) { ex.printStackTrace(); } return null; } private static byte[] uncompress(byte[] bytes) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Inflater ifl = new Inflater(); ifl.setInput(bytes); byte[] buffer = new byte[4*1024]; while(ifl.finished()) { int size = ifl.inflate(buffer); out.write(buffer, 0, size); } out.close(); return out.toByteArray(); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error while load"); } return null; } private static byte[] fileToByteArray(File file) { byte[] bytes = new byte[(int) file.length()]; try { FileInputStream fileInputStream = new FileInputStream(file); fileInputStream.read(bytes); fileInputStream.close(); } catch (IOException ex) { ex.printStackTrace(); } return bytes; } // Functions related to save public void save() { try { byte[] bytes = compress(toByteArray()); //byte[] bytes = toByteArray(); FileOutputStream fileOutputStream = new FileOutputStream(packetName); fileOutputStream.write(bytes); fileOutputStream.close(); System.out.println("Packet saved (" + resourceFiles.length + " Files)"); } catch (IOException ex) { ex.printStackTrace(); System.exit(-1); } } private byte[] co…
tagged with: serialization
has title: EOFExcpetion while deserialization by byte array
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31063784
tagged with: java
tagged with: compression
has comment: http://stackoverflow.com/comment/31063318
type: Question
has comment: http://stackoverflow.com/comment/31063581

http://stackoverflow.com/a/20800802
accepted answer of: http://stackoverflow.com/q/20785373
type: AcceptedAnswer
upvote count: 3
type: Answer
downvote count: 0
has body: Change in Enum public enum RSVP { APPLIED_REJECTED, APPLIED_SHORTLISTED, SHORTLISTED_SELECTED, SHORTLISTED_IN_PROGRESS, SHORTLISTED_ON_HOLD, SHORTLISTED_REJECTED; private int status; public int getValue() { return status; } } Change in Domain Class @Enumerated(EnumType.ORDINAL) @Column(name="status") private RSVP rsvpStatus; public RSVP getRsvpStatus() { return this.rsvpStatus; } public void setRsvpStatus(RSVP rsvp) { this.rsvpStatus = rsvp; } Change in DAO Call conditions.put("rsvpStatus", RSVP.APPLIED_SHORTLISTED); Change in Table Keep "status" column in table as int datatype It's very easy to integrate Enum Type in Hibernate.If you annotate with EnumType.STRING then it will store string values in DB.
score: 3
answers question: http://stackoverflow.com/q/20785373

http://stackoverflow.com/a/21030437
type: Answer
accepted answer of: http://stackoverflow.com/q/20829025
has body: I guess that while wrapping the FileInputStream for the creation of an ObjectInputStream, the implementation already parses the complete file and closes it. Therefore, you get an end-of-stream exception. The solution would be to not access the file input stream itself, but only the created ObjectInputStream as referenced by the objectIn variable.
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/20829025

http://stackoverflow.com/a/20776560
has body: The class TAIInstant, and others like UTCInstant were removed during the JSR-310 process. The group came to the conclusion that these were specialist items and not necessary to be in the core JDK. I still believe this to be the correct decision. The result of this is that there is very little support for time-scales in JSR-310. However, there is a formally defined way to connect JSR-310 to time-scales, allowing an accurate clock to be created given an accurate source. While not everyone likes this solution, it is practical for the mainstream. In summary, the original design of separate classes for UTC and TAI is sound (and necessary to handle events in the past and future). However, it was too specialist for the JDK. The threeten-extra project is now available as a jar for JDK 8 with these classes in.
upvote count: 5
type: Answer
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/20746740

http://stackoverflow.com/a/20842740
has body: Are you defining the structure of the XML, or has someone supplied you with a fixed XSD that you MUST use? If you are actually defining the structure of the request XML, you can use annotations such as @XmlElement and @XmlElementWrapper to have JAXB work with collections. See this for more information: http://blog.bdoughan.com/2010/09/jaxb-collection-properties.html
score: 0
answers question: http://stackoverflow.com/q/20704332
has comment: http://stackoverflow.com/comment/31285099
type: Answer

http://stackoverflow.com/a/20819261
score: 7
type: Answer
has body: Right click your project, select Export and WAR file. You can then configure what goes in and what doesn't.
has comment: http://stackoverflow.com/comment/31219859
has comment: http://stackoverflow.com/comment/31219928
has comment: http://stackoverflow.com/comment/31219900
answers question: http://stackoverflow.com/q/20819240
upvote count: 7
has comment: http://stackoverflow.com/comment/31218891
has comment: http://stackoverflow.com/comment/31218915
downvote count: 0

http://stackoverflow.com/q/20703628
has comment: http://stackoverflow.com/comment/31009558
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/40164564
tagged with: switch-statement
has title: Compile Time Constant Usage in Switch Case Java
has comment: http://stackoverflow.com/comment/31010282
type: Question
has comment: http://stackoverflow.com/comment/31010458
tagged with: string
answer count: 6
has answer: http://stackoverflow.com/a/20703820
accepted answer: http://stackoverflow.com/a/20703820
linked to: http://stackoverflow.com/q/14757978
upvote count: 3
has comment: http://stackoverflow.com/comment/31009619
has body: The rules of case usage say: The case expression must evaluate to a Compile Time Constant. case(t) expression must have same type as that of switch(t), where t is the type (String). If i run this code : public static void main(String[] args) { final String s=new String("abc"); switch(s) { case (s):System.out.println("hi"); } } It gives Compile-error as: "case expression must be a constant expression" On the other hand if i try it with final String s="abc";, it works fine. As per my knowledge,String s=new String("abc") is a reference to a String object located on heap. And s itself is a compile-time constant. Does it mean that final String s=new String("abc");isn't compile time constant?
has comment: http://stackoverflow.com/comment/31009975
has answer: http://stackoverflow.com/a/20703737
has comment: http://stackoverflow.com/comment/85559812
favorite count: 0
has answer: http://stackoverflow.com/a/20703830
possible better answer: http://stackoverflow.com/a/20703737
has answer: http://stackoverflow.com/a/20703712
has comment: http://stackoverflow.com/comment/31010303
has answer: http://stackoverflow.com/a/49278849
has comment: http://stackoverflow.com/comment/31009521
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/31009512

http://stackoverflow.com/comment/121316828
type: Comment
comment on: http://stackoverflow.com/a/51330107
score: 3
has text: Note that `RestTemplate` also has a method signature that takes varargs, so you can also do this: `int foo = 2; restTemplate.getForObject("http://www.sample.com?foo={foo}", Object.class, foo);`
type: AnswerComment

http://stackoverflow.com/comment/31073577
comment on: http://stackoverflow.com/a/20735143
type: AnswerComment
score: 0
type: Comment
has text: Rcs, does the problem persist?

http://stackoverflow.com/comment/31176185
score: 0
comment on: http://stackoverflow.com/q/20781934
type: Comment
has text: Yes, it is. Unless your application needs some valid value from Properties file, it cannot perform its functionality properly. But, don't try to stop the tomcat server programmatically on failure case, that would rise some controversies on the User mind. Finally, Don't forget to log the validation error message when you are throwing the exception.
type: QuestionComment

http://stackoverflow.com/a/20696309
type: Answer
answers question: http://stackoverflow.com/q/20695870
has comment: http://stackoverflow.com/comment/31016132
has body: If your URL is something like :- /rest/Subcategory/?sort=subCatID The @QueryParam("sort") should work. I have not worked with Jersey much, but have used this many times in CXF which is also another JAX-RS spec implementation. The CXF's page http://cxf.apache.org/docs/jax-rs-basics.html explains Jaxrs basics nicely. Hope this helps.
score: 0

http://stackoverflow.com/q/20708358
has comment: http://stackoverflow.com/comment/31018310
type: Question
has comment: http://stackoverflow.com/comment/31018316
tagged with: arraylist
tagged with: casting
has answer: http://stackoverflow.com/a/20708473
linked to: http://stackoverflow.com/q/12779839
tagged with: arrays
downvote count: 0
score: 7
favorite count: 0
duplicate of: http://stackoverflow.com/q/12779839
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20708453
has answer: http://stackoverflow.com/a/20708508
answer count: 4
has title: Convert from Queue to ArrayList
linked to: http://stackoverflow.com/q/322715
tagged with: list
has answer: http://stackoverflow.com/a/20709256
has body: I want to change a queue containing numbers and operators into an ArrayList. I am coding in Java. Currently my Queue is defined as follows: Queue outputQueue = new LinkedList(); The queue currently contains the following data: [1, 9, 3, /, 4, 3, -, 2, /, *, +] I wish to do this mainly so i can use RPN to calculate the result of the calculation. Is there a way to do this? Thanks in advance for any help :)
tagged with: java
upvote count: 7

jlabel
tags question: http://stackoverflow.com/q/20699883
tags question: http://stackoverflow.com/q/20751555
tags question: http://stackoverflow.com/q/20714331
tags question: http://stackoverflow.com/q/20731679
tags question: http://stackoverflow.com/q/20835173
tags question: http://stackoverflow.com/q/20740204
tags question: http://stackoverflow.com/q/20735389
tag name: jlabel
tags question: http://stackoverflow.com/q/20735601
tags question: http://stackoverflow.com/q/20818425
tags question: http://stackoverflow.com/q/20682007
tags question: http://stackoverflow.com/q/20723684
tags question: http://stackoverflow.com/q/20792515
tags question: http://stackoverflow.com/q/20735603
type: Tag
tags question: http://stackoverflow.com/q/20721557
tags question: http://stackoverflow.com/q/20708389
tags question: http://stackoverflow.com/q/20706206

http://stackoverflow.com/comment/31109843
comment on: http://stackoverflow.com/q/20746007
type: Comment
has text: @Submersed Thank you. Tracing the Response helped in finding the problem.
type: QuestionComment
score: 0

http://stackoverflow.com/q/20724902
tagged with: nio
has comment: http://stackoverflow.com/comment/31049368
upvote count: 2
has title: Memory mapped files in java
score: 0
downvote count: 2
tagged with: memory-mapped-files
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21236276
accepted answer: http://stackoverflow.com/a/21236276
type: AnsweredQuestion
tagged with: java
has body: I was reading the book and it has got the below lines: A MemoryMappedBuffer directly reflects the disk file with which it is associated. If the file is structurally modified while the mapping is in effect, strange behavior can result (exact behaviors are, of course, operating system- and filesystem-dependent). A MemoryMappedBuffer has a fixed size, but the file it's mapped to is elastic. Specifically, if a file's size changes while the mapping is in effect, some or all of the buffer may become inaccessible, undefined data could be returned, or unchecked exceptions could be thrown. So my questions are: Can't i append text to the files which i have already mapped. If yes then how? Can somebody please guide me what are the real use cases of memory mapped file and would be great if you can mention what specific problem you have solved by this. Please bear with me if the questions are pretty naive. Thanks.
tagged with: mmap
type: Question
has comment: http://stackoverflow.com/comment/31051353

http://stackoverflow.com/comment/31276321
type: Comment
score: 0
type: AnswerComment
has text: @programmer i don't get it what you want, for what purpose do you need your JList?
comment on: http://stackoverflow.com/a/20847304

http://stackoverflow.com/comment/31231195
type: QuestionComment
comment on: http://stackoverflow.com/q/20826003
has text: That line will never throw an Exception if DungeonObject is an class. More likely it won't compile unless `dirt` is statis.
score: 1
type: Comment

http://stackoverflow.com/a/20734494
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31067312
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/31067198
accepted answer of: http://stackoverflow.com/q/20733171
has body: The problem is that your maven is using java 5 (as your comment says). You have to change your JAVA_HOME variable to point to jdk 6 or higher. Look at : Error when using javac: "javac: invalid flag: -s"
answers question: http://stackoverflow.com/q/20733171
type: AcceptedAnswer

http://stackoverflow.com/a/20797260
upvote count: 2
has body: Use context parameter of form. You can pass a single parameter or multiple parameters (using context='[param1, param2]') and then in the submit handler you can use Object onSubmitFromMyForm(Object param1, Object param2){ .... } Please note, the parameters are type coerced.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31609120
has comment: http://stackoverflow.com/comment/31190683
type: Answer
accepted answer of: http://stackoverflow.com/q/20795913
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20795913
has comment: http://stackoverflow.com/comment/31181178

http://stackoverflow.com/q/20841300
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31259613
tagged with: java
has body: This is a problem from LeetCode, I solve it using C++, but when I use the same type of method with Java, it returns a Time Limit Exceeded error. Does anyone know the reason? Here's the problem: Convert Sorted Array to Binary Search Tree. Given an array where elements are sorted in ascending order, convert it to a height balanced BST. And here's my solution written in Java: /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public TreeNode sortedArrayToBST(int[] num) { if(num.length == 0) { return null; } else { return sub(num, 0, num.length-1); } } public TreeNode sub(int[] num, int start, int end) { int indexRoot = (start+end+1) / 2; TreeNode root = new TreeNode(num[indexRoot]); if(indexRoot &gt; start) { root.left = sub(num, 0, indexRoot-1); } if(indexRoot &lt; end) { root.right = sub(num, indexRoot+1, end); } return root; } } Is there any way that I can speed it up? Thanks.
type: Question
tagged with: recursion
tagged with: performance
has answer: http://stackoverflow.com/a/20850120
has title: How to speed up a recursive method written in Java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31259517
has answer: http://stackoverflow.com/a/20841467
accepted answer: http://stackoverflow.com/a/20850120
has comment: http://stackoverflow.com/comment/31276551
possible better answer: http://stackoverflow.com/a/20841467
has comment: http://stackoverflow.com/comment/31259738

http://stackoverflow.com/comment/31041321
comment on: http://stackoverflow.com/q/20720766
score: 0
type: Comment
type: QuestionComment
has text: @JohnSnow, i just want to get the basic concept on primitive arrays first. thanks.

http://stackoverflow.com/q/20761824
has body: I am conducting a learning experiment with Java. I am attempting to create a simple "Megaman" style game using Java and the 3rd party API "LibGDX". I have obtained a rather solid understanding of the relationship between the OrthographicCamera object from LibGDX and the World object from LibGDX's implementation of "JBox2d". However, when I resize the window the objects inside World stretch. I have made use of the resize(int width, int height) method of the Screen interface. Inside of which i reset the OrthographicCamera's width and height. This does not seem to have any effect of the way the images looks or behaves in the physics simulation. So my question is this: How do i properly resize a LibGDX/JBox2d application's window without distorting the objects being simulated? here is the code (in the form of a git repo because i find GitHub faster, easier, and kinder to the SO server...) EXTERNAL LINK https://gist.github.com/konnerdroid/8113302 EXTERNAL LINK
tagged with: window-resize
tagged with: libgdx
tagged with: java
type: Question
score: 0
tagged with: aspect-ratio
answer count: 1
has answer: http://stackoverflow.com/a/20761951
has title: Java, LibGDX, and JBox2d: Resizing a window while maintaining the aspect ratio of the objects being drawn
type: UnansweredQuestion
tagged with: jbox2d

http://stackoverflow.com/q/20832589
tagged with: android-asynctask
tagged with: android
accepted answer: http://stackoverflow.com/a/20832659
type: AnsweredQuestion
tagged with: java
has title: how to add runOnUiThread() in my Activity
has answer: http://stackoverflow.com/a/20832658
type: Question
has body: I added the AsyncTask to offload network operations to a background thread.I need to make sure the UI operations are on the UI thread.So i want to Use runOnUiThread() in my Activity. Thanks for your help WifiApManager public class WifiApManager { private final WifiManager mWifiManager; public WifiApManager(Context context) { mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); } public boolean setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled) { try { if (enabled) { // disable WiFi in any case mWifiManager.setWifiEnabled(false); } Method method = mWifiManager.getClass().getMethod("setWifiApEnabled", WifiConfiguration.class, boolean.class); return (Boolean) method.invoke(mWifiManager, wifiConfig, enabled); } catch (Exception e) { Log.e(this.getClass().toString(), "wifi", e); return false; } } public WIFI_AP_STATE getWifiApState() { try { Method method = mWifiManager.getClass().getMethod("getWifiApState"); int tmp = ((Integer)method.invoke(mWifiManager)); // Fix for Android 4 if (tmp &gt; 10) { tmp = tmp - 10; } return WIFI_AP_STATE.class.getEnumConstants()[tmp]; } catch (Exception e) { Log.e(this.getClass().toString(), "wifi", e); return WIFI_AP_STATE.WIFI_AP_STATE_FAILED; } } public boolean isWifiApEnabled() { return getWifiApState() == WIFI_AP_STATE.WIFI_AP_STATE_ENABLED; } public WifiConfiguration getWifiApConfiguration() { try { Method method = mWifiManager.getClass().getMethod("getWifiApConfiguration"); return (WifiConfiguration) method.invoke(mWifiManager); } catch (Exception e) { Log.e(this.getClass().toString(), "wifi", e); return null; } } public boolean setWifiApConfiguration(WifiConfiguration wifiConfig) { try { Method method = mWifiManager.getClass().getMethod("setWifiApConfiguration", WifiConfiguration.class); return (Boolean) method.invoke(mWifiManager, wifiConfig); } catch (Exception e) { Log.e(this.getClass().toString(), "wifi", e); return false; } } public ArrayList&lt;ClientScanResult&gt; getClientList(boolean on…
tagged with: mobile
possible better answer: http://stackoverflow.com/a/20832658
has answer: http://stackoverflow.com/a/20832659
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/20845369

http://stackoverflow.com/a/20845794
downvote count: 0
answers question: http://stackoverflow.com/q/20845755
has body: Your output is ok, you should change if( negative == false &amp;&amp; (a &lt; 0 &amp;&amp; b &gt; 0) || (a &gt; 0 &amp;&amp; b &lt; 0)) to if( !negative &amp;&amp; ( (a &lt; 0 &amp;&amp; b &gt; 0) || (a &gt; 0 &amp;&amp; b &lt; 0) ) ) ^ ^ &amp;&amp; works like multiplication If you have this negative == false &amp;&amp; (a &lt; 0 &amp;&amp; b &gt; 0) || (a &gt; 0 &amp;&amp; b &lt; 0) is like ( negative == false &amp;&amp; (a &lt; 0 &amp;&amp; b &gt; 0) ) || (a &gt; 0 &amp;&amp; b &lt; 0) ^ ^
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/31118913
score: 0
type: Comment
type: QuestionComment
has text: The reasons the answers are suggesting different implementation is because a java thread cannot _directly_ call sleep on another thread. This way, you know the thread making itself sleep is not in the middle of doing something that would be dangerous to sleep during. (Holding locks during synchronization and such)
comment on: http://stackoverflow.com/q/20763460

http://stackoverflow.com/comment/31226334
type: AnswerComment
has text: Fixed it. The only thing that I was wrong about was that 'he was describing the pattern'. I wasn't wrong about 'he should use the pattern' part.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20823356

http://stackoverflow.com/q/20740567
upvote count: 1
favorite count: 0
has title: Where can I find source code for JFXPanel in JavaFX 2.2?
has comment: http://stackoverflow.com/comment/31082089
has comment: http://stackoverflow.com/comment/31081101
has body: In my app I'm seeing some strange stacktraces comming from JFXPanel.java which I'd like to investigate further. Unfortunately, with JDK 7 only the runtimes of JavaFX 2.2 are present. I know that JFX code is only partially open source, and here is the main branch of that project: http://hg.openjdk.java.net/openjfx/2.2/master/rt However downloading and unpacking the ZIP source code does not yield a JFXPanel class file. I can see it easily with downloading official JDK 8 early access, though. Where can I find this source code? (I'm using JDK 7 u 40)
has comment: http://stackoverflow.com/comment/31077889
tagged with: javafx-2
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31077838
has comment: http://stackoverflow.com/comment/31077448
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31078395
has comment: http://stackoverflow.com/comment/31077371

http://stackoverflow.com/a/20841053
answers question: http://stackoverflow.com/q/20840871
accepted answer of: http://stackoverflow.com/q/20840871
type: AcceptedAnswer
downvote count: 0
has body: Although it's not being actively developed any longer due to low demand, you can have a look at the MySQL-Connector/MXJ package that's meant for "embedding" your MySQL-database into your application - I recon' it still should be able to do the trick. But to be honest, the most future-proof solution would be to switch out your database with another option, preferably an in memory database such as H2database or SQLite.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/31274309
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20848858
has text: following post might help http://stackoverflow.com/questions/9868848/2-eclipse-versions-with-same-workspace

http://stackoverflow.com/comment/31042148
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20721269
type: Comment
has text: You will need to customize your logic.

http://stackoverflow.com/comment/31159520
has text: @Octopus: no. It didn't help
type: QuestionComment
comment on: http://stackoverflow.com/q/20786921
type: Comment
score: 0

http://stackoverflow.com/comment/31160197
has text: Neither Angular nor Ember are client side validation frameworks, they solve a completely different problem.
comment on: http://stackoverflow.com/q/20781518
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31070604
has text: Why would you simply `return` instead of throwing an appropriate message?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20736574

http://stackoverflow.com/comment/31242355
type: Comment
comment on: http://stackoverflow.com/a/20831370
has text: @Jongware, now we speak the same language, i agree on that perspective and will make a correction.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31026873
score: 0
type: Comment
type: AnswerComment
has text: I think it need to be static because I am calling from constructor.
comment on: http://stackoverflow.com/a/20712404

http://stackoverflow.com/a/20762145
has body: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button K = (Button) findViewById(R.id.Kids); final Button N = (Button) findViewById(R.id.Novice); final Button E = (Button) findViewById(R.id.Expert); final Button I = (Button) findViewById(R.id.Impossible); final Intent activity2 = new Intent (MainActivity.this, PuzzStart.class); final Bundle bundle1 = new Bundle(); K.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub bundle1.putString("levels", "Kids"); activity2.putExtras(bundle1); startActivity(activity2); } }); N.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub bundle1.putString("levels", "Novice"); activity2.putExtras(bundle1); startActivity(activity2); } }); E.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub bundle1.putString("levels", "Expert"); activity2.putExtras(bundle1); startActivity(activity2); } }); I.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub bundle1.putString("levels", "Impossible"); activity2.putExtras(bundle1); startActivity(activity2); } }); } @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 then retrieve by level = intent.getString("levels"); lev.setText(level);
upvote count: 1
answers question: http://stackoverflow.com/q/20761886
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/31045676
comment on: http://stackoverflow.com/q/20723078
score: 0
type: Comment
type: QuestionComment
has text: @dasblinkenlight , that's the answer I was looking for, is this possible in for example c++ ?

http://stackoverflow.com/q/20775708
tagged with: interface
tagged with: java
has answer: http://stackoverflow.com/a/20775725
tagged with: eclipse
has answer: http://stackoverflow.com/a/20775965
type: Question
has answer: http://stackoverflow.com/a/20775764
has comment: http://stackoverflow.com/comment/31140059
score: 0
has comment: http://stackoverflow.com/comment/31140054
has body: For some, my eclipse IDE complains whenever I do something like this: Map&lt;Type,Type&gt; map = new HashMap&lt;Type,Type&gt;(); it underlines Map and prefers I do something like this: HashMap&lt;Type,Type&gt; map = new HashMap&lt;Type,Type&gt;(); Same goes for all the other interfaces. What could be the problem with my eclipse?
answer count: 4
has answer: http://stackoverflow.com/a/20775846
has title: HASHMAP syntax error in eclipse IDE
type: UnansweredQuestion

http://stackoverflow.com/comment/31207867
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20812648
has text: I tried this and it doesn't seem to be working, I had to move all of my code from my original itemclicklistener to the new one in the customadapter class
type: AnswerComment

http://stackoverflow.com/comment/31121304
has text: I know, but if I try to use the getStringThree from an object declared `BaseInterface obj` the compiler say there's an error. I'd like to limit the getter methods jackson can use.
comment on: http://stackoverflow.com/q/20764956
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20819491
has answer: http://stackoverflow.com/a/20846902
favorite count: 0
has comment: http://stackoverflow.com/comment/31267544
tagged with: metadata
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24444116
tagged with: android-camera-intent
score: 3
tagged with: camera
upvote count: 3
linked to: http://stackoverflow.com/q/2170214
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/8450539
has title: How to save capture image with EXIF
has comment: http://stackoverflow.com/comment/31233167
downvote count: 0
has comment: http://stackoverflow.com/comment/31230690
has body: i'm trying to capture image with android native camera, the save image is good but doesnt contain the usual EXIF data (gps tags, orientation...) what do i need to do to save also the EXIF? @Override public void onClick(View v) { Intent takePictureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // Create the File where the photo should go File photoFile = null; try { photoFile = createImageFile(); } catch (IOException ex) { // Error occurred while creating the File } // Continue only if the File was successfully created if (photoFile != null) { takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(photoFile)); imageuri = Uri.fromFile(photoFile); startActivityForResult(takePictureIntent, CAMERA_PIC_REQUEST); } } /*Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);*/ } } @SuppressLint("SimpleDateFormat") private File createImageFile() throws IOException { // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES); File image = File.createTempFile( imageFileName, /* prefix */ ".jpg", /* suffix */ storageDir /* directory */ ); // Save a file: path for use with ACTION_VIEW intents mCurrentPhotoPath = "file:" + image.getAbsolutePath(); return image; }
has comment: http://stackoverflow.com/comment/31263718
answer count: 3
has answer: http://stackoverflow.com/a/51558818
tagged with: android
has comment: http://stackoverflow.com/comment/31233315
has comment: http://stackoverflow.com/comment/31232978
has comment: http://stackoverflow.com/comment/31269984

http://stackoverflow.com/a/20719748
has body: Most likely you are running into an int overflow. Since hash codes could be arbitrarily large in magnitude, it is conceivable that subtraction would overflow for some pairs of values, producing a positive when subtracting two negative numbers. Replace subtraction with the implementation from Integer to fix this problem: public int compareTo(ShowdownSingleValueVO o) { return Integer.compare(this.hashValue, o.hashValue); }
answers question: http://stackoverflow.com/q/20719685
type: Answer
accepted answer of: http://stackoverflow.com/q/20719685
upvote count: 5
downvote count: 0
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/20835811
linked to: http://stackoverflow.com/q/20037561
type: Question
upvote count: 5
has comment: http://stackoverflow.com/comment/31249697
tagged with: contravariance
answer count: 3
score: 5
has answer: http://stackoverflow.com/a/20835920
has title: what does List<? extends SomeClass> mean?
downvote count: 0
tagged with: covariance
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/31249561
accepted answer: http://stackoverflow.com/a/20835920
has answer: http://stackoverflow.com/a/20835903
tagged with: protocol-buffers
has comment: http://stackoverflow.com/comment/31249644
duplicate of: http://stackoverflow.com/q/252055
has answer: http://stackoverflow.com/a/20835916
possible better answer: http://stackoverflow.com/a/20835903
duplicate of: http://stackoverflow.com/q/9810445
has body: I saw that definition in a protobuf generated java file: java.util.List&lt;? extends xxx.yyy.zzz.proto.BasicMessage.DestInfoOrBuilder&gt; foo(); But what dose &lt;? and extends mean? I can understand List&lt;SomeClass&gt; I can't understand List&lt;? extends SomeClass&gt;..
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/252055
tagged with: java
has comment: http://stackoverflow.com/comment/31249638
has comment: http://stackoverflow.com/comment/31249562

http://stackoverflow.com/a/20782362
answers question: http://stackoverflow.com/q/20782301
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31179127
has comment: http://stackoverflow.com/comment/31187111
has comment: http://stackoverflow.com/comment/31178715
score: 4
has body: Bytes use slightly less space to store but are no faster to use than an integer - since fundamentally all 32 bit processors work in integers anyway. There is no real reason to use byte over integer unless you are storing an array or similar of them where they can then be packed into a smaller space.
downvote count: 0

http://stackoverflow.com/a/20839076
score: 0
answers question: http://stackoverflow.com/q/20831040
has comment: http://stackoverflow.com/comment/31269108
type: Answer
has body: It may be due to dosnt getting user from database. Try to return null when u not found any user from database. Users dbUser = userDAO.getUserByLoginId(email); if(dbUser==null){ return null; } I am also sharing tutorial develop by me for Spring security with UserService. It may be help you for further https://www.mediafire.com/?9e2rd4ozb4qujuj
has comment: http://stackoverflow.com/comment/31268520

http://stackoverflow.com/comment/31007542
has text: @GrIsHu i am working with face change application. SO basically i am using Gesture. but at i can't fix properly. functionality is working fine. But when i set cartoon type image to main picture and touch on that image view then it goes to out of screen. I want to prevent it.. How??
comment on: http://stackoverflow.com/a/20700629
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31124258
score: 0
type: Comment
type: QuestionComment
has text: Have you tried looking it up?
comment on: http://stackoverflow.com/q/20766648

http://stackoverflow.com/comment/31156170
has text: @S.N Yes. Since both of for loops have O(n^2) complexity, practically, they will be O(2*n^2) but since 2 does not depend on x, you can neglect it. So it can be considered as O(n^2) algorithm.
type: Comment
comment on: http://stackoverflow.com/a/20785031
score: 0
type: AnswerComment

http://stackoverflow.com/q/20741168
score: -1
has answer: http://stackoverflow.com/a/20741798
type: Question
tagged with: null
has comment: http://stackoverflow.com/comment/31078610
has comment: http://stackoverflow.com/comment/31078673
favorite count: 0
accepted answer: http://stackoverflow.com/a/20741700
answer count: 3
has answer: http://stackoverflow.com/a/20741399
has title: java object instantiation to return null?
has comment: http://stackoverflow.com/comment/31078153
possible better answer: http://stackoverflow.com/a/20741399
downvote count: 2
upvote count: 1
has body: Maybe it looks like a very ordinary question but I am also surprised at how this can be possible. I am creating an object in one of my class using the following statement: TestVO testVO = new TestVO(); it returns null. However when passing the testVO object to a method( which parses an Excel sheet and sets the data in VO) it does not throw NullPointerException( In eclipse debug mode, testVO value is shown as null). When trying to use the same object in next set of statements, it throws the NPE. I am also surprised why above statement returns null and not assigning the memory to the object. Please note when creating the TestVO class object in another class, it is working fine. This is happening only a particular class. Below is the class source code: public class SheetParser { public SheetParser() { } public void parseSheet(Workbook workbook, List&lt;TestVO&gt; list) { TestVO testVO = null; Row row = null; Cell cell = null; String header = null; boolean hasHeaderRow = false; boolean hasDataRow = false; Sheet sheet = workbook.getSheetAt(0); Iterator&lt;Row&gt; rows = sheet.rowIterator(); List&lt;String&gt; headers = new ArrayList&lt;String&gt;(); try { while (rows.hasNext()) { row = rows.next(); if (row.getRowNum() == 0) { hasHeaderRow = true; int i = 0; while (true) { try { cell = row.getCell(i++); if (cell == null) { break; } cell.setCellType(Cell.CELL_TYPE_STRING); header = cell.getStringCellValue(); if (header == null || "".equals(header.trim())) { break; } headers.add(header.toUpperCase()); } catch (NullPointerException e) { break; } } validateHeaders(headers); } else { hasDataRow = true; testVO = new TestVO(); // HERE the above statement failed to initialized the object // and shows the testVO as null // But below in setRowData method, value is set in testVo // object after reading from excel sheet boolean error = setRowData(testVO, headers, row, errorList); if (!error) { list.add(testVO); } } } } catch (Exception e) { errorList.add(e.getMessage()); } if (!hasHe…
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20741700
tagged with: java

http://stackoverflow.com/comment/31088789
has text: Could you provide some sample code from the tutorial in your post? That way the quality of the answer isn't very relying on an external source and it saves future browsers an extra click.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20746960
score: 1

http://stackoverflow.com/comment/31073248
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20736869
type: AnswerComment
has text: Thanks. Not having my dev env. with me right now but will try this asap. This also means that rJava is a must. If I have an existing R script, then it has to be modified to use rJava now. Is my understanding correct?- Milind

http://stackoverflow.com/comment/31003926
type: Comment
type: QuestionComment
has text: Have you tried the use of `.replaceAll()` ?
comment on: http://stackoverflow.com/q/20700388
score: 0

http://stackoverflow.com/comment/31099199
score: 0
has text: Is data filled with bytes after `blob.getBytes()` ?
type: Comment
comment on: http://stackoverflow.com/q/20752432
type: QuestionComment

http://stackoverflow.com/comment/31095123
score: 0
type: Comment
type: QuestionComment
has text: I removed your android tag because this is java question.
comment on: http://stackoverflow.com/q/20750311

http://stackoverflow.com/a/20759635
type: Answer
has body: for(String string : mCha) // line 1 { // loop working } here mCha is a collection could be array, list or anything and the for loop (this is a special case of for loop) above is scanning each string from starting through end of the array or the list
score: 0
answers question: http://stackoverflow.com/q/20759528

http://stackoverflow.com/comment/31209849
score: 0
type: Comment
has text: @Giannis I agree, but I thought it should be here because it makes life much simpler after you learn the basics. If someone really wants to know the basics I would suggest writing it without even the java.util.Scanner class, i.e. read using FileInputStream, read the bytes and divide to lines, that would be the best learning exercise.
type: AnswerComment
comment on: http://stackoverflow.com/a/20813968

http://stackoverflow.com/q/20799515
type: Question
tagged with: ssl
has title: Tomcat / Servlet: How to install certificates without restart
tagged with: tomcat
tagged with: servlets
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: keystore
has body: I'm doing multi domain virtual hosting with one Tomcat application. The domains I use are stored in a database. The app works well enough so that I don't have to restart tomcat in normal operation. The problem is: Everytime I add a new domain for https to work I have to add another ip-address and a certificate in server.xml and do a restart. I would like to get rid of the restarts. So is there a way to add (ip-addresses / certificates) to tomcat without restarting it? I would consider anything from an "Tomcat Manager App Plus" to patching the keystore and tomcats connector or even using another Servlet Container if it's capable of doing this. (While the best solution for me would be something where I could store all my certs in the database because I already have a managing app for that) Thanks in advance! EDIT: Just to be clear: I'm currently using one webapp with multiple connectors. The webapp decides which content to deliver based on the request url.
has answer: http://stackoverflow.com/a/20800190
tagged with: java

http://stackoverflow.com/comment/30983505
type: AnswerComment
score: 0
type: Comment
has text: Unfortunately you are not showing all of the code. Either way you will have to pull it apart (divide and conquer). Start commenting out lines of code and compile again. Is that add() inherited?
comment on: http://stackoverflow.com/a/20688038

http://stackoverflow.com/a/20697725
has comment: http://stackoverflow.com/comment/31003563
has body: If you don't know the depth of the category tree, you can still generate your menu using recursion. Using the same Model as Loc in the previous response, you have to define a jsp page called menuitem.jsp, which will be called recursively: &lt;li&gt; &lt;a href="#"&gt;${menuitem.name}&lt;/a&gt; &lt;c:if test="${fn:length(menuitem.subCategories) gt 0}"&gt; &lt;ul class="droprightMenu"&gt; &lt;c:forEach var="menuitem" items="${menuitem.subCategories}"&gt; &lt;c:set var="menuitem" value="${menuitem}" scope="request" /&gt; &lt;jsp:include page="menuitem.jsp" /&gt; &lt;/c:forEach&gt; &lt;/ul&gt; &lt;/c:if&gt; &lt;/li&gt; In our main JSP page, initialise the variable menuitem and include the jsp. &lt;c:set var="menuitem" value="${rootMenu}" scope="request" /&gt; &lt;jsp:include page="menuitem.jsp" /&gt;
type: Answer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/20689865
score: 5

http://stackoverflow.com/q/20844613
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31266622
has comment: http://stackoverflow.com/comment/31269111
accepted answer: http://stackoverflow.com/a/20844694
has comment: http://stackoverflow.com/comment/31265746
type: Question
possible better answer: http://stackoverflow.com/a/20844901
has body: This should be the result, a little program finding the answers on the equation: a*x + b*y + c*z = d I'm still working on the algorithm but it asks me to give a return statement while I have one. Or does the compiler say that because it is possible the return statement doesn't get executed when the evaluation of the if-condition is false? public static String zoekAlleOplossingen(int a, int b, int c, int d, int begingrens, int eindgrens) { int y = begingrens, z = begingrens; for (int x = begingrens; x &lt; eindgrens; ++x) { if (((a*x) + (b*y) + (c*z)) == d) { return "" + a + "*" + x + " + " + b + "*" + y + " + " + c + "*" + z + " = " + d + ""; } } } And for the people asking about why I'm using the return (someone please embed the image). Here is a UML diagram where you can clearly see it is expected in this exercise to use a String as return type in this method.: http://i41.tinypic.com/s62a06.jpg
has answer: http://stackoverflow.com/a/20844901
has comment: http://stackoverflow.com/comment/31265781
has comment: http://stackoverflow.com/comment/31269070
answer count: 2
has comment: http://stackoverflow.com/comment/31269356
favorite count: 0
has answer: http://stackoverflow.com/a/20844694
has title: Compiler asking for return statement when one has been supplied
has comment: http://stackoverflow.com/comment/31265732
upvote count: 1
has comment: http://stackoverflow.com/comment/31269537
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/20785103
score: 2
has comment: http://stackoverflow.com/comment/31183450
has comment: http://stackoverflow.com/comment/31156177
downvote count: 0
has comment: http://stackoverflow.com/comment/31159370
answers question: http://stackoverflow.com/q/20784619
has body: Integer are cached between range -128 to 127. so Integer in between the range(containing boundary values) will return the same reference.. like Integer i3 = 127; Integer i4 = 127; Integer i5 = 128; if(i3!=i4)System.out.println("Crap dude!!"); // same reference if(i3 == i4) System.out.println("same object"); if(i3 != i5) System.out.println("different object"); output.. same object different object As '==' compares reference and 'equals' compares content. for more detail You may go to Immutable Objects / Wrapper Class Caching
has comment: http://stackoverflow.com/comment/31182727
type: Answer
has comment: http://stackoverflow.com/comment/31184306
upvote count: 2

http://stackoverflow.com/a/20680927
score: 0
has comment: http://stackoverflow.com/comment/30968887
type: Answer
has body: You need one more </LinearLayout> at the end of your xml file. At the minute, only 2 of the 3 LinearLayout's are being closed. EDIT The reason your Buttons are appearing at the bottom is because of this: I'm not sure what purpose this serves in your application, but removing that will fix your problem.
answers question: http://stackoverflow.com/q/20680847

http://stackoverflow.com/a/20817864
answers question: http://stackoverflow.com/q/20817818
has body: you need to check hasNext() before everytime you call scanner.next() so your first_name = scanner.next() statement will never fail, but after this statement executes, you don't check scanner.hasNext()
score: 0
type: Answer

http://stackoverflow.com/q/20820213
has comment: http://stackoverflow.com/comment/31220774
has body: Try to backup mysql DB from Java application (IDE Netbeans) using the following command but can't seem to find the file even though I specified a path: Runtime.getRuntime().exec("C:\\Program Files\\MySQL\\MySQL Server 5.6\\bin\\mysqldump "+fisier.getName()+" &gt; C:\\"+fisier.getName()+".sql;"); Also, I don't receive any errors, so I assumed that the backup has been done. How can I find the file? Regarding fisier.getName(): File fisier = jFileChooserSave.getSelectedFile();
has answer: http://stackoverflow.com/a/20820430
accepted answer: http://stackoverflow.com/a/20820430
has comment: http://stackoverflow.com/comment/31220576
downvote count: 0
score: 6
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/37829318
has title: mysqldump from java application
answer count: 2
has comment: http://stackoverflow.com/comment/31220547
possible better answer: http://stackoverflow.com/a/37829318
upvote count: 6
has comment: http://stackoverflow.com/comment/31220814
favorite count: 0
has comment: http://stackoverflow.com/comment/31220598

http://stackoverflow.com/comment/30982912
comment on: http://stackoverflow.com/q/20687142
score: 1
type: Comment
type: QuestionComment
has text: `0:0:0:0:0:0:0:1` is an IPv6 IP address. You need to ensure you set it to IPv4 if you want only the IPv4 response. See @Javier's answer.

http://stackoverflow.com/comment/31231615
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20826145
has text: Yes, so this case can write A - B but it's prefer to use Integer#compare because if always write Integer#compare, then don't care about overflow and underflow that may cause IllegalArgumentException or odd phenomenon(odd sorting) when Collections.sort. So, I suggest always write Integer.compare(A, B) instead A - B.
type: AnswerComment

http://stackoverflow.com/q/20742331
tagged with: httprequest
score: 0
answer count: 1
has title: Advice for Java based pipeline structure
type: UnansweredQuestion
has body: I really need a good advice for the following scenario. Actually it is simple structure As you can see in schema there are requests which will be handled by Java and some information in this request will be put in Amazon DynamoDb. There might be really thousands of requests per second and it should handle heavy requests. I have basic structure in my mind Use Spring or Lift framework to handle the request Put item in a kind of pipeline ( I need your strong advice here for pipeline library, is apache pipeline still active? ) Put items to dynamodb with multi-thread running jobs. As you can see this is really simple stuff. What would be the best way to implement this structure? I'm open for all kind of suggestions about the structure, library and methods. Thanks.
tagged with: spring
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/20742420
type: Question
has comment: http://stackoverflow.com/comment/31081417

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

http://stackoverflow.com/comment/31137619
comment on: http://stackoverflow.com/a/20774413
type: AnswerComment
has text: And in your method's signature have: `public static void countDown()`
score: 4
type: Comment

http://stackoverflow.com/comment/31105390
score: 1
comment on: http://stackoverflow.com/q/20755746
has text: rather than fourth += fourthNormals[i].length()+third+second+first; use fourth += fourthNormals[i].length()+third+first;
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20703236
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20702622
has body: You should write an Iterator implementation where each call to next() give you the next sorted item. It won't take no additional memory, but the amount of additional memory will be small compared to duplicating the unordered Set. You also won't have a new Set, but you will be able to iterate through it. A low-memory version, but inefficient algorithm would store the most recently accessed item in the Iterator. Every time you needed to return the next item, you'd go through all the items in the backing Set to figure out which was next.

http://stackoverflow.com/q/20808392
has title: JODConverter converts files when the service is stopped?
has body: I'm working with JODConverter bundled with Alfresco Enterprise 4.1.4 (I believe the JODConverter version is 3.2). I'm using it through the Alfresco RenditionService. I'm trying to recreate a timeout error by stopping JODConverter before sending a conversion request. I used several word documents of different sizes, with and without formatting or images. Sometimes when JODConverter is stopped, the timeout error (see below) is thrown. But, other times, even with the same document, the PDF generates perfectly. Is there some feature of either Alfresco or JODConverter that explains why this is happening? Code: String targetRenditionName = "pdfRendition"; String targetMimetype = MimetypeMap.MIMETYPE_PDF; RenditionDefinition renditionDef = getRenditionDefinition(targetRenditionName, targetMimetype); ChildAssociationRef renditionAssoc = registry.getRenditionService().render(nodeRef, renditionDef); Stack Trace: Caused by: org.artofsolving.jodconverter.office.OfficeException: task did not complete within timeout at org.artofsolving.jodconverter.office.PooledOfficeManager.execute(PooledOfficeManager.java:88) at org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.execute(ProcessPoolOfficeManager.java:78) at org.artofsolving.jodconverter.OfficeDocumentConverter.convert(OfficeDocumentConverter.java:78) at org.artofsolving.jodconverter.OfficeDocumentConverter.convert(OfficeDocumentConverter.java:69) at org.alfresco.enterprise.repo.content.transform.JodContentTransformer.convert(JodContentTransformer.java:62) at org.alfresco.repo.content.transform.OOoContentTransformerHelper.transform(OOoContentTransformerHelper.java:364) 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.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invo…
tagged with: openoffice.org
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31205335
has comment: http://stackoverflow.com/comment/31260467
score: 0
tagged with: java
tagged with: jodconverter
type: Question
tagged with: alfresco

http://stackoverflow.com/comment/31014380
score: 0
type: Comment
has text: @yonitdm There are a /lot/ of problems with the way this is structured, but I'm sure this is a more intro class to java and I don't think it helps to overwhelm him at this point.
comment on: http://stackoverflow.com/a/20705923
type: AnswerComment

http://stackoverflow.com/a/20682622
answers question: http://stackoverflow.com/q/20681815
score: 0
type: Answer
has body: you can use string replace after converting the array to string as, JSONArray jsonArray = new JSONArray(); jsonArray.put(1); jsonArray.put("empty"); jsonArray.put(2); jsonArray.put(3); jsonArray.put("empty"); jsonArray.put(4); jsonArray.put("empty"); System.err.println(jsonArray); String jsonString = jsonArray.toString(); String replacedString = jsonString.replaceAll("\"empty\",", "").replaceAll("\"empty\"", ""); jsonArray = new JSONArray(replacedString); System.out.println(jsonArray); Before replace: jsonArray is [1,"empty",2,3,"empty",4,"empty"] After replace: jsonArray is [1,2,3,4]

http://stackoverflow.com/comment/32900699
comment on: http://stackoverflow.com/q/20748988
score: 0
type: Comment
type: QuestionComment
has text: Can you run your app inside Eclipse MAT to see where the leak is coming from?

http://stackoverflow.com/comment/31097076
score: 0
type: QuestionComment
has text: Is is a boolean `false` or the string literal "false"?
type: Comment
comment on: http://stackoverflow.com/q/20750932

http://stackoverflow.com/comment/31079388
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20741916
has text: So...what ? What's your problem/error ? :)
type: Comment

http://stackoverflow.com/q/20715481
has answer: http://stackoverflow.com/a/20715616
accepted answer: http://stackoverflow.com/a/20715616
downvote count: 1
has body: Suppose we have a set of keys: &lt;54, 18, 10, 25, 28, 36, 38, 41, 12, 90>. Use the hashing function key % N to map each key into the following array. If there is a collision, use the separate chaining technique. And below is just the pictorial of the array with the array labelled A and it is of size 13 so the picture is the array cells listed 0-12. N=13. My understanding so far of hashing for this problem is that I need to arrange the keys given into the array using the function key % 13 (N being equal to 13). But my book doesn't give examples of different functions. The only example it uses is an alphabetizing one with first letters of last names. Can anyone give me a brief explanation without just giving me the answer?
has title: Hashing Functions and Hash Tables
favorite count: 0
has comment: http://stackoverflow.com/comment/31032070
tagged with: hash
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20715562
has answer: http://stackoverflow.com/a/20715562
score: 1
tagged with: java
type: Question
upvote count: 2
answer count: 2
tagged with: arrays

http://stackoverflow.com/comment/31142287
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20776885
has text: *"last valid value"* 1) What conditions determine what is valid? 2) Why not simply supply a `SpinnerModel` that only has valid values? 3) For better help sooner, post an [SSCCE](http://sscce.org/).

http://stackoverflow.com/comment/59073681
comment on: http://stackoverflow.com/a/35295616
type: AnswerComment
has text: I think it should work for pre-lollipop as well, because you use the v7 compat lib
type: Comment
score: 2

http://stackoverflow.com/comment/31234575
type: AnswerComment
comment on: http://stackoverflow.com/a/20794551
score: 0
type: Comment
has text: wow worked like a charm. Thanks a bunch. it never ccured to me to reinitiate the Iterator. in my opinion Iterator needs so much nitpicking that is not worth the trouble

http://stackoverflow.com/comment/31117790
type: Comment
comment on: http://stackoverflow.com/a/20763269
has text: what do you mean? GRID_DATA[i] = name; with that the value is passed right? also the app starts to get not responded when on the fragment
score: 0
type: AnswerComment

http://stackoverflow.com/a/20746586
has comment: http://stackoverflow.com/comment/31090185
has body: Found the answer, hopefully this will help someone else. The Id's in my DB are autoincrementing (I know, there's all kinds of debate on that, but it's what I have to work with), so once I added the annotation @GeneratedValue(strategy=GenerationType.IDENTITY) to the Tweet's Id property, everything started working.
type: Answer
has comment: http://stackoverflow.com/comment/31088326
answers question: http://stackoverflow.com/q/20746029
score: 0

http://stackoverflow.com/comment/31155238
has text: @smriti3 can you specify what error you have. maybe i can help. i was pretty sure it had nothing to do with the above code that is why i asked you to try with anew project
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20784139
type: AnswerComment

http://stackoverflow.com/a/20750170
has body: If you still have all the values you worked out then just accumulate a long millisecond count as you go and use that. If not then there are a few ways, the simplest is probably going to be: String[] split = duration.split(":"); long duration = Long.parseLong(split[0])*60*60*1000 + Long.parseLong(split[1])*60*1000; You can then loop through adding up all those durations, then at the end convert it back to a String. Really you should store the millisecond count in your database and then convert it to text to display though.
score: 0
answers question: http://stackoverflow.com/q/20750097
type: Answer

http://stackoverflow.com/q/20726118
has comment: http://stackoverflow.com/comment/31051747
has comment: http://stackoverflow.com/comment/31051670
has comment: http://stackoverflow.com/comment/31051516
has comment: http://stackoverflow.com/comment/31051734
has answer: http://stackoverflow.com/a/20726253
has comment: http://stackoverflow.com/comment/31051562
has title: Remove Extra Space At End
has comment: http://stackoverflow.com/comment/31051579
has comment: http://stackoverflow.com/comment/31051610
has comment: http://stackoverflow.com/comment/31051650
has comment: http://stackoverflow.com/comment/31051737
has comment: http://stackoverflow.com/comment/31051580
has comment: http://stackoverflow.com/comment/31051645
has answer: http://stackoverflow.com/a/20726313
answer count: 3
has comment: http://stackoverflow.com/comment/31051587
has comment: http://stackoverflow.com/comment/31051535
has comment: http://stackoverflow.com/comment/31051638
favorite count: 0
possible better answer: http://stackoverflow.com/a/20726313
accepted answer: http://stackoverflow.com/a/20726253
has answer: http://stackoverflow.com/a/20726175
upvote count: 2
has comment: http://stackoverflow.com/comment/31051578
has comment: http://stackoverflow.com/comment/31051599
has comment: http://stackoverflow.com/comment/31051690
has comment: http://stackoverflow.com/comment/31051712
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31051581
has comment: http://stackoverflow.com/comment/31051665
tagged with: java
has comment: http://stackoverflow.com/comment/31051671
has comment: http://stackoverflow.com/comment/31051609
has comment: http://stackoverflow.com/comment/31051695
has comment: http://stackoverflow.com/comment/31051548
downvote count: 1
type: Question
has body: I wrote this in Java, and I want the output such that it creates a space after every value except for the last one. How do I get it to show up like 1[]2[]3[]4[]5[]6[]7 rather than 1[]2[]3[]4[]5[]6[]7[] ? Here is my code! public class Pentagonal { public static void main(String[] args) { int n, x, n1; Scanner input = new Scanner(System.in); System.out.print("Enter an integer: "); n = input.nextInt(); n1 = 1; System.out.print("The pentagonal numbers are: "); while (n1 &lt;= n) { x = (3 * n1 * n1 - n1) / 2; if (n1 == n) System.out.print(x); else System.out.print(x + " "); n1++; } } }
has comment: http://stackoverflow.com/comment/31051600

http://stackoverflow.com/comment/31101342
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20753407
type: Comment
has text: Do you have recursion?

http://stackoverflow.com/comment/31003687
type: Comment
has text: a NetworkInfo object for the current default network or null if no network default network is currently active.
comment on: http://stackoverflow.com/a/20700234
type: AnswerComment
score: 0

http://stackoverflow.com/q/20749806
has answer: http://stackoverflow.com/a/76964084
answer count: 2
tagged with: jpa
downvote count: 0
upvote count: 11
favorite count: 0
possible better answer: http://stackoverflow.com/a/76964084
tagged with: one-to-many
has body: I'm working on a Java project using JPA 2 + Hibernate 4.2.6 and I'm getting a strange behaviour. In my model I have two related entites: Question and Answer @Entity public class Question { // ... @OneToMany(mappedBy = "question", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set&lt;Answer&gt; answers; // ... } @Entity public class Answer { // ... @ManyToOne(optional = false) @JoinColumn(name = "question_id", nullable = false) private Question question; // ... } This works perfectly: all Answers related to a certain Question are loaded correctly. But now I need to change the tipe of answers collecton from Set to List. I changed the type and ran the application again and now I get several duplicates in answers... Why is it possible? I know that List allows duplicates, but there are no duplicate records in my DB, so why I get these? I read about some similar bugs in previous version of Hibernate, but I expect they are solved in last version... am I wrong? NOTE I need to change Set into List because I need to keep information about the order for answers and, possibly, to change this order.
has answer: http://stackoverflow.com/a/20750258
accepted answer: http://stackoverflow.com/a/20750258
tagged with: collections
score: 11
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Duplicates in OneToMany annotated List
type: Question

http://stackoverflow.com/a/20689087
answers question: http://stackoverflow.com/q/20687943
type: Answer
has comment: http://stackoverflow.com/comment/30984726
score: 1
upvote count: 1
has body: You'd need to implement your own ViewResolver and a View that returns a particular HTTP status code. You can extend InternalResourceViewResolver (or whatever you're using now). public class MyViewResolver extends InternalResourceViewResolver { public static final String HTTP_404_VIEW = "http404view"; public View resolveViewName(String viewName, Locale locale) throws Exception { if (HTTP_404_VIEW.equals(viewName)) { return new StatusCodeView(404); } else { return super.resolveViewName(viewName, locale); } } } public class StatusCodeView implements View { private final int code; public StatusCodeView(int code) { this.code = code; } public void render(Map model, HttpServletRequest request, HttpServletResponse response) { response.sendError(this.code); } } In your controller, just return MyViewResolver.HTTP_404_VIEW.
downvote count: 0

rest
tags question: http://stackoverflow.com/q/20806122
tags question: http://stackoverflow.com/q/20772810
tags question: http://stackoverflow.com/q/20710422
tags question: http://stackoverflow.com/q/20785205
tags question: http://stackoverflow.com/q/20773123
tags question: http://stackoverflow.com/q/20743482
tags question: http://stackoverflow.com/q/20748079
tags question: http://stackoverflow.com/q/20761732
tags question: http://stackoverflow.com/q/20777951
tags question: http://stackoverflow.com/q/20728098
tags question: http://stackoverflow.com/q/20744421
tags question: http://stackoverflow.com/q/20737778
tags question: http://stackoverflow.com/q/20694965
tags question: http://stackoverflow.com/q/20762394
tags question: http://stackoverflow.com/q/20743858
tags question: http://stackoverflow.com/q/20841331
tags question: http://stackoverflow.com/q/20745168
tags question: http://stackoverflow.com/q/20814237
tags question: http://stackoverflow.com/q/20803915
tags question: http://stackoverflow.com/q/20718337
tags question: http://stackoverflow.com/q/20813767
tags question: http://stackoverflow.com/q/20735289
tags question: http://stackoverflow.com/q/20802032
tags question: http://stackoverflow.com/q/20824809
tags question: http://stackoverflow.com/q/20744332
tags question: http://stackoverflow.com/q/20795104
tags question: http://stackoverflow.com/q/20788625
tags question: http://stackoverflow.com/q/20846327
tags question: http://stackoverflow.com/q/20747532
tags question: http://stackoverflow.com/q/20760945
tags question: http://stackoverflow.com/q/20804768
tags question: http://stackoverflow.com/q/20711097
tags question: http://stackoverflow.com/q/20760244
tags question: http://stackoverflow.com/q/20687251
tags question: http://stackoverflow.com/q/20694138
tags question: http://stackoverflow.com/q/20713086
type: Tag
tags question: http://stackoverflow.com/q/20744955
tags question: http://stackoverflow.com/q/20843911
tags question: http://stackoverflow.com/q/20763493
tags question: http://stackoverflow.com/q/20762707
tags question: http://stackoverflow.com/q/20686164
tags question: http://stackoverflow.com/q/20699128
tags question: http://stackoverflow.com/q/20839046
tags question: http://stackoverflow.com/q/20683114
tag name: rest
tags question: http://stackoverflow.com/q/20761425
tags question: http://stackoverflow.com/q/20816451
tags question: http://stackoverflow.com/q/20741365
tags question: http://stackoverflow.com/q/20813517
tags question: http://stackoverflow.com/q/20743426
tags question: http://stackoverflow.com/q/20801961
tags question: http://stackoverflow.com/q/20733444
tags question: http://stackoverflow.com/q/20762109
tags question: http://stackoverflow.com/q/20762160
tags question: http://stackoverflow.com/q/20782722

http://stackoverflow.com/q/20831689
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31242403
answer count: 3
has body: I have downloaded and installed java runtime envirement. Then i checked it using the java verification tool and it says that it's successfully installed but eclipse still won't work and alerting that a java runtime envirement or java development kit is required to run eclipse. Java verification tool result: Eclipse launcher error: How to solve this problem?
downvote count: 0
has comment: http://stackoverflow.com/comment/31242604
favorite count: 0
has title: Java successfully installed but eclipse won't launch
accepted answer: http://stackoverflow.com/a/20831876
has comment: http://stackoverflow.com/comment/31242418
has comment: http://stackoverflow.com/comment/31242392
has comment: http://stackoverflow.com/comment/31242574
score: 2
has comment: http://stackoverflow.com/comment/31242704
has comment: http://stackoverflow.com/comment/31242636
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/20831741
has answer: http://stackoverflow.com/a/20831743
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31242352
possible better answer: http://stackoverflow.com/a/20831743
has answer: http://stackoverflow.com/a/20831876

http://stackoverflow.com/q/20694122
has title: If option works but else if does not
score: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20694139
has answer: http://stackoverflow.com/a/20694139
has body: i have a method i am working on, its part of a larger program but i think the code i posted will be enough. When i select option 1 in my menu, it works as it should, but when i select option 2 , it just ends the program. can anybody spot the issue? Resolved : the choice == 1 should be 2. Can i also add to this question, would it be best to put the in putted data into an array, if so, should i declare the array in the main class,superclass or the Sub class static void addBook(){ String title,author; int choice; boolean onLoan; loanbook book1; // TESTING ONLY System.out.print("Press 1 for Fiction or 2 for Non Fiction: "); // sub menu for fiction and non fiction choice = keyboard.nextInt(); if (choice == 1){ System.out.println("Please enter book title: "); title = keyboard.nextLine(); title = keyboard.nextLine(); System.out.println("Please enter book author: "); author = keyboard.nextLine(); onLoan = false; // not used yet book1 = new fiction(title,author); System.out.println(book1.toString()); } else if (choice == 1) { System.out.println("Please enter book title: "); title = keyboard.nextLine(); title = keyboard.nextLine(); ; System.out.println("Please enter book author: "); author = keyboard.nextLine(); onLoan = false; // not used yet book1 = new nonfiction(title,author); System.out.println(book1.toString()); } }
has answer: http://stackoverflow.com/a/20694505
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/30993487
upvote count: 4
answer count: 3
accepted answer: http://stackoverflow.com/a/20694505
downvote count: 0
has answer: http://stackoverflow.com/a/20694130
favorite count: 0
has comment: http://stackoverflow.com/comment/30993453

http://stackoverflow.com/a/20840586
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20840540
answers question: http://stackoverflow.com/q/20840540
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31258287
has body: Color isn't really an object. It has a public constructor, yes, but it has no member data nor instance methods. It's just a class with static methods to construct ARGB color int values. There are some ARGB ints predefined, such as Color.CYAN. So to use it, use an int: int mColor = Color.CYAN; Reference: http://developer.android.com/reference/android/graphics/Color.html

http://stackoverflow.com/q/20721561
tagged with: eclipse
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/31093559
answer count: 1
has body: I have java class which has a main method and calls a bash script. What it does in se is generate a value. What I am trying to accomplish is inject this output in the java class itself. I have tried by using the sed command which basically replaces all keywords that match the regex with the proposed change. I made sure Maven runs the class before the actual build happens. However, as you might already know, my changes do not stick. I have read here that Eclipse is trying to be smart and not build files that have not changed. However, the manual way of trigger a build 'javac' does not seem to make my changes permanent. Any solution on how I can make the output of the bash command a static value in the java class? Thanks in advance. You're help is more than appreciated.
favorite count: 0
has comment: http://stackoverflow.com/comment/31049305
has title: How overwrite .class file from terminal
tagged with: terminal
tagged with: bash
has comment: http://stackoverflow.com/comment/31042872
has answer: http://stackoverflow.com/a/20730129
has comment: http://stackoverflow.com/comment/31043295
type: UnansweredQuestion
tagged with: maven
downvote count: 1
tagged with: java
score: -1

http://stackoverflow.com/q/20711903
has comment: http://stackoverflow.com/comment/31054251
score: 3
linked to: http://stackoverflow.com/q/2183974
downvote count: 0
has comment: http://stackoverflow.com/comment/31025489
has title: How is threading done for Google Cloud Endpoints handlers in Java?
favorite count: 0
has comment: http://stackoverflow.com/comment/49278804
has comment: http://stackoverflow.com/comment/31027016
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/31026987
tagged with: google-cloud-endpoints
answer count: 0
upvote count: 3
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31066642
type: Question
has body: I'm noticing some strange behavior in my app that smells like a lack of thread-safety. I'm working on reproducing it, but in the meantime I wanted to ensure I'm making the right assumptions about how the class that contains my endpoint handlers is used from a threading perspective. Most of what happens is opaque to me, because I'm not the one instantiating the class in the first place. To state the obvious, it must be some black magic in Endpoints. MY ASSUMPTION An instance of the class that holds my endpoint handlers is created for every single request that comes into my app. Based upon that assumption, it's ok for that class to have non-thread-safe objects that get used by my handlers. MY FEAR The instances of Endpoint handler classes are reused across requests. So, which is it? Regardless of the answer, I think it would make sense for me to remove the ambiguity in my app and assume the worst, because I don't think I have any control over how Endpoints behaves. In my case, I'm creating a JDO/DataNucleus PersistenceManager (not thread-safe) when constructing the class housing my endpoint handlers. I should probably just create it in each handler as a local, or use a ThreadLocal. I can probably also fashion a test to prove one or the other. I'll post back an answer to my own question if I do.

http://stackoverflow.com/a/20729551
type: Answer
has body: You should always post your error for us to see, otherwise it's much harder to help you. I think your error is very simple. Just go to your main activity, where the java code is and press and hold Shift Ctrl O Shift Ctrl O
answers question: http://stackoverflow.com/q/20729506
score: 0
has comment: http://stackoverflow.com/comment/31058298

http://stackoverflow.com/a/20767321
answers question: http://stackoverflow.com/q/20767066
type: Answer
has body: The right side expression does two things. // instantiate new 2D array // ┌──────┸───────┑ ┌ access zeroth element of new 2D array // │ │ │ int[] array = new int[][]{{1}} [0]; This is basically equivalent to the following: int[][] array2D = new int[1][1]; array2D[0][0] = 1; int[] array = array2D[0];
upvote count: 3
score: 3
downvote count: 0

report
tags question: http://stackoverflow.com/q/20779971
type: Tag
tag name: report

http://stackoverflow.com/comment/31156447
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20782307
has text: You can see having clause in sumFrom. You can add multiple having using logical operator e.g. having().add(having()).or(having()). Please refer this presentation. It might help you. http://lambdaj.googlecode.com/files/lambdaj-javaone-slides.pdf

http://stackoverflow.com/q/20843918
type: Question
has answer: http://stackoverflow.com/a/46576298
has comment: http://stackoverflow.com/comment/31269892
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Why does the basic AUTH box pop up twice in Chrome but not Firefox with spnego SSO
linked to: http://stackoverflow.com/q/20341553
tagged with: spnego
has body: I have a pretty vanilla spnego SSO setup which is authenticating against an Active Directory server. The IE SSO contains the NEGOTIATE header cookie which is authenticating correctly without any prompting the user. Firefox and Chrome do not contain the SSO cookie, and hence fail back to the basic authentication. They do receive the username and password correctly and log in properly. However, my minor annoyance is that it is prompting once in Firefox, but in Chrome it is prompting for the password twice. Any ideas on why it could be prompting twice? Setup below for completeness: SpnegoHttpFilter net.sourceforge.spnego.SpnegoHttpFilter spnego.allow.basic true spnego.allow.localhost true spnego.allow.unsecure.basic true spnego.login.client.module spnego-client spnego.krb5.conf xxxxxxxxxxxxx/krb5.conf spnego.login.conf xxxxxxxxxxxx/login.conf spnego.preauth.username xxxxxxxxxxxxxxxx spnego.preauth.password xxxxxxxxxxxxxxxx spnego.login.server.module spnego-server spnego.prompt.ntlm true spnego.allow.delegation true
has comment: http://stackoverflow.com/comment/46129409
score: 2
tagged with: single-sign-on
upvote count: 2
tagged with: java

http://stackoverflow.com/q/20732928
has body: I am trying to connect with a Biometric Fingerprint Attendance Device using a Java Program. The device I am using is a Pegasus T5 Fingerprint scanner. Unfortunately their SDK for this device (which can be downloaded here) covers only C#, .Net, and VB which I have no expertise. And when I have requested the manufacturers, they have replied that there is no Java SDK for the device. Even though I have no knowledge on any of those languages, I gave a try to understand the codes in the SDK to find out how the device is connecting and I saw that it is just making a connection with the device using the network ip and port number. If you refer to the C# SDK of the device, you can see the example I saw on this at frmEvent.cs which in the cmdStartMoniter_Click method, make the connection as follows. bRet = bpc.StartEventCapture(0, util.pubIPAddrToLong(txtSourceIP.Text), Convert.ToInt32(txtPortNumber.Text)); And that refers to the method StartEventCapture as public virtual bool StartEventCapture(int dwCommType, int dwParam1, int dwParam2); which is in a .dll file as it appears and which I have lost my track as I have further knowledge on how to figure out the code. However keeping that example I had seen in my head, as my next step I started researching for a global standard on how to connect, send and retrieve data with a Fingerprint Device which again I wasn't lucky enough to find a clear solution. But with some examples from some people who have been trying to deal with the same and the example I saw by myself, I tried to connect with the device by creating a Socket object but when I executed it, it only resulted with the java.net.ConnectException: Connection timed out: connect There are four questions Is there any Java SDK for Biometric Fingerprint Attendance Devices which I can use for my device as well? Is there any general, standard way to connect, send and retrieve data from such device using Java? If connecting to the device via a Socket is a solution, is there any sp…
tagged with: fingerprint
has comment: http://stackoverflow.com/comment/31063926
answer count: 3
downvote count: 0
favorite count: 0
tagged with: sockets
upvote count: 6
has comment: http://stackoverflow.com/comment/31078422
has comment: http://stackoverflow.com/comment/31078251
has title: Retrieving data from Biometric Fingerprint Attendance Device
has answer: http://stackoverflow.com/a/45966998
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/65892204
tagged with: java
score: 6
type: Question
has answer: http://stackoverflow.com/a/23957347
has comment: http://stackoverflow.com/comment/31077264
tagged with: biometrics
has answer: http://stackoverflow.com/a/42456183
tagged with: network-programming
linked to: http://stackoverflow.com/q/23990924

http://stackoverflow.com/q/20704724
has body: Spinner Spte1; String[] path1 ={"Celsius", "Kelvin","Farenheit"}; Spinner Spte2; String[] path2 ={"Celsius","Kelvin","Farenheit"}; EditText ETTE1; EditText ETTE2; now the second code Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub int position1 = Spte1.getSelectedItemPosition(); switch (position1){ case 0: break; case 1: break; case 2: break ; } } but i need to make code to chose between first item in first spinner and connected with second spinner and ad number in first text then the resuslt in the second text i need the code alowe me to make this action appreciate .
type: Question
has answer: http://stackoverflow.com/a/20705179
tagged with: android-spinner
has title: onitemclicklistener connected with 2 spinners
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20705179
tagged with: android
has comment: http://stackoverflow.com/comment/31011978
type: AnsweredQuestion
tagged with: java

actionresult
tags question: http://stackoverflow.com/q/20780945
type: Tag
tag name: actionresult
tags question: http://stackoverflow.com/q/20811494

http://stackoverflow.com/comment/31238541
score: 2
comment on: http://stackoverflow.com/q/20829716
type: QuestionComment
has text: If it were `null`, you'd get NPE. Will you show us `Scrapper#scrape` please?
type: Comment

http://stackoverflow.com/comment/31156963
has text: Which error ???? At tun time only exceptions are there. No Runtime error.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20785586
type: Comment

http://stackoverflow.com/comment/31206545
type: QuestionComment
type: Comment
score: 1
has text: "and my classes don't have default constructor" - well how would you know what arguments to pass to the constructor then?
comment on: http://stackoverflow.com/q/20812663

http://stackoverflow.com/q/20739600
has comment: http://stackoverflow.com/comment/31075554
favorite count: 0
accepted answer: http://stackoverflow.com/a/20739610
has answer: http://stackoverflow.com/a/20739632
possible better answer: http://stackoverflow.com/a/20739711
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20739711
has title: Set<String> doesn't maintain order the same as the order the elements were added in
has answer: http://stackoverflow.com/a/20739626
has answer: http://stackoverflow.com/a/20739635
upvote count: 3
tagged with: java
tagged with: set
has body: Edit: this is actually for an Android application, which means (as far as I know), I can only use a HashSet. Set&lt;String&gt; set = new HashSet&lt;String&gt;(); set.add("1"); set.add("2"); set.add("3"); set.add("4"); set.add("5"); set.add("6"); set.add("7"); set.add("8"); String[] array = set.toArray(new String[0]); // convert the set to an array System.out.println(Arrays.toString(array)); // test what the set looks like The output of that is [3, 2, 1, 7, 6, 5, 4, 8] I expected [1, 2, 3, 4, 5, 6, 7, 8] because I assumed it would add the Strings to the Set in order of when I added them. In my application, it's essential that the order of the Set is in the order that the elements were added to the Set. Is there any reason that this Set is out of order? Or is there a way to put it back into the order that the elements were added in?
downvote count: 1
type: Question
tagged with: setstring
has answer: http://stackoverflow.com/a/20739653
answer count: 6
has answer: http://stackoverflow.com/a/20739610

http://stackoverflow.com/comment/31106961
has text: It would help to explain what was wrong with the original code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20756875

http://stackoverflow.com/q/20747026
has answer: http://stackoverflow.com/a/20747098
tagged with: android
has comment: http://stackoverflow.com/comment/31089009
has body: As far as I understand, there is no way to pass a simple List object between Activities without the List being an ArrayList. Am I perhaps missing some way to do this? If not, does anyone know why Google would force users to use implementation specific details in their code?
has comment: http://stackoverflow.com/comment/31088888
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20747093
tagged with: java
has title: Why can't you pass List (NOT ArrayList) between activities?
type: Question
upvote count: 4
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31088810
has answer: http://stackoverflow.com/a/20747093
tagged with: android-activity
favorite count: 0
score: 4
possible better answer: http://stackoverflow.com/a/20747098
has comment: http://stackoverflow.com/comment/31088873

http://stackoverflow.com/q/20727267
possible better answer: http://stackoverflow.com/a/20733683
upvote count: 8
answer count: 3
has title: Clojure: what's the difference between [D and [Ljava.lang.Double;?
downvote count: 1
has answer: http://stackoverflow.com/a/20729408
accepted answer: http://stackoverflow.com/a/20729408
has answer: http://stackoverflow.com/a/20727296
favorite count: 0
has answer: http://stackoverflow.com/a/20733683
tagged with: clojure
has body: I'm trying to do some stuff with native Java arrays, and I'm not understanding what the difference is between the two double-array instantiations. Does this have to do with boxing and unboxing values? In all cases below the (first...) of every array has type java.lang.Double. Clojure protocols appear to be sensitive to the distinction. user&gt; (class (make-array Double/TYPE 3)) ;; [D user&gt; (class (double-array [1 2 3])) ;; [D user&gt; (class (into-array (make-array Double/TYPE 3))) ;; [Ljava.lang.Double; user&gt; (class (into-array (double-array [1 2 3]))) ;; [Ljava.lang.Double; user&gt; (class (into-array (repeat 2 (double-array [1 2 3]) ))) ;; [[D
type: Question
type: AnsweredQuestion
score: 7
tagged with: java

http://stackoverflow.com/q/20763952
downvote count: 1
has comment: http://stackoverflow.com/comment/31119247
favorite count: 0
has comment: http://stackoverflow.com/comment/31119328
linked to: http://stackoverflow.com/q/20626870
answer count: 3
type: UnansweredQuestion
tagged with: android
upvote count: 22
linked to: http://stackoverflow.com/q/15456434
has comment: http://stackoverflow.com/comment/31119167
has comment: http://stackoverflow.com/comment/31119264
has comment: http://stackoverflow.com/comment/31119059
type: Question
has comment: http://stackoverflow.com/comment/31119072
score: 21
tagged with: java
has body: My app uses In App Billing and it works fine on my phone (Android 2.3.6). But when I run it on the emulator (Android 4.4.2) it keeps crashing when creating the helper for performing in app purchases. It throws a NullPointerException: mHelper = new IabHelper(MainActivity.this, base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Log.d("x", "In-app Billing setup failed: " + result); } else { Log.d("x", "In-app Billing is set up OK"); } } }); This answer says I should put the code above in a try-block and put the catch in the answer below it. I get an error when doing that and the recommended solution is putting that in a try-catch block too. Eventhough I did that, it still crashes. Can anybody tell me how to do this? I'm completely stuck. Stack trace: 12-24 10:59:51.908: E/AndroidRuntime(2273): FATAL EXCEPTION: main 12-24 10:59:51.908: E/AndroidRuntime(2273): Process: com.sandradiependaal.mediatie, PID: 2273 12-24 10:59:51.908: E/AndroidRuntime(2273): java.lang.NullPointerException 12-24 10:59:51.908: E/AndroidRuntime(2273): at com.sandradiependaal.meditatie.util.IabHelper.startSetup(IabHelper.java:267) 12-24 10:59:51.908: E/AndroidRuntime(2273): at com.sandradiependaal.meditatie.MainActivity$4.onItemClick(MainActivity.java:142) 12-24 10:59:51.908: E/AndroidRuntime(2273): at android.widget.AdapterView.performItemClick(AdapterView.java:299) 12-24 10:59:51.908: E/AndroidRuntime(2273): at android.widget.AbsListView.performItemClick(AbsListView.java:1113) 12-24 10:59:51.908: E/AndroidRuntime(2273): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2904) 12-24 10:59:51.908: E/AndroidRuntime(2273): at android.widget.AbsListView$3.run(AbsListView.java:3638) 12-24 10:59:51.908: E/AndroidRuntime(2273): at android.os.Handler.handleCallback(Handler.java:733) 12-24 10:59:51.908: E/AndroidRuntime(2273): at android.os.Handler.dispatchMessage(Handler.java:9…
has answer: http://stackoverflow.com/a/27904693
has answer: http://stackoverflow.com/a/23414994
has comment: http://stackoverflow.com/comment/31119584
has answer: http://stackoverflow.com/a/20772125
tagged with: in-app-billing
has title: IabHelper.startSetup() causes NullPointerException

http://stackoverflow.com/a/20807968
type: Answer
answers question: http://stackoverflow.com/q/20792988
score: 2
accepted answer of: http://stackoverflow.com/q/20792988
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: You need to add a converter or a proper editor. I prefer the first one. Refer to section 6.5. on this page for the details. Your converter would have to get the Entity with the given name from the database and return it. The code would be something like this: class StringToGender implements Converter&lt;String, Gender&gt; { @Autowired private GenderRepository repository; public Gender convert(String name) { return repository.getGenderByName(name); } } And in your application context xml (if you use xml): &lt;bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"&gt; &lt;property name="converters"&gt; &lt;set&gt; &lt;bean class="org.example.StringToGender"/&gt; &lt;/set&gt; &lt;/property&gt;

http://stackoverflow.com/comment/31203125
type: Comment
has text: My formatter looks something like this `DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy hh-MM-ss");` And the folder last modified date which I get is in long format which is then converted to DateTime using the formatter.
comment on: http://stackoverflow.com/a/20801709
score: 0
type: AnswerComment

http://stackoverflow.com/a/41308999
has body: It's late but maybe it can help someone else. You can build a terms query using bool query with should clause. BoolQueryBuilder boolQuery = QueryBuilders.boolQuery() .should(QueryBuilders.termsQuery("tags", tagList)); After that continue as usual, assuming there exist a field tags which holds those values. SearchResponse response = client.prepareSearch("mongoindex") .setSearchType(SearchType.QUERY_AND_FETCH) .setQuery(boolQuery) .setFrom(0).setSize(60).setExplain(true) .execute() .actionGet();
answers question: http://stackoverflow.com/q/20795505
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31204435
type: QuestionComment
has text: glad to help you... and let the comment to be a comment. thank you...
comment on: http://stackoverflow.com/q/20811430
score: 0
type: Comment

http://stackoverflow.com/a/20726037
has body: Because the variable a is declared as B, only the p method declared in B is visible and thus chosen. There's no overriding involved. When in doubt, annotate your method with @Override in your favorite IDE. The IDE won't let it compile if it's not actually overriding anything. After your edit, you now have an overriden method in the form of A#p(double). When you invoke a.p(10); a.p(10.0); The method p visible on the B class will be invoked. Through polymorphism and because the variable a is of run time type A, the overriden method declared in A will be invoked. Note that the int argument in a.p(10); becomes a double through widening primitive conversion.
upvote count: 2
answers question: http://stackoverflow.com/q/20726026
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31136122
comment on: http://stackoverflow.com/q/20773253
score: 0
type: Comment
type: QuestionComment
has text: @Klaus66: Yes: it reappears immediately when i delete it (even before I have the chance to clean) And when I clean it remains as it is

http://stackoverflow.com/comment/31050586
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20725543
has text: Can you unpack your jar to ensure that the folder is in there?

http://stackoverflow.com/comment/31073160
type: QuestionComment
comment on: http://stackoverflow.com/q/20738075
score: 2
has text: Before sorting you can make a clone of unsorted object.
type: Comment

http://stackoverflow.com/a/20816493
has body: Because You are not calling the methd printStates() Call the method as dog1.printStates(); dog2.printStates();
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20816468

http://stackoverflow.com/comment/31028899
comment on: http://stackoverflow.com/a/20713742
type: AnswerComment
has text: super(p_oSdLog); is throwing exception: The Constructor Object(StyledDocument) is undefined
type: Comment
score: 0

http://stackoverflow.com/q/20798696
has comment: http://stackoverflow.com/comment/31181305
has answer: http://stackoverflow.com/a/20801867
has comment: http://stackoverflow.com/comment/31186252
answer count: 4
possible better answer: http://stackoverflow.com/a/20799387
type: AnsweredQuestion
tagged with: el
tagged with: jsf
score: 1
accepted answer: http://stackoverflow.com/a/20801638
has answer: http://stackoverflow.com/a/30290782
upvote count: 1
has comment: http://stackoverflow.com/comment/31182780
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20801638
has body: Two days I'm looking for a solution to that basic problem. And YES I do have GETTER AND SETTER, and YES I really think that the convention is OK. Here is the code : Bean : @Named @SessionScoped public class ClientController implements Serializable { @Inject private ClientService das; private List<Client> clientsList; public void setClientsList(List<Client> clientsList) { this.clientsList = clientsList; } private Client client = new Client(); public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public void createclient(ActionEvent actionEvent) { das.create(client); } public List<Client> getClientsList() { clientsList = das.findByNativeQuery(Client.ALL); return clientsList; } } Page index.xhtml : <ui:composition template="/templates/layout.xhtml" 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"> <ui:define name="content"> <h:form> <p:panel header="Créer un Client"> <h:outputText value="Prénom : "></h:outputText> <p:inputText id="clientName" value="#{clientController.client.name}" required="true" requiredMessage="Entrez votre prénom" message="fc"> <f:validateLength minimum="2" /> </p:inputText> <h:outputText value="Nom : "></h:outputText> <p:inputText id="clientLastName" value="#{clientController.client.lastName}" required="true" requiredMessage="Entrez votre nom" message="fc"> <f:validateLength minimum="2" /> </p:inputText> </p:panel> <p:commandButton value="Submit" actionListener="#{clientController.createclient}" /> </h:form> </ui:define> </ui:composition> Error : /index.xhtml @14,57 value="#{clientController.client.name}": The class 'controllers.ClientController' does not have the property 'client'. As you can see, the Bean is resolved, and even the createclient() method is resolved (I tried to test it without the rest of the code). The problem is just about attributes…
has title: JSF : PropertyNotFoundException The class '' does not have the property ''
has comment: http://stackoverflow.com/comment/31181827
has comment: http://stackoverflow.com/comment/31181550
has answer: http://stackoverflow.com/a/20799387
linked to: http://stackoverflow.com/q/4347374
downvote count: 0
linked to: http://stackoverflow.com/q/11986847
favorite count: 0
linked to: http://stackoverflow.com/q/7734214
has comment: http://stackoverflow.com/comment/31181087
has comment: http://stackoverflow.com/comment/31182736
has comment: http://stackoverflow.com/comment/31181283
has comment: http://stackoverflow.com/comment/31182868

http://stackoverflow.com/comment/31012611
comment on: http://stackoverflow.com/q/20705184
type: Comment
type: QuestionComment
score: 1
has text: Disclaimer: the ternary conditional operator "?:" IS a if-then-else

http://stackoverflow.com/comment/31146531
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20771288
has text: No it can not be done. how can you call the method of subclass from base class object!!!
score: 0

http://stackoverflow.com/comment/30994969
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20694466
type: QuestionComment
has text: Are you trying to show the menu only when you perform a long click into something or do you want to perform the action (like open_how_to() ) only when a menu item is long clicked:

http://stackoverflow.com/a/20817958
type: Answer
answers question: http://stackoverflow.com/q/20815356
has comment: http://stackoverflow.com/comment/31325500
upvote count: 1
score: 1
has body: Your code is running on the Windows machine, right? The most secure way would be to use SSH. http://www.jcraft.com/jsch/ looks like a pretty good implementation. It's used by ant, maven. etc, to do the same thing. On the other hand, if you're not creating a new build system, could I suggest that perhaps your build system (ant/maven/gradle) should be copying your files around for you?
downvote count: 0

http://stackoverflow.com/q/20770441
score: 0
has body: My question is: how to assign default zero to an static integer variable? This is my code: class Point { static int i; public static void main(String[] args) { System.out.println("" + i); } } The output must be: 0
has answer: http://stackoverflow.com/a/20770455
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has title: how static integer variable in java assign default zero
tagged with: java
has answer: http://stackoverflow.com/a/20770464
answer count: 3
has answer: http://stackoverflow.com/a/20770465
favorite count: 0

http://stackoverflow.com/q/20731886
accepted answer: http://stackoverflow.com/a/20735610
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/31068681
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31065693
possible better answer: http://stackoverflow.com/a/20735619
has answer: http://stackoverflow.com/a/27725189
has title: Centering textbutton to screen libgdx
type: Question
upvote count: 2
tagged with: libgdx
answer count: 3
has answer: http://stackoverflow.com/a/20735619
has body: I am currently creating a game using LibGDX and I am creating my Title Screen at the moment. I am having trouble centering TextButtons on the screen, I can get them centered fine if the set the width of the TextButton to the width of the stage but then anywhere you click left to right of that button allows the button to be pressed and not if you're just clicking on the button itself. How could I get the TextButtons centered to the game screen and centered on each other? I've got three TextButtons(New Game, Continue and Exit Game). Any help would be greatly appreciated, thanks! Edit: Here is the code for my three buttons. btnNG = new TextButton("New Game", btnStyle[0]) { { setName("New Game"); addListener(new InputListener() { public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { g.debugOut(btnNG.getName(), "touchDown?"); return true; } public void touchUp(InputEvent e, float x, float y, int pointer, int button) { g.debugOut(btnNG.getName(), "touchUp?"); //g.switchScreen(new Mainscreen(g)); } }); setWidth(sTitle.getWidth()); setPosition(0, (getHeight() * 2.5f)); } }; btnContinue = new TextButton("Continue", btnStyle[0]) { { setName("Continue"); addListener(new InputListener() { public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { g.debugOut(btnContinue.getName(), "touchDown?"); return true; } public void touchUp(InputEvent e, float x, float y, int pointer, int button) { g.debugOut(btnContinue.getName(), "touchUp?"); } }); setWidth(sTitle.getWidth()); setPosition(0, (getHeight() * 1.4f)); } }; btnExit = new TextButton("Exit Game", btnStyle[0]) { { setName("Exit Game"); addListener(new InputListener() { public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { g.debugOut(btnExit.getName(), "touchDown?"); return true; } public void touchUp(InputEvent e, float x, float y, int pointer, int button) { g.debugOut(btnExit.getName(), "touchUp?"); //Gdx.app.exit(); } }); setWidth(sTitle.getWi…
favorite count: 0
has answer: http://stackoverflow.com/a/20735610

http://stackoverflow.com/q/20763493
tagged with: jersey
answer count: 1
accepted answer: http://stackoverflow.com/a/20764204
tagged with: rest
has body: I am trying to build a RESTFul client using Jersey framework, so I added the following class: import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; public class ActivityClient { private Client client; public ActivityClient(){ client = ClientBuilder.newClient(); } //...code } but I am getting an error class ClientBuilder not found, even though I have the following jars under WEB-INF/lib and under the application class path: asm-3.1.jar jackson-core-asl-1.9.2.jar jackson-jaxrs-1.9.2.jar jackson-mapper-asl-1.9.2.jar jackson-xc-1.9.2.jar jersey-client-1.17.1.jar jersey-core-1.17.1.jar jersey-json-1.17.1.jar jersey-server-1.17.1.jar jersey-servlet-1.17.1.jar jettison-1.1.jar jsr311-api-1.1.1.jar So can someone please tell me which jar I am missing here? and where I can find it? I have searched the web and the only jar I found that has ClientBuilder is related to the RESTEasy framework, so I don't think that it is related. Thanks for your time
has answer: http://stackoverflow.com/a/20764204
favorite count: 0
score: 8
downvote count: 0
tagged with: jersey-client
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
upvote count: 8
type: Question
has title: ClientBuilder class not found

http://stackoverflow.com/a/20786916
type: Answer
answers question: http://stackoverflow.com/q/20786822
has body: Use listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. Instead of list(FilenameFilter) where you can only filter on the name (string) of the file. Use lastModified property in you "accept" implementation to check the date, and don't forget to add your old filter on the filename prefix!
score: 0

http://stackoverflow.com/q/20738542
score: 7
upvote count: 7
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/20738574
answer count: 1
has title: Why initialize byte array to 1024 while reading or writing a file?
favorite count: 0
tagged with: buffer
has comment: http://stackoverflow.com/comment/31074084
linked to: http://stackoverflow.com/q/6557799
tagged with: io
has body: In java input or output stream , there always has a byte array size of 1024. Just like below: URL url = new URL(src); URLConnection connection = url.openConnection(); InputStream is = connection.getInputStream(); OutputStream os = new FileOutputStream("D:\\images"+"\\"+getName(src)+getExtension(src)); byte[] byteArray = new byte[1024]; int len = 0; while((len = is.read(byteArray))!= -1){ os.write(byteArray, 0, len); } is.close(); os.close(); Why initialize this array to 1024?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20738574
tagged with: java

data-modeling
tags question: http://stackoverflow.com/q/20736403
type: Tag
tag name: data-modeling

http://stackoverflow.com/comment/92008445
type: AnswerComment
type: Comment
has text: [DurationFormatUtils.formatDurationWords](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/DurationFormatUtils.html#formatDurationWords-long-boolean-boolean-) can be used to exclude empty fields. `DurationFormatUtils.formatDurationWords(interval.toMillis(), true, true)`
comment on: http://stackoverflow.com/a/44902688
score: 6

http://stackoverflow.com/comment/31079528
has text: @toilinginobscurity: Which part helped the most? :-)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20727581
type: Comment

http://stackoverflow.com/a/20751802
type: Answer
upvote count: 2
has body: The getParameter() method is not defined within the BufferView class. What you possibly need is a HttpServletRequest instance, from which you will be able to invoke the getParameter() method.
score: 2
answers question: http://stackoverflow.com/q/20751773
downvote count: 0

http://stackoverflow.com/q/20813063
has answer: http://stackoverflow.com/a/20813212
accepted answer: http://stackoverflow.com/a/20813212
has comment: http://stackoverflow.com/comment/31207460
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31207468
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: create json object
type: Question
answer count: 1
downvote count: 1
score: 4
favorite count: 0
has body: I want to store some offline data from a webpage.I am trying to use Json.i want to use this webpage in tablets and smart phone. Can any one help me in adding the jar import java.io.FileWriter; import java.io.IOException; import com.sun. import org.json.simple.JSONArray; import org.json.simple.JSONObject; public class Jsonnn { public static void main(String[] args) { JSONObject obj = new JSONObject(); obj.put("name", "asdf"); obj.put("age", new Integer(100)); JSONArray list = new JSONArray(); list.add("msg 1"); list.add("msg 2"); list.add("msg 3"); obj.put("messages", list); try { FileWriter file = new FileWriter("c:\\test.json"); file.write(obj.toJSONString()); file.flush(); file.close(); } catch (IOException e) { e.printStackTrace(); } System.out.print(obj); } }
has comment: http://stackoverflow.com/comment/31207452
upvote count: 5

http://stackoverflow.com/comment/36602329
has text: You need to put the <property> tag inside <properties> tag.
type: AnswerComment
comment on: http://stackoverflow.com/a/20748768
type: Comment
score: 1

interface
tags question: http://stackoverflow.com/q/20752515
tags question: http://stackoverflow.com/q/20777349
tag name: interface
tags question: http://stackoverflow.com/q/20712782
tags question: http://stackoverflow.com/q/20692945
tags question: http://stackoverflow.com/q/20689499
tags question: http://stackoverflow.com/q/20700098
tags question: http://stackoverflow.com/q/20832506
tags question: http://stackoverflow.com/q/20716853
tags question: http://stackoverflow.com/q/20803457
tags question: http://stackoverflow.com/q/20732451
tags question: http://stackoverflow.com/q/20761069
tags question: http://stackoverflow.com/q/20723797
type: Tag
tags question: http://stackoverflow.com/q/20792111
tags question: http://stackoverflow.com/q/20804818
tags question: http://stackoverflow.com/q/20775708
tags question: http://stackoverflow.com/q/20806267
tags question: http://stackoverflow.com/q/20766254
tags question: http://stackoverflow.com/q/20771927
tags question: http://stackoverflow.com/q/20753660
tags question: http://stackoverflow.com/q/20747532

http://stackoverflow.com/a/20818026
downvote count: 0
has body: This must be in onClickListener. number = Integer.parseInt(number_input.getText().toString()); You are getting I guess NumberFormatException. Because Initially Edittext Value is empty and you are trying to convert into integer. guess_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { number = Integer.parseInt(number_input.getText().toString()); } });
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20818013

http://stackoverflow.com/q/20801601
tagged with: string
has answer: http://stackoverflow.com/a/20801697
favorite count: 0
has comment: http://stackoverflow.com/comment/31186136
has comment: http://stackoverflow.com/comment/31185851
type: UnansweredQuestion
upvote count: 4
downvote count: 0
tagged with: java
has body: As we know if we do a check like below the output will be equal. String s1 = "stackoverflow"; String s2 = "stackoverflow"; if(s1==s2){ System.out.println("equal"); } So my question is if i am not using new operator in my application to create String and all are strings are literals so can i use only reference equality as given above? Thanks in advance. N.B: i am writing a crawler so i need to check whether i have already visited the given url that i am currently holding. I am using murmur hash which gives me a long for every url but there are collision so i need to check for the content if the url string if there is a hash collision. Hence for performance i am thinking of just comparing the reference equality of two string urls. And i am using jsoup for html parsing.
has comment: http://stackoverflow.com/comment/31185916
has answer: http://stackoverflow.com/a/20801716
type: Question
has title: String equality check by only reference
score: 4
answer count: 3
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/20801720

http://stackoverflow.com/comment/31216294
comment on: http://stackoverflow.com/q/20817793
type: QuestionComment
type: Comment
has text: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:797) at java.lang.StringBuilder.replace(StringBuilder.java:266) at request.NumDocumentFilter.replace(NumDocumentFilter.java:50)
score: 0

http://stackoverflow.com/comment/31255038
score: 0
type: AnswerComment
has text: Calling `getPbStatus()` twice may have unintended side effects.
type: Comment
comment on: http://stackoverflow.com/a/20838940

http://stackoverflow.com/q/20693481
has comment: http://stackoverflow.com/comment/30992417
answer count: 1
has body: I'm trying to get the method to complete in less than 50 milliseconds, but I can't seem to figure out how I can increase the overall speed of the method. I'm using an object for the pixel because I need to be able to check for null when I'm compressing the data. public static Frame getFrame(Dimension d, Robot r, Rectangle s, Resolution rs) { int w = d.width; int h = d.height; BufferedImage b = r.createScreenCapture(s); Pixel[] pixels = new Pixel[w * h]; for(int i = 0; i &lt; w; i++) { for(int j = 0; j &lt; h; j++) { pixels[j * w + i] = new Pixel(b.getRGB(i, j)); } } return new Frame(rs, pixels, true); } Here's the constructor for the Pixel class public Pixel(int c) { if((c &amp; 0xFF) == 0xA || (c &amp; 0xFF) == 0xD) c++; if((c &amp; 0xFF00) == 0xA00 || (c &amp; 0xFF00) == 0xD00) c += 0x100; if((c &amp; 0xFF0000) == 0xA0000 || (c &amp; 0xFF0000) == 0xD0000) c += 0x10000; if((c &amp; 0xFF000000) == 0xA000000 || (c &amp; 0xFF000000) == 0xD000000) c += 0x1000000; color = c; } And here's the constructor for the Frame class public Frame(Resolution res, Pixel[] pix, boolean ignoreCheck) { if(!ignoreCheck) { if(pix.length &lt; res.getTotalPixels()) throw new NotEnoughPixelsException(res.getTotalPixels() - pix.length); else if(pix.length &gt; res.getTotalPixels()) throw new TooManyPixelsException(pix.length - res.getTotalPixels()); } resolution = res; pixels = pix; }
has title: increasing efficiency of method java
has comment: http://stackoverflow.com/comment/30992241
linked to: http://stackoverflow.com/q/375913
has comment: http://stackoverflow.com/comment/30995288
type: AnsweredQuestion
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/20693526
has comment: http://stackoverflow.com/comment/30992950
type: Question
accepted answer: http://stackoverflow.com/a/20693526
has comment: http://stackoverflow.com/comment/30992587
has comment: http://stackoverflow.com/comment/30992764
score: 0

http://stackoverflow.com/comment/31064730
has text: Try adding `proxy-target-class="true"` to your `<tx:annotation-driven>` element. I'll explain why if it works. You'll need CGLIB on your classpath.
score: 0
comment on: http://stackoverflow.com/q/20733021
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/30984701
type: Comment
has text: @TedHopp Citing [System.nanoTime Javadoc](http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#nanoTime%28%29): "This method provides nanosecond precision, but not necessarily nanosecond accuracy." I'll let you take your dispute to the authors of JDK's Javadoc.
comment on: http://stackoverflow.com/a/20689231
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31087427
has text: https://github.com/Prototik/HoloEverywhere/wiki/Import-in-IDE#android-studio--intellij-idea
comment on: http://stackoverflow.com/q/20745210
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31103969
comment on: http://stackoverflow.com/q/20755058
has text: you can find a working regex here... http://stackoverflow.com/questions/4766845/yyyymmdd-date-format-regular-expression-to-validate-a-date-in-c-sharp-net but as some of the answer says, not recommended to use regex for that...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/30983206
type: AnswerComment
has text: Won't `number *= 10;` give 0 all the time? Shouldn't it be `long number = 1;` ?
comment on: http://stackoverflow.com/a/20688323
type: Comment
score: 0

http://stackoverflow.com/q/20750318
has comment: http://stackoverflow.com/comment/31096592
favorite count: 0
tagged with: controller
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31356549
tagged with: spring
tagged with: spring-mvc
score: 2
linked to: http://stackoverflow.com/q/7992153
upvote count: 2
has answer: http://stackoverflow.com/a/20750394
type: Question
tagged with: java
has title: Spring controller returning multiple responses
has body: I am a beginner at Spring MVC and I have a quick question to ask. I searched all over Google for days to find the most efficient way to go about this problem: I have a request that's coming in to Spring MVC controller. I want to send a response but wait for however many seconds and return another response to the same client. I was thinking about using ThreadExecutor or using Callable but I am not sure if that's the way to go. Does anyone have any tutorials/examples or hints that can quickly get me started? Thanks!
has comment: http://stackoverflow.com/comment/31095304
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/47138889
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20718633
has text: Throwing an exception for an expected behaviour of "redirect" is bad design IMHO. Not downvoting, though.
type: AnswerComment

http://stackoverflow.com/comment/31442216
has text: although, I found other answers to be just as useful as yours, and this probably is not the route I am going to take to fix my problem, I am awarding it to your answer mainly because it is elaborate and it shows that you have spent a lot of time and energy in putting it together. Thank you!
type: Comment
score: 3
comment on: http://stackoverflow.com/a/20892587
type: AnswerComment

minimax
type: Tag
tag name: minimax
tags question: http://stackoverflow.com/q/20820631

http://stackoverflow.com/a/20840273
downvote count: 0
has comment: http://stackoverflow.com/comment/31257687
answers question: http://stackoverflow.com/q/20840239
has comment: http://stackoverflow.com/comment/31266359
type: Answer
upvote count: 4
score: 4
has body: Because you are calling find and remove on two different EntityManager instances. You need to do something like this instead EntityManager em = emf.createEntityManager(); utx.begin(); Loaner s = em.find(Loaner.class, current.getLoanerId()); System.out.println("S: "+ s); em.remove(s); utx.commit();

http://stackoverflow.com/q/20805029
has comment: http://stackoverflow.com/comment/31192332
accepted answer: http://stackoverflow.com/a/20817723
has comment: http://stackoverflow.com/comment/31196959
tagged with: generics
favorite count: 0
has body: I am trying to develop an ObjectPool, which can be used with any Object without changing the source of neither the Pool nor the Object - but I can´t find any way to write the get()-function ("Maincode" getting some Object from Pool) as there is a Type-Mismatch (Cannot convert from Object to TestObject) Here´s my code so far: ObjectPool: public Object get() { int first = availableObjects.get(0); availableObjects.remove(0); return objects.get(first); } In objects (ArrayList) there are all the objects in the pool, availableObjects just contains a list of all available objects. I am basically just returning the first available object and mark it as unavailable. Maincode: TestObject test = objectPoolS.get(); How can I make the get()-Method more generic/specific so it works without adapting the pool everytime I use a different class and without parsing on the maincode? Update: With a more generic version of that Pool, how would the get()-method look like correctly? (Any other feedback greatly appreciated!) Update: Working (Fixed) Version of the MainCode below Update 2: I just realized that it can´t work like this, I need to create new Objects in the Pool - which seems hardly possible to do without adapting the Pool for every kind of Object. So can I somehow remove the reference between all the Objects in the Pool? (As I use baseObject to initialize all Objects, I actually only have 5 references to 1 Object) Or is there a better way to manage it? (Without forcing the user to create the Objects in his Code) Complete Code so far: ObjectPool public class ObjectPoolS&lt;T&gt; { int numberOfObjects; boolean autoExtending; T baseObject; ArrayList&lt;T&gt; objects; ArrayList&lt;Integer&gt; availableObjects; public ObjectPoolS(T baseObject, int capacity, boolean allowAutoExtending) { this.numberOfObjects = capacity; this.baseObject = baseObject; this.autoExtending = allowAutoExtending; objects = new ArrayList&lt;T&gt;(capacity); availableObjects = new ArrayList&lt;Integer&gt;(capa…
has comment: http://stackoverflow.com/comment/31192362
has title: Generic ObjectPool - how to return a generic class?
has answer: http://stackoverflow.com/a/20805100
has answer: http://stackoverflow.com/a/20817723
upvote count: 7
tagged with: object-pooling
type: AnsweredQuestion
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/20817324
has comment: http://stackoverflow.com/comment/31194656
type: Question
has comment: http://stackoverflow.com/comment/31210658
downvote count: 0
has comment: http://stackoverflow.com/comment/31193803
answer count: 3
has comment: http://stackoverflow.com/comment/31192208
has answer: http://stackoverflow.com/a/20817324

http://stackoverflow.com/comment/31256522
comment on: http://stackoverflow.com/q/20839252
score: 1
has text: try removing scrollview !!!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20818014
possible better answer: http://stackoverflow.com/a/20818043
type: AnsweredQuestion
tagged with: java
has title: Jar file (downloaded as .zip extension) wont open
type: Question
has answer: http://stackoverflow.com/a/20818032
accepted answer: http://stackoverflow.com/a/20818032
score: 0
answer count: 2
has body: I've downloaded a file, which is supposed to be a .jar file, but it was standard a .zip file. If I open the file with winzip, it shows following folders and files: META-INF (folder) resources (folder) Action.class Main.class Updater.class With my knowledge, I think this is a legit .jar file, but somehow I can't open it. I tried to google the question, and tried these methods: Opening it with Commandpromp (as admin) and run it with java -jar &lt;file&gt; Open with another program, and pointing it to my javaw.exe, java.exe, or any other .exe file in C:\program files (x86)\java\jre7\bin... (Gives me a commandpromp that crashes after a few seconds, I tried to take a print-screen and it said: "could not find or load main class") But all didn't work. My java environment is up to date. Any ideas? Thanks EDIT: I'm on a windows 8.1 64 bit
tagged with: jar
has answer: http://stackoverflow.com/a/20818043

http://stackoverflow.com/q/20719249
has answer: http://stackoverflow.com/a/23824354
tagged with: android-activity
score: 10
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: qt
upvote count: 11
has title: Adding SDK Activity in Qt for Android
tagged with: java
downvote count: 1
type: Question
has body: Is there any way that we can add separate SDK (Java) Activity to the make process in Qt 5.2 for Android? I have Qt application that I've compiled for Android and I want to start my own SDK Activity from it, and I was wondering if I can include that activity in the current application.
tagged with: qt5
answer count: 1

http://stackoverflow.com/q/20729181
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have a strange problem with that Runnable implementation of my Activity: package bc.qz.client.android.activity; import java.util.ArrayList; import java.util.List; import java.util.UUID; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import bc.qz.client.android.adapter.ScoreListAdapter; import bc.qz.client.android.proxy.RemoteServletCaller; import de.bc.qz.business.Score; public class ScoreActivity extends ListActivity { private SharedPreferences mSharedPreferences; private RemoteServletCaller mRemoteServletCaller; private Runnable lViewScoreRunnable; private String mUuid; private String mUsername; private ProgressDialog mProgressDialog = null; private ScoreListAdapter mScoreListAdapter; List&lt;Score&gt; mAllScore = new ArrayList&lt;Score&gt;(); public void onCreate(Bundle icicle) { super.onCreate(icicle); mRemoteServletCaller = new RemoteServletCaller(); mSharedPreferences = this.getSharedPreferences("de.bc.qz.client.sharedpreferences", Context.MODE_PRIVATE); mUuid = mSharedPreferences.getString("uuid", null); mUsername = mSharedPreferences.getString("user", null); mScoreListAdapter = new ScoreListAdapter(this, mAllScore); setListAdapter(mScoreListAdapter); lViewScoreRunnable = new Runnable() { @Override public void run() { loadAllScore(mUsername, mUuid); } }; Thread thread = new Thread(null, lViewScoreRunnable, "MagentoBackground"); thread.start(); mProgressDialog = ProgressDialog.show(ScoreActivity.this, "Please wait...", "Retrieving data ...", true); } private void loadAllScore(String pUsername, String pUuid) { try { if (null == mUuid || mUsername == null){ mUuid = UUID.randomUUID().toString(); mSharedPreferences.edit().putString("uuid", mUuid).commit(); mAllScore.addAll(mRemoteServletCaller.getAllScore(1, 10)); }else{ mAllScore.addAll(mRemoteServletCaller.getAllScore(mUsername, mUuid)); } } catch (Exception e) { return; } runOnUiThread(retu…
score: 0
tagged with: runnable
has title: Endless loop in Runnable of ListActivity
answer count: 1
has comment: http://stackoverflow.com/comment/31056850
has answer: http://stackoverflow.com/a/20729215
accepted answer: http://stackoverflow.com/a/20729215
has comment: http://stackoverflow.com/comment/31056762
tagged with: android

machine-learning
tags question: http://stackoverflow.com/q/20818774
tags question: http://stackoverflow.com/q/20789776
tag name: machine-learning
tags question: http://stackoverflow.com/q/20736460
tags question: http://stackoverflow.com/q/20736485
type: Tag
tags question: http://stackoverflow.com/q/20768607
tags question: http://stackoverflow.com/q/20782951

http://stackoverflow.com/a/20705669
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20703873
answers question: http://stackoverflow.com/q/20703873
has body: Add the @NotStrict annotation to the CssResource. This should solve your problem.
upvote count: 1

http://stackoverflow.com/q/20702656
answer count: 2
has body: I am planning to create a Android Lock Screen of my own . But i don't know where to start? Should i just make an activity with UI layout that interacts touches, and when the user swipes I should call the androd.intent.HOME ? And how can i override the default android Lock Screen application? I really dont have a clue any help would be appreciated. I saw this post : Where can I find examples or tutorials about creating a custom android lockscreen? but its not very helpful And my device is rooted and i dont mind making the app only for ROOTED users..
linked to: http://stackoverflow.com/q/4116001
downvote count: 0
linked to: http://stackoverflow.com/q/16087341
favorite count: 0
has comment: http://stackoverflow.com/comment/40780711
has comment: http://stackoverflow.com/comment/31008301
type: UnansweredQuestion
tagged with: android
upvote count: 7
has comment: http://stackoverflow.com/comment/40810384
has comment: http://stackoverflow.com/comment/31009238
tagged with: lockscreen
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/31008922
type: Question
has title: Android LockScreen
has answer: http://stackoverflow.com/a/20786521
has comment: http://stackoverflow.com/comment/31009564
has comment: http://stackoverflow.com/comment/31008557
has answer: http://stackoverflow.com/a/21569097

http://stackoverflow.com/comment/31348122
type: Comment
has text: Try this tutorial and the other tutorials on that site, they seem wonderful for your needs: http://obviam.net/index.php/the-android-game-loop/
comment on: http://stackoverflow.com/a/20803704
score: 0
type: AnswerComment

http://stackoverflow.com/a/20789104
downvote count: 0
score: 1
type: AcceptedAnswer
has body: For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X &amp; *nix. ..JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives &amp; other resource downloads by platform, architecture or locale, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions.. Note that 'desktop integration' means - an icon on the desktop (as well as potentially a menu item - like on the Windows Start Menu).
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20789003
answers question: http://stackoverflow.com/q/20789003
type: Answer

http://stackoverflow.com/q/20777965
has comment: http://stackoverflow.com/comment/31144487
has body: I've been trying to send a tcp/ip packet from a simple client to a simple server... I get response from the server when i run them in netbeans but i can't find the packet in wireshark and if i use the netstat command in cmd, the packet also doesn't seem to be there... i've tried a few different ports (8080,80,5000,...) and as ip address i'm using localhost. Is there some setting in netbeans or wireshark that i missed and i still need to configure? The client: public class TCPClient { private static InetAddress host; private static final int PORT=1235; public static void main(String[] args) { try { host=InetAddress.getByName("localhost"); } catch(UnknownHostException e) { System.out.println("Host id not found"); System.exit(1); } run(); } private static void run() { Socket link=null; try { link = new Socket(host,PORT); BufferedReader in = new BufferedReader (new InputStreamReader(link.getInputStream())); PrintWriter out = new PrintWriter(link.getOutputStream(),true); BufferedReader userEntry = new BufferedReader (new InputStreamReader(System.in)); String message,response; do { System.out.println("Enter message: "); message=userEntry.readLine(); out.println(message); response=in.readLine(); System.out.println("\nSERVER&gt; " + response); } while(!message.equals("***CLOSE***")); } catch(IOException e) { e.printStackTrace(); } finally { try { System.out.println("\n* Closing connection... *"); link.close(); } catch(IOException e) { System.out.println("unable to disconnect!"); System.exit(1); } } } The server: public class TCPServer { private static ServerSocket serverSock; private static final int PORT = 1235; public static void main(String[] args) { System.out.println("opening port...\n"); try { serverSock=new ServerSocket(PORT); } catch(IOException e) { System.out.println("unable to attach port"); System.exit(1); } do { run(); } while(true); } private static void run() { Socket link=null; try { link = serverSock.accept(); BufferedReader in = new BufferedReader (new Inp…
tagged with: client
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: tcp
tagged with: java
accepted answer: http://stackoverflow.com/a/20778427
type: Question
has comment: http://stackoverflow.com/comment/31144431
answer count: 1
downvote count: 0
has title: packet that has been send in netbeans doesn't show up in wireshark nor cmd->netstat
favorite count: 0
has answer: http://stackoverflow.com/a/20778427

http://stackoverflow.com/q/20828033
has answer: http://stackoverflow.com/a/20828113
has comment: http://stackoverflow.com/comment/31235241
favorite count: 0
has title: Finding smaller 2D array inside a bigger 2D array
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20828113
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/31235106
type: Question
score: 5
has body: Purpose of the Code: to recognize a button on the screen/get its coordinates automatically without human intervention. (The code is supposed to find a 2D array inside a bigger 2D array). How i tried to solve it: I stored each RGB pixel value in a 2D array (a[][] also called the big array). I Stored the button pixels/smaller 2Darray in the optionArrayButton[][]. Then coded these steps: (Look at the arrays below while reading this). Get the number for SmallerArray[0][0] = firstSmallerArray Number Check Biger Array for FirstSmallerArray number by going through [0][0] to [0][end] then [1][0] to [1][end] and so on. If firstSmallerArray number is not found return -1 or not Found. Else Get position of where it is found in the bigger Array. Get the height of Smaller Array (smallerArray.length) and width (smallerArray[0].length). Using firstSmallerArray number, smallerArray.length, and smallerArray[0].length store in temp array. check if the temp == smallerArray and get coordinates. What i need help with: for some reason even though the smaller array is inside the larger array it says button is not found (foundButton returns false). I have spent two days on it and couldn't find whats wrong. since the arrays I am using has 2 million+ RGB values I am just going to give these arrays instead for example. Bigger array: [3 3 1 0 9] [4 1 5 4 5] [7 5 6 2 8] [8 2 7 3 5] [1 8 7 6 4] Smaller array: [5 6 2] [2 7 3] [8 7 6] I am bit of a noob at coding so I likely won't understand java/coding terms. Again thanks for anyone that can help. DataStorage DataStorageObject = new DataStorage(); int[][] optionArrayButton = DataStorageObject.optionArrayButton(); int firstSmallerArrayNumber = optionArrayButton[0][0]; //Step 1 int heightOfSmallerArray = optionArrayButton.length; //Step 5 int widthOfSmallerArray = optionArrayButton[0].length; //Step 5 boolean foundButton = false; //a[][] has the screens rgb values for(int yaxisCounter = 0; yaxisCounter &lt; 300; yaxisCounter++) //Step 2 { for(int xa…
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/18172297
tagged with: multidimensional-array

http://stackoverflow.com/q/20821057
type: Question
has answer: http://stackoverflow.com/a/20821206
has answer: http://stackoverflow.com/a/20821076
has answer: http://stackoverflow.com/a/20821102
has answer: http://stackoverflow.com/a/20821354
possible better answer: http://stackoverflow.com/a/20821102
has comment: http://stackoverflow.com/comment/31222172
has title: How to sort an Array List made of String arrays?
has comment: http://stackoverflow.com/comment/31222531
tagged with: arrays
score: 1
accepted answer: http://stackoverflow.com/a/20821206
favorite count: 0
has comment: http://stackoverflow.com/comment/31222192
has comment: http://stackoverflow.com/comment/31222252
answer count: 4
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: I have a very problematic problem! I have an array list that looks like this: ArrayList&lt;String[]&gt; teamsToOrder = new ArrayList&lt;String[]&gt;(); In each string array that is added to the ArrayList looks like this: String[] arrayExample = {teamNumber,score}; String[] array1 = {"340","100"}; String[] array2 = {"7680","70"}; String[] array3 = {"770","110"}; ........... What I want to be able to do is organize the arrays by score (best score to worst) like so: String[] array3 = {"770","110"}; String[] array1 = {"340","100"}; String[] array2 = {"7680","70"}; ........... How do I organize them and store them in the ArrayList? I am sorry to mention this, but my objective requires me to organize them in ArrayList form. I can't (i'm not allowed to) create a separate class for the data....
downvote count: 1

http://stackoverflow.com/comment/31118708
has text: I wanted to avoid excessive casting, but that way should work. I decided to (de)serialize the file using base64 instead.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20755748
type: AnswerComment

http://stackoverflow.com/comment/30993176
type: AnswerComment
has text: If `guess` really is an `int`, then you won't get an `InputMismatchException`. From [the InputMismatchException API](http://docs.oracle.com/javase/7/docs/api/java/util/InputMismatchException.html): "Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type."
comment on: http://stackoverflow.com/a/20693875
type: Comment
score: 0

http://stackoverflow.com/a/20821302
score: 1
has body: If you want unique values, you don't want an array, you want a Set: Set&lt;Integer&gt; numbers = new LinkedHashSet&lt;Integer&gt;(); The LinkedHashSet implementation of Set maintains the iteration order to be the same as insertion order.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20821043
accepted answer of: http://stackoverflow.com/q/20821043
type: Answer
upvote count: 1

http://stackoverflow.com/comment/31235375
score: 0
type: Comment
has text: @Kunu Post your code in onCreate()
comment on: http://stackoverflow.com/a/20828079
type: AnswerComment

http://stackoverflow.com/comment/31130826
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20770279
has text: maybe, but it uses java.
score: 1

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

http://stackoverflow.com/comment/31118563
has text: Are you sure you're setting the Content-Type header correctly on your POST request? Have you sent your request through an HTTP recording proxy (such as Charles Proxy, but there are many others) to verify this? Show the applicable parts of your Client and Server code as well.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20763595
score: 1

http://stackoverflow.com/a/20832345
type: AcceptedAnswer
has body: There is an api for this, but it was hidden. As 323go mentions it is changing. As of kitkat it will be un-hidden. Here is a post on the new api.http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html?m=1 If you search for sms broadcast receiver, you should find some info on how to use the currently hidden api.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/20832037
answers question: http://stackoverflow.com/q/20832037
has comment: http://stackoverflow.com/comment/31244170

http://stackoverflow.com/comment/31322889
comment on: http://stackoverflow.com/a/20864821
score: 0
type: AnswerComment
has text: Thanks Joe. This is what I was looking for. Does ADF suffice my requirements and if yes what to pick from ADF BC (BC4J) vs EJB/JPA.
type: Comment

class
tags question: http://stackoverflow.com/q/20753370
tags question: http://stackoverflow.com/q/20813828
tags question: http://stackoverflow.com/q/20701816
tags question: http://stackoverflow.com/q/20767264
tags question: http://stackoverflow.com/q/20708443
tags question: http://stackoverflow.com/q/20727331
tags question: http://stackoverflow.com/q/20711961
tags question: http://stackoverflow.com/q/20760781
tags question: http://stackoverflow.com/q/20701652
tags question: http://stackoverflow.com/q/20827724
tags question: http://stackoverflow.com/q/20804225
tags question: http://stackoverflow.com/q/20811177
tags question: http://stackoverflow.com/q/20735743
tags question: http://stackoverflow.com/q/20747957
tags question: http://stackoverflow.com/q/20714964
tags question: http://stackoverflow.com/q/20713502
tags question: http://stackoverflow.com/q/20831885
tags question: http://stackoverflow.com/q/20751794
tags question: http://stackoverflow.com/q/20729459
tags question: http://stackoverflow.com/q/20696217
tags question: http://stackoverflow.com/q/20816142
tags question: http://stackoverflow.com/q/20810424
tags question: http://stackoverflow.com/q/20809432
tags question: http://stackoverflow.com/q/20817876
type: Tag
tags question: http://stackoverflow.com/q/20711084
tags question: http://stackoverflow.com/q/20777349
tags question: http://stackoverflow.com/q/20786995
tags question: http://stackoverflow.com/q/20685489
tags question: http://stackoverflow.com/q/20778611
tags question: http://stackoverflow.com/q/20826711
tags question: http://stackoverflow.com/q/20767945
tag name: class
tags question: http://stackoverflow.com/q/20751235
tags question: http://stackoverflow.com/q/20776586
tags question: http://stackoverflow.com/q/20819453
tags question: http://stackoverflow.com/q/20782009
tags question: http://stackoverflow.com/q/20835705
tags question: http://stackoverflow.com/q/20691712
tags question: http://stackoverflow.com/q/20685957
tags question: http://stackoverflow.com/q/20829943
tags question: http://stackoverflow.com/q/20726652
tags question: http://stackoverflow.com/q/20742492

http://stackoverflow.com/comment/30970350
type: AnswerComment
has text: @Eskipo I would suggest you to use the 2nd way
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20681797

http://stackoverflow.com/a/20684364
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20684345
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20684345
has body: You have to initialize it at the declaration or in the constructor. Either private final String CURRENT_USER = "SomeUser"; or in the constructor private final String CURRENT_USER; public YourClassName(){ CURRENT_USER = "test"; } But you should name an instance variable in the camel case way private final String currentUser; Otherwise someone (including me) thinks that it is a constant at first sight.
has comment: http://stackoverflow.com/comment/30974917
upvote count: 5
score: 5

http://stackoverflow.com/comment/31118724
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20754272
has text: I just posted an answer with what I had in mind. You can increase the length of the array for more concurrent sounds, but what's there should work.

http://stackoverflow.com/a/20823323
score: 4
has body: Yes, declare the method as public static ActionBarHandler withAddOption(){ and simply return null. But I don't recommend this. Use objects with method chaining. From a conceptual standpoint, it doesn't make sense to invoke a static method on an instance, even less on a null reference. For that reason alone, you should consider refactoring your design to chain instance method invocations, ie. use objects.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20823315
upvote count: 4
accepted answer of: http://stackoverflow.com/q/20823315
downvote count: 0

http://stackoverflow.com/comment/31106447
comment on: http://stackoverflow.com/q/20756526
score: 0
type: Comment
type: QuestionComment
has text: it gives the db value..11.30:00 in mycase

http://stackoverflow.com/a/20683313
downvote count: 0
upvote count: 2
has body: First of all, use java naming conventions. It makes your code clearer and easier to help. You have some errors in your code: public Day setNameDay(String Day) { Day = Days; return this; } What you do here is saving Days value in method's parameter Day which actually does nothing. public void nextDay() { Day++; if (Day &lt;8) Day = 1; setDay(Day); } Why setting day to one if it is lower than 8? You should use: if (Day &gt;8) { Day = 1; }
type: Answer
answers question: http://stackoverflow.com/q/20683189
score: 2

http://stackoverflow.com/a/20713210
has body: To do this efficiently in a different thread is not as simple as it sounds. You don't want to create and execute a new thread every time a key is pressed because: There is system overhead for thread creation which would make that an extremely intensive process There's no guarantee that the threads will execute and complete in the order they are created, so you may get an earlier thread finishing after a subsequent one and consequentially updating the list with invalid entries. You could use a single-thread executor service (which keeps one thread alive and uses it to execute Runnables passed into it in order), which would be more efficient, but you'd need to remember to shut it down when your text field is destroyed (if you do ever destroy your text field). Something along these lines: // first of all, at the class level (assuming listView and manager are both class-level variables, preferably final ones, too): // An INNER class implementing Runnable which will carry out the searching private class Searcher implements Runnable { private volatile boolean cancelled = false; private final String searchTerm; Searcher(String searchTerm) { this.searchTerm = searchTerm; } public void cancel() { cancelled = true; } @Override public void run() { // remember that there's no guarantee that this will execute before the NEXT keypress, so we add a check to ensure that we still want to perform the search when it gets executed: if (!cancelled) { manager.searchString(searchTerm); Platform.runLater(listViewUpdater); // listViewUpdater is defined below } } } // a Runnable to actually update the GUI after a seach has been performed private Runnable listViewUpdater = new Runnable(){ @Override public void run() { listView.getItems().setAll(manager.getList()); } } private ExecutorService executor = Executors.newSingleThreadExecutor(); private Searcher lastSearcher = null; // ... then, in the method which sets up the GUI search.textProperty().addListener(new ChangeListener&lt;String&gt;() …
has comment: http://stackoverflow.com/comment/31029533
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20712068
answers question: http://stackoverflow.com/q/20712068
has comment: http://stackoverflow.com/comment/31049355
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20702030
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20701958
has comment: http://stackoverflow.com/comment/31006841
has comment: http://stackoverflow.com/comment/31006932
downvote count: 0
score: 1
has body: See public static <K,V> Map<K,V> unmodifiableMap(Map<? extends K, ? extends V> m) { return new UnmodifiableMap<K,V>(m); } method of Collections class. Java Doc /** * Returns an unmodifiable view of the specified map. This method * allows modules to provide users with "read-only" access to internal * maps. Query operations on the returned map "read through" * to the specified map, and attempts to modify the returned * map, whether direct or via its collection views, result in an * UnsupportedOperationException . * * The returned map will be serializable if the specified map * is serializable. * * @param m the map for which an unmodifiable view is to be returned. * @return an unmodifiable view of the specified map. */

http://stackoverflow.com/q/20725365
has title: In a String, how can I separate & store the characters and integers?
tagged with: char
has comment: http://stackoverflow.com/comment/31050404
has comment: http://stackoverflow.com/comment/31050449
tagged with: string
accepted answer: http://stackoverflow.com/a/20726489
favorite count: 0
has comment: http://stackoverflow.com/comment/31050754
has answer: http://stackoverflow.com/a/20725876
has answer: http://stackoverflow.com/a/20725516
has body: My task is to create a Bubble Breaker type game, I broke my task into several smaller tasks, and I hit a wall. I created a 2D Array Grid which will, whenever the program starts, be randomized with different coloured Bubbles. Each Line and Each Column is numbered, Lines range in Numbers, Columns range in Letters. My goal is to have the user input choosing a String (Note I can only use String, as I'm programming in a pre-designed console), for example B10, B9 or 10B. I'm able to check if the characters are numbers or letters via command.charAt(i) &gt;= '0' &amp;&amp; command.charAt(i) &lt;= '9' // i is a counter in a for The above allows me to find if it's a digit or a number, the problem is that to select the Exact grid position, I need to, and can't: Separate the String into Integrers AND character Join the two Integrers (note they can be B9, B10 or 10B) This is an example of the duality B10 and 10B
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31050411
has comment: http://stackoverflow.com/comment/31050381
has answer: http://stackoverflow.com/a/20725507
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31050357
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20726489
possible better answer: http://stackoverflow.com/a/20725507
downvote count: 0
tagged with: type-conversion
tagged with: int

http://stackoverflow.com/comment/31260036
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20837351
has text: it should have been panel.setPreferredSize, but I don't think it changes much. I edited the question anyway.
score: 0

http://stackoverflow.com/comment/31023797
has text: Yeah, now I realize that that way of doing it is better, but I've always kept my projects in my workspace folder - somehow it just seemed logical to do that. But I disagree with your statement that the relative locations don't matter - it is clear from what I've read that you are not supposed to have repos in or beneath your workspace directory.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20711072
type: Comment

http://stackoverflow.com/q/20787858
tagged with: spring
has body: i have view bean as follows: @Named("myBean") @Scope(ScopeType.VIEW) public class MyBean implements Serializable { /** * */ private static final long serialVersionUID = -1635565383922455897L; List&lt;CompanyValue&gt; values = new ArrayList&lt;CompanyValue&gt;(6); public List&lt;CompanyValue&gt; getValues() { return values; } public void setValues(List&lt;CompanyValue&gt; values) { this.values = values; } } i am using spring scope annotation and the jsf code is as follows: &lt;h:inputText value="#{companyValueBean.values[0].name}" /&gt; the CompanyValue domain class: @Entity @Table(name = "company_value") public class CompanyValue implements Serializable { private static final long serialVersionUID = -2966293162153602542L; } @Column(name = "name", length = 25) private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } and i am getting exception: javax.el.PropertyNotFoundException: mypage.xhtml @34,195 value="#{MyBean.values[0].name}": Property 'values' not found on type com.sun.proxy.$Proxy127 at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) at javax.faces.component.UIOutput.getValue(UIOutput.java:174) at javax.faces.component.UIInput.getValue(UIInput.java:291) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1903) at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) at javax.faces.component.UIComponentBase.encodeChil…
type: AnsweredQuestion
tagged with: jsf
has answer: http://stackoverflow.com/a/20788020
tagged with: java
has comment: http://stackoverflow.com/comment/31161362
has title: Property not found on type com.sun.proxy.$Proxy127 when using implements Serializable
has comment: http://stackoverflow.com/comment/31161278
type: Question
accepted answer: http://stackoverflow.com/a/20788020
has comment: http://stackoverflow.com/comment/31161319
score: 0
has comment: http://stackoverflow.com/comment/31161444
answer count: 1
tagged with: tomcat
tagged with: serialization
has comment: http://stackoverflow.com/comment/31161416
has comment: http://stackoverflow.com/comment/31161327

http://stackoverflow.com/comment/31075360
type: Comment
comment on: http://stackoverflow.com/a/20739336
score: 0
type: AnswerComment
has text: I wouldn't know, what does your LogCat say?

http://stackoverflow.com/comment/31025500
comment on: http://stackoverflow.com/q/20711914
type: Comment
type: QuestionComment
has text: I think you're right, this might help: http://stackoverflow.com/questions/11090508/how-to-get-favicon-ico-from-a-website-using-java
score: 1

http://stackoverflow.com/q/20719363
tagged with: recursion
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31038849
accepted answer: http://stackoverflow.com/a/20719648
has comment: http://stackoverflow.com/comment/31038911
type: Question
has comment: http://stackoverflow.com/comment/31038841
tagged with: graphics
has answer: http://stackoverflow.com/a/20719648
has comment: http://stackoverflow.com/comment/31038789
has comment: http://stackoverflow.com/comment/31038870
has comment: http://stackoverflow.com/comment/31038698
answer count: 1
downvote count: 1
has body: Well since you folks helped me a lot with my last project, I thought I might find some assistance with the current one :) The project has us practicing recursion and objects (just started learning about the latter). So we first create a "BasicStar", later a "Snowflake", then comes the "SuperSnowflake" and finally the dreaded "KochCurve". So I the "BasicStar" was quite easy, and now the idea of the "Snowflake" is to recursively draw "BasicStar"s with smaller radiuses. I have uploaded three images (basic star, which I did successfully, snowflake the way it should be, and my snowflake) so it's easy to understand what I mean. My recursive method draws something very different, and I have no idea what I'm doing wrong. Any help would be great. Thanks! (P.S. The Main and Painter classes were made by the university faculty so even if there are things to improve there it won't be relevant. The rest was written by myself) Main: package recursion; import java.util.Scanner; /* * the class main get from the user the shape he wish to draw, * and call the drew method of the desired shape . */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please enter the number of the shape you wish to draw:\n" + " 1-example\n" + " 2-BasicStar\n" + " 3-Snowflake\n" + " 4-SuperSnowflake\n" + " 5-KochCurve\n" + " 6-KochSnowflake\n"); int shape = sc.nextInt(); // chooses which shape to draw based on the number received switch(shape){ /* * An example given to you so you can see how the painted works. * This example opens a frame, and draws a red line. */ case 1: drawExample(); break; case 2: drawBasicStar(); break; case 3: drawSnowflake(); break; case 4: drawSuperSnowflake(); break; case 5: drawKochCurve(); break; case 6: drawKochSnowflake(); break; default: System.out.println("invalid shape"); } sc.close(); } // Draw the example line public static void drawExample(){ Painter.draw("example"); } // Draw a BasicStar public static vo…
has title: Java - simple graphics and recursion
favorite count: 0
has comment: http://stackoverflow.com/comment/31039074
has comment: http://stackoverflow.com/comment/31038889
upvote count: 4

http://stackoverflow.com/comment/31251649
type: Comment
comment on: http://stackoverflow.com/a/20836548
score: 0
type: AnswerComment
has text: @Gem_Ram, are you sure you are commenting on the correct post?

http://stackoverflow.com/comment/31007724
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20700058
has text: Solution mentioned http://stackoverflow.com/a/3055008/948268 works for works for `insert`, `create table`. But for script having `create or replace trigger` it fails with **java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement**. Any clue why?

http://stackoverflow.com/comment/31065902
type: Comment
comment on: http://stackoverflow.com/a/20734072
score: 0
type: AnswerComment
has text: It is being thrown on the wait() call in waitForElevator() in the Person class. I was under the impression that since those calls are inside of the synchronized(areDoorsOpenOn) block that the wait and notifyAll calls would be on that object. Is that not correct?

break
tags question: http://stackoverflow.com/q/20688085
tags question: http://stackoverflow.com/q/20736574
tag name: break
type: Tag
tags question: http://stackoverflow.com/q/20800006

http://stackoverflow.com/comment/31170269
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20792674
score: 2
has text: http://www.oracle.com/technetwork/java/faq-141681.html#D1

http://stackoverflow.com/q/20762216
tagged with: antlr4
linked to: http://stackoverflow.com/q/20759138
answer count: 1
favorite count: 0
has title: Antlr4 grammar compilation error
tagged with: chess
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/20762408
accepted answer: http://stackoverflow.com/a/20762408
downvote count: 0
tagged with: java
type: Question
has body: I made my own chess PGN grammar for ANTLR4, but I get a java stacktrace error : Pgn.g4 grammar : grammar Pgn; file: game (NEWLINE+ game)*; game: (tag+ NEWLINE+)? notation; tag: '['TAG_TYPE "TAG_VALUE"']'; notation: move+ END_RESULT?; move: MOVE_NUMBER\. MOVE_DESC MOVE_DESC #CompleteMove | MOVE_NUMBER\. MOVE_DESC #OnlyWhiteMove | MOVE_NUMBER\.\.\. MOVE_DESC #OnlyBlackMove ; END_RESULT: '1-0' | '0-1' | '1/2-1/2' ; TAG_TYPE: LETTER+; TAG_VALUE: .*; MOVE_NUMBER: DIGIT+; MOVE_DESC: .*; NEWLINE: \r? \n; SPACES: [ \t]+ -&gt; skip; fragment LETTER: [a-zA-Z]; fragment DIGIT: [0-9]; And this is the error output : $ antlr4 Pgn.g4 org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:11 required (...)+ loop did not match anything at input 'r' org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:15 mismatched tree node: n expecting &lt;UP&gt; org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:11 required (...)+ loop did not match anything at input 'r' org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:15 mismatched tree node: n expecting &lt;UP&gt; org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:11 required (...)+ loop did not match anything at input 'r' org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:15 mismatched tree node: n expecting &lt;UP&gt; org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:11 required (...)+ loop did not match anything at input 'r' org\antlr\v4\parse\GrammarTreeVisitor.g: node from line 24:15 mismatched tree node: n expecting &lt;UP&gt; error(20): internal error: Rule LETTER undefined error(20): internal error: element list has first|last == null Exception in thread "main" java.lang.NullPointerException at org.antlr.v4.automata.ParserATNFactory.elemList(ParserATNFactory.java:445) at org.antlr.v4.automata.ParserATNFactory.alt(ParserATNFactory.java:414) at org.antlr.v4.parse.ATNBuilder.alternative(ATNBuilder.java:567) at org.antlr.v4.parse.ATNBuilder.block(ATNBuilder.java:400) at org.antlr.v4.parse.…
upvote count: 2

http://stackoverflow.com/a/20731516
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20730983
has body: Give a try to this: OnTouchListener touchListenerBouton1 = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { TxtResultat.setText("TEST"); return true; } }; b1 = (Button) findViewById(R.id.button1); b1.setOnTouchListener(touchListenerBouton1); Seems b1 is null or tourchListenerBouton is null. put a break point and initialize the one which is null.

http://stackoverflow.com/comment/31097552
type: QuestionComment
comment on: http://stackoverflow.com/q/20751385
score: 0
has text: "3 = Quit" -> "Please enter a valid input". Whoops.
type: Comment

http://stackoverflow.com/a/20799018
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20747283
type: Answer
has comment: http://stackoverflow.com/comment/71967391
has body: The enableStompBrokerRelay method returns a convenient Registration instance that exposes a fluent API. You can use this fluent API to configure your Broker relay: registry.enableStompBrokerRelay("/topic").setRelayHost("host").setRelayPort("1234"); You can also configure various properties, like login/pass credentials for your broker, etc. Same with XML Configuration: &lt;websocket:message-broker&gt; &lt;websocket:stomp-endpoint path="/foo"&gt; &lt;websocket:handshake-handler ref="myHandler"/&gt; &lt;websocket:sockjs/&gt; &lt;/websocket:stomp-endpoint&gt; &lt;websocket:stomp-broker-relay prefix="/topic,/queue" relay-host="relayhost" relay-port="1234" client-login="clientlogin" client-passcode="clientpass" system-login="syslogin" system-passcode="syspass" heartbeat-send-interval="5000" heartbeat-receive-interval="5000" virtual-host="example.org"/&gt; &lt;/websocket:message-broker&gt; See the StompBrokerRelayRegistration javadoc for more details on properties and default values.
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/71967303
has comment: http://stackoverflow.com/comment/71967907
has comment: http://stackoverflow.com/comment/86395353
accepted answer of: http://stackoverflow.com/q/20747283

http://stackoverflow.com/a/20800857
has comment: http://stackoverflow.com/comment/101031306
accepted answer of: http://stackoverflow.com/q/20734540
has body: I've ran into the same problem. The question here is that play-java-jpa artifact (javaJpa key in the build.sbt file) depends on a different version of the spec (version 2.0 -&gt; "org.hibernate.javax.persistence" % "hibernate-jpa-2.0-api" % "1.0.1.Final"). When you added hibernate-entitymanager 4.3 this brought the newer spec (2.1) and a different factory provider for the entitymanager. Basically you ended up having both jars in the classpath as transitive dependencies. Edit your build.sbt file like this and it will temporarily fix you problem until play releases a new version of the jpa plugin for the newer api dependency. libraryDependencies ++= Seq( javaJdbc, javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"), "org.hibernate" % "hibernate-entitymanager" % "4.3.0.Final" ) This is for play 2.2.x. In previous versions there were some differences in the build files.
has comment: http://stackoverflow.com/comment/32013369
answers question: http://stackoverflow.com/q/20734540
has comment: http://stackoverflow.com/comment/40284566
type: AcceptedAnswer
downvote count: 0
upvote count: 81
has comment: http://stackoverflow.com/comment/31194367
has comment: http://stackoverflow.com/comment/37320830
type: Answer
has comment: http://stackoverflow.com/comment/40255897
score: 81

http://stackoverflow.com/comment/60483667
type: Comment
comment on: http://stackoverflow.com/a/20751638
type: AnswerComment
has text: For me the error is caused by the "standalone" tomcat8 which was still running (using the same 8080 port) I just had to execute the command `sudo systemctrl stop tomcat8` (in Arch Linux).
score: 0

http://stackoverflow.com/comment/41818114
comment on: http://stackoverflow.com/a/25532915
type: AnswerComment
score: 0
type: Comment
has text: This did it for me, too - although I don't understand why a gradle clean would help Idea's class discovery.

http://stackoverflow.com/a/20705923
has comment: http://stackoverflow.com/comment/31017640
has body: Your showRedo() concertCategories = input.nextInt(); if(concertCategories==1){ Only handles input if it's equal to 1. You don't have a case to handle input 2 and 3. You should also look into using a Java Switch statement instead of this big nasty if-else ladder. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html
type: Answer
has comment: http://stackoverflow.com/comment/31016803
has comment: http://stackoverflow.com/comment/31017615
has comment: http://stackoverflow.com/comment/31014380
answers question: http://stackoverflow.com/q/20705826
upvote count: 1
has comment: http://stackoverflow.com/comment/31014551
has comment: http://stackoverflow.com/comment/31014024
downvote count: 0
score: 1

http://stackoverflow.com/comment/54088778
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20808325
score: 0
has text: Hi, did you find solution, I also have the same problem which I cannot write video in OpenCV3

http://stackoverflow.com/a/20707561
answers question: http://stackoverflow.com/q/20707539
has comment: http://stackoverflow.com/comment/31016868
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31016891
type: Answer
has body: Try changing to this: Math.sin(1.0 * frequency*(1.0 * j / samplesPerSecond) * Math.PI * 2) See if it works better. I suspect you have issue with integer division. In Java 2/5 = 0, you know, while 1.0 * 2 / 5 is what you would expect usually ( 0.4 ).
accepted answer of: http://stackoverflow.com/q/20707539

http://stackoverflow.com/a/20736962
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31072166
has comment: http://stackoverflow.com/comment/31072286
has comment: http://stackoverflow.com/comment/31071611
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20736909
has comment: http://stackoverflow.com/comment/31071987
accepted answer of: http://stackoverflow.com/q/20736909
has comment: http://stackoverflow.com/comment/31071718
has comment: http://stackoverflow.com/comment/31072243
has body: In your xml file do this for each button: &lt;Button android:id="@+id/sound1Button" android:onClick="buttonClick" ... /&gt; &lt;Button android:id="@+id/sound2Button" android:onClick="buttonClick" ... /&gt; &lt;Button android:id="@+id/sound3Button" android:onClick="buttonClick" ... /&gt; etc And then in your pageOneSounds activity, do this: public void buttonClick(View v) { switch(v.getId()) { case R.id.sound1Button: // do what u want here for button 1 break; case R.id.sound2Button: // do what u want here for button 2 break; case R.id.sound3Button: // do what u want here for button 3 break; // etc } }
has comment: http://stackoverflow.com/comment/31071640
has comment: http://stackoverflow.com/comment/31071817

http://stackoverflow.com/comment/31027804
comment on: http://stackoverflow.com/a/20713214
score: 0
type: AnswerComment
has text: @Aman You can override readObject and writeObject to work with only one field, rather than the whole class, if you really wanted that. Or, you could mark all the other fields as transitive.
type: Comment

http://stackoverflow.com/comment/31020014
has text: JB, I have added the abridged mapping info from the hbm.xml file.
comment on: http://stackoverflow.com/q/20708693
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20834671
upvote count: 2
has comment: http://stackoverflow.com/comment/31248481
has comment: http://stackoverflow.com/comment/31248328
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31248011
has comment: http://stackoverflow.com/comment/31247998
has comment: http://stackoverflow.com/comment/31248160
type: Answer
has comment: http://stackoverflow.com/comment/31247885
has comment: http://stackoverflow.com/comment/31248087
has comment: http://stackoverflow.com/comment/31248352
has body: Demo is a composition of 3 classes: itself, Test and Object. But an instance of Demo is one object, in memory it consists of fields of its super class + its own fields: Test.i + Demo.i (Object has no fields).
answers question: http://stackoverflow.com/q/20834598

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/20698084

http://stackoverflow.com/comment/31128638
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20768972
has text: This might be helpful for you. http://stackoverflow.com/questions/502218/sandbox-against-malicious-code-in-a-java-application?rq=1

http://stackoverflow.com/q/20756461
has answer: http://stackoverflow.com/a/20765942
has title: Error while importing jar into an android project
tagged with: eclipse
answer count: 2
linked to: http://stackoverflow.com/q/2680827
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/23839193
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: Below error i get while putting apache xerces.jar in build path .. I have searched before for the error .. and solutions described were for conflicting jars .. but that isnt the case here .. i am getting some ParserException due a bad utf-8 I have tried (but with no luck): cleaning the project restarting eclipse updating adt, sdk removing all libs and fixing proj properties and then importing xerces to resolve conflicts plus i just have only 1 external lib xerces from solutions at here removing xerces runs the proj Few months ago i had imported xerces normally via build path and it had worked. Any help appreciated! [2013-12-24 12:21:44 - tryout] Dx UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad utf-8 byte a0 at offset 00000004 at com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:374) at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:262) at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:294) at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150) at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124) at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115) at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482) at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406) at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388) at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251) at com.android.dx.command.dexer.Main.processClass(Main.java:665) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) at com.android.dx.command.dexer.Main.access$600(Main.java:78) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(Cla…
upvote count: 6
tagged with: java
score: 6
type: Question

http://stackoverflow.com/q/20840256
has answer: http://stackoverflow.com/a/20840504
has comment: http://stackoverflow.com/comment/31257492
has body: I'm trying to generate a UUID with all zeros: java.util.UUID fromString "00000000-00000000-00000000-00000000" The error is java.lang.IllegalArgumentException: Invalid UUID string: 00000000-00000000-00000000-00000000 at java.util.UUID.fromString(UUID.java:194) What am I doing wrong? I want to create either "MinValue" or "Invalid" UUID.
downvote count: 0
has comment: http://stackoverflow.com/comment/31257498
has answer: http://stackoverflow.com/a/77615428
favorite count: 0
accepted answer: http://stackoverflow.com/a/20840504
score: 52
has comment: http://stackoverflow.com/comment/31257525
tagged with: scala
upvote count: 52
possible better answer: http://stackoverflow.com/a/20840291
has title: Create UUID with zeros
has answer: http://stackoverflow.com/a/20840291
answer count: 4
type: AnsweredQuestion
tagged with: uuid
tagged with: java
has answer: http://stackoverflow.com/a/51622153
type: Question
has comment: http://stackoverflow.com/comment/31257506

http://stackoverflow.com/q/20799763
has comment: http://stackoverflow.com/comment/31183091
answer count: 1
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/31183011
tagged with: serialization
has comment: http://stackoverflow.com/comment/31182957
has comment: http://stackoverflow.com/comment/31183114
has comment: http://stackoverflow.com/comment/31182909
has comment: http://stackoverflow.com/comment/31182881
has comment: http://stackoverflow.com/comment/31182809
has comment: http://stackoverflow.com/comment/31183039
has title: Eclipse Console Output Limit
has comment: http://stackoverflow.com/comment/31182887
has comment: http://stackoverflow.com/comment/31183033
linked to: http://stackoverflow.com/q/2828255
favorite count: 0
has comment: http://stackoverflow.com/comment/31183169
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31182993
has comment: http://stackoverflow.com/comment/31183127
has comment: http://stackoverflow.com/comment/31183070
type: Question
has comment: http://stackoverflow.com/comment/31182861
has answer: http://stackoverflow.com/a/20800178
has body: I am using BufferReader to read log files from a game server. It does work but it just doesn't read the entire file just a small portion of it. My code: public ArrayList&lt;String&gt; readFile(File file){ try (BufferedReader br = new BufferedReader(new FileReader(file.getAbsolutePath()))) { String sCurrentLine; ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); while ((sCurrentLine = br.readLine()) != null) { list.add(sCurrentLine); } return list; } catch (IOException e) { e.printStackTrace(); } return null; } The files that i try to read have the size between 0.5 MB - 1.5 MB. The server logs look like this but it has many more lines. Like 20000 lines. I am only getting like 1500 lines from it. 00:05:29 - Great_Zhupan_Uros_SRB &lt;img=ico_spear&gt; Wolfpack_SikiciArthasan 00:05:32 - Teamhit: AE_Shemaforash hit AB_Artorius for 10 hp. 00:05:32 - AE_Shemaforash &lt;img=ico_axeone&gt; AB_Artorius 00:05:32 - AE_Shemaforash(20578) teamkilled AB_Artorius(1076080). 00:05:41 - Great_Zhupan_Uros_SRB &lt;img=ico_spear&gt; IR_Fall3N~3nG3l 00:05:46 - AE_Shemaforash &lt;img=ico_axeone&gt; Xodanrot 00:06:05 - *DEAD* [AE_Blivandefar] xxxxxxxxxxxxxxxx 00:06:05 - Wolfpack_Dennell has joined the game with ID: 1305305 00:06:07 - Wolfpack_Dennell joined the server. The log file starts at time 00:00:00 and ends at 23:59:59. When i start reading it, it only reads a small part of it like from 22:08:00 to 23:59:59. Can someone tell me what i am doing wrong? And if there are better solutions for this then i am all ears. Im using this data to convert them into statistics for players.
score: 1
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/20800178
has comment: http://stackoverflow.com/comment/31182822
has comment: http://stackoverflow.com/comment/31182959
has comment: http://stackoverflow.com/comment/31182930
upvote count: 4
has comment: http://stackoverflow.com/comment/31182972
has comment: http://stackoverflow.com/comment/31183097

http://stackoverflow.com/q/20810475
has title: SSL in two ways not working for my OpenLDAP
has answer: http://stackoverflow.com/a/20924786
has comment: http://stackoverflow.com/comment/31227318
tagged with: openldap
accepted answer: http://stackoverflow.com/a/20924786
type: AnsweredQuestion
tagged with: java
type: Question
has body: i am tying to to test an SSL 2 way connection (handshake) between a JAVA client and OpenLDAP server. System.setProperty("javax.net.ssl.trustStore","C:\\Program Files (x86)\\Java\\jre7\\lib\\security\\cacerts"); System.setProperty("javax.net.ssl.trustStorePassword","changeit"); System.setProperty("javax.net.debug","ssl"); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); // Specify SSL env.put(Context.SECURITY_PROTOCOL, "SSLv3"); System.setProperty("javax.net.ssl.keyStoreType", "PKCS12"); System.setProperty("javax.net.ssl.keyStore", "C:\\OpenLDAP\\etc\\certs\\client.p12"); System.setProperty("javax.net.ssl.keyStorePassword", "password"); env.put(Context.PROVIDER_URL, "ldaps://localhost:636"); i installed OpenLDAP with default parameters and i exported the server.pem to the truststore above. from the logs i can see that the handshake failed after serverHello is done , wich i guess the problem of trying to get client certificate. what can be wrong with the configuration that i did ?
tagged with: ssl
score: 0
answer count: 1

http://stackoverflow.com/comment/31210332
comment on: http://stackoverflow.com/a/20814595
type: Comment
has text: I updated the code, but I get error at this line `MessageDigest.getInstance(data);`.
type: AnswerComment
score: 0

http://stackoverflow.com/a/20688416
type: Answer
answers question: http://stackoverflow.com/q/20688085
upvote count: 1
has body: Use return statements. The idea is to keep it readable and maintainable. Just don't make different method calls inside those if statements and you will be fine. Read this post from Bruce Eckel: http://onthethought.blogspot.com/2004/12/multiple-return-statements.html Another benefit of using return statements is that another programmer is less likely to come along and modify your local variable, causing an incorrect value to be returned.
score: 1
downvote count: 0

http://stackoverflow.com/q/20740961
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20741051
upvote count: 19
tagged with: nio
has answer: http://stackoverflow.com/a/20741790
tagged with: asynchronous
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has title: Java NIO non-blocking mode vs node.js asynchronous operation
score: 19
tagged with: node.js
has body: I have not gone through the code detail of node.js . But, going through some research about thread in Node.js, I found that it has single thread for accepting connection from multiple clients. When connected with client it fires connection events and listens for another client and work fully in asynchronous style and rest operation of client request is performed from thread pool and result is sent back to main thread(Thread that accepts connection) via callback. Like wise in Java NIO also ServerSocketChannel,SocketChannel can be set in non-blocking mode and with selector single thread can monitor multiple channels. So, using NIO ServerSocketChannel,SocketChannel also from single thread the connection can be managed asynchronously for multiple clients So, is the NIO's non-blocking mode and node.js asynchronous with single thread follows the same pattern for concept of single thread? As both say they perform on single thread.
linked to: http://stackoverflow.com/q/35660710
tagged with: java
has comment: http://stackoverflow.com/comment/31080345

command
tags question: http://stackoverflow.com/q/20717746
tag name: command
type: Tag

http://stackoverflow.com/q/20827834
score: 0
answer count: 1
tagged with: classloader
has answer: http://stackoverflow.com/a/20841382
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am trying to compile and load a class dynamically during runtime using the JavaCompiler API. I store the compiled bytecode in memory. So I use a custom class loader to load the class. public class CompilerAPITest { static String sourceCode = "package in.test;" + "public class DynamicCompilationHelloWorld implements TestInterface{" + "public void test (){" + "System.out.println (\"Hello, dynamic compilation world!\");" + "new in.test.another.SomeClass().fun();" + "}" + "}" ; public void doCompilation (){ SimpleJavaFileObject fileObject = new DynamicJavaSourceCodeObject ("in.test.DynamicCompilationHelloWorld", sourceCode) ; JavaFileObject javaFileObjects[] = new JavaFileObject[]{fileObject} ; JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); JavaFileManager stdFileManager = new CompilerAPITest.ClassFileManager(compiler .getStandardFileManager(null, null, null)); Iterable&lt;? extends JavaFileObject&gt; compilationUnits = Arrays.asList(javaFileObjects); DiagnosticCollector&lt;JavaFileObject&gt; diagnostics = new DiagnosticCollector&lt;JavaFileObject&gt;(); List&lt;String&gt; options = Arrays.asList("-cp", System.getProperty("java.class.path") + ":" + getPath(CompilerAPITest.class)); CompilationTask compilerTask = compiler.getTask(null, stdFileManager, diagnostics, options, null, compilationUnits) ; boolean status = compilerTask.call(); if (!status){//If compilation error occurs /*Iterate through each compilation problem and print it*/ for (Diagnostic&lt;? extends JavaFileObject&gt; diagnostic : diagnostics.getDiagnostics()){ System.out.format("Error on line %d in %s", diagnostic.getLineNumber(), diagnostic); } } try { stdFileManager.close() ;//Close the file manager } catch (IOException e) { e.printStackTrace(); } try { stdFileManager.getClassLoader(null) .loadClass("in.test.DynamicCompilationHelloWorld").asSubclass(TestInterface.class).newInstance().test(); } catch (ClassNotFoundException e) { e.printStackTrace(); //This does nothing. } catch (Instantiat…
accepted answer: http://stackoverflow.com/a/20841382
has title: Custom ClassLoader with JBoss
tagged with: jboss

http://stackoverflow.com/a/20683093
accepted answer of: http://stackoverflow.com/q/20682969
answers question: http://stackoverflow.com/q/20682969
type: AcceptedAnswer
score: 0
type: Answer
has body: Nothing replaced. But your copy constructor definitely will. Make a copy constructor in your class For Example : Class SomeClass{ private String testString ; public SomeClass(SomeClass obj) { this.testString = obj.testString; } } When you define a class by extending above class, you need to define a similar constructor there also. In child class, you need to copy child specific attributes and pass the argument to super class’s constructor

http://stackoverflow.com/comment/31082800
score: 0
type: Comment
type: QuestionComment
has text: even if you call close() , its left to the OS to close them.. calling close() is like telling the OS "Bro, I am done with this socket"..
comment on: http://stackoverflow.com/q/20743853

http://stackoverflow.com/q/20788586
tagged with: android
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2578862
has body: I'm trying to create a simple recorder which gives 'pause' and 'resume' functionality to the user. Since Android does not support this directly, I'm creating individual files whenever the user presses 'Pause' and 'Resume' with the suffixes _1, _2, so on. I use the code below to concatenate them public void mergeAllAndSave() { // TODO Auto-generated method stub Enumeration&lt;FileInputStream&gt; allRecordings; Vector&lt;FileInputStream&gt; audiofiles = new Vector&lt;FileInputStream&gt;(); for (int i = 1; i &lt; count+1; i++) { try { audiofiles.add(new FileInputStream(Environment.getExternalStorageDirectory().getPath() + "/"+ AUDIO_RECORDER_FOLDER + "/" + _filename + "_"+ i + file_exts[currentFormat])); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } allRecordings = audiofiles.elements(); SequenceInputStream siStream = new SequenceInputStream(allRecordings); try { FileOutputStream foStream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + "/"+ AUDIO_RECORDER_FOLDER + "/" + _filename + file_exts[currentFormat]); int temp; while ((temp = siStream.read() ) != -1) { foStream.write(temp); } foStream.close(); siStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } The code works fine. It gives me a single file. However it contains the contents of the first file only. Logcat does not show any errors, whatsoever. Anyone with any ideas what is the mistake I am making? Thanks.
tagged with: android-mediarecorder
tagged with: java
has title: Multiple Audio files won't concatenate
type: Question
tagged with: mediarecorder
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/20794273

http://stackoverflow.com/q/20762423
possible better answer: http://stackoverflow.com/a/20762811
has title: Why I cannot Create an Object of Some JAVA class in JSP page
has body: I have following JAVA class named as Demo of com package package com; public class Demo { public String getMessage() { return "hello"; } } now i want to call a method of Demo class in my index.jsp page <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO- 8859-1"%> <%@ page import="com.Demo" %> Service Call Management <% Demo d = new Demo(); out.println(d.getMessage()); %> but i get this error by my Apache 7.0.35 server in Eclipse Kepler type Exception report message An exception occurred processing JSP page /index.jsp at line 13 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 13 10: 11: 12: <% 13: Demo d = new Demo(); 14: out.println(d.getMessage()); 15: %> 16: so please help me to resolve this issue Here is the Stack Trace Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) here is the root cause root cause javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: com/Demo : Unsupported major.minor version 51.0 (unable to load class com.Demo) org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java :912) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841) org.apache.jsp.index_jsp._jspService(index_jsp.java:90) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl…
has answer: http://stackoverflow.com/a/20762811
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31116212
tagged with: jsp
has comment: http://stackoverflow.com/comment/31116318
has answer: http://stackoverflow.com/a/20762784
accepted answer: http://stackoverflow.com/a/20762784
linked to: http://stackoverflow.com/q/3177733

http://stackoverflow.com/comment/31035091
type: Comment
type: QuestionComment
has text: It works for me. Maybe those tables weren't deleted (or created) by Hibernate? If you can share a sample project that shows this problem it will be easier to diagnose.
score: 1
comment on: http://stackoverflow.com/q/20707203

http://stackoverflow.com/a/20734893
has comment: http://stackoverflow.com/comment/31091125
has comment: http://stackoverflow.com/comment/31562200
has comment: http://stackoverflow.com/comment/32077514
has comment: http://stackoverflow.com/comment/31413141
score: 0
has comment: http://stackoverflow.com/comment/31951105
has comment: http://stackoverflow.com/comment/31561262
has comment: http://stackoverflow.com/comment/32532410
has comment: http://stackoverflow.com/comment/33433027
has comment: http://stackoverflow.com/comment/31414085
has comment: http://stackoverflow.com/comment/32512761
type: Answer
has comment: http://stackoverflow.com/comment/32603826
has comment: http://stackoverflow.com/comment/31600709
has comment: http://stackoverflow.com/comment/31893494
has comment: http://stackoverflow.com/comment/31801077
has comment: http://stackoverflow.com/comment/32616484
has comment: http://stackoverflow.com/comment/32472015
has comment: http://stackoverflow.com/comment/33286673
has comment: http://stackoverflow.com/comment/31513426
has comment: http://stackoverflow.com/comment/33551932
has comment: http://stackoverflow.com/comment/31091204
has comment: http://stackoverflow.com/comment/31893635
has comment: http://stackoverflow.com/comment/32510866
has comment: http://stackoverflow.com/comment/32578929
has comment: http://stackoverflow.com/comment/32077573
has comment: http://stackoverflow.com/comment/32470244
answers question: http://stackoverflow.com/q/20730933
has comment: http://stackoverflow.com/comment/31518187
has body: First of all, did you verifued that the element you tried to click is present? assert backButton .isDisplayed(); Regarding the clicking, here is number of different approaches. Finding the WebElement by the name argument: WebElement backButton = driver.findElement(By.name("menu")); backButton .click(); Or to write them together ("should" be the same): driver.findElement(By.name("menu")).click(); Or you can use keyboard enter: driver.findElement(By.name("menu")).sendKeys(Keys.Return); Or: driver.findElement(By.name("menu")).sendKeys(Keys.Enter);
has comment: http://stackoverflow.com/comment/31950848
has comment: http://stackoverflow.com/comment/32733673
has comment: http://stackoverflow.com/comment/31700592
has comment: http://stackoverflow.com/comment/31091156
has comment: http://stackoverflow.com/comment/31413176
has comment: http://stackoverflow.com/comment/31600933
has comment: http://stackoverflow.com/comment/31464579

http://stackoverflow.com/q/20781604
tagged with: java
score: 0
tagged with: log4j2
has title: Set messages pattern in Log4J
has answer: http://stackoverflow.com/a/20781711
type: AnsweredQuestion
tagged with: log4j
type: Question
accepted answer: http://stackoverflow.com/a/20781711
answer count: 1
has body: I have this Log4J configuration which generates messages into log file: log = Logger.getLogger(LogMessages.class.getName()); BasicConfigurator.configure(); // Basic configuration for Log4J 1.x ConsoleAppender console = new ConsoleAppender(); //create appender //configure the appender String PATTERN = "%d{DATE} [%p|%c|%C{1}] %m%n"; console.setLayout(new PatternLayout(PATTERN)); console.setThreshold(Level.FATAL); console.activateOptions(); //add appender to any Logger (here is root) Logger.getRootLogger().addAppender(console); DailyRollingFileAppender fa = new DailyRollingFileAppender(); fa.setName("FileLogger"); fa.setFile("log" + File.separator + "messages.log"); fa.setDatePattern("'.'yyyy-MM-dd"); fa.setLayout(new PatternLayout("%d %-5p [%c{1}] %m%n")); fa.setThreshold(Level.DEBUG); fa.setAppend(true); fa.activateOptions(); //add appender to any Logger (here is root) Logger.getRootLogger().addAppender(fa); //repeat with all other desired appenders This is the generated output: 2013-12-26 10:19:27,501 WARN [LogMessages] test_message I would like to generate message like this: 2013-12-26 10:19:27 WARN test_message How I can remove [LogMessages] from the messages?

http://stackoverflow.com/a/20776421
has body: An InputStream is a different concept than a "byte representation of the file". You can actually get that from the stream, but most likely you don't want to. A stream is an abstract concept of a queue of bytes, and is valid for a lot of things, not just files. By reading from an InputStream you're actually reading the file's byte contents, but one by one to avoid wasting memory whn reading big files. What you might be interested in, though, is memory mapping. Memory mapping allows you to map a portion of a file (or the whole file) directly into memory, so you can work directly with is. Read more about Java's memory mapping here: http://docs.oracle.com/javase/7/docs/api/java/nio/MappedByteBuffer.html
score: 1
answers question: http://stackoverflow.com/q/20776339
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/20798773
answers question: http://stackoverflow.com/q/20798313
has body: First i would check if my source list, the one populated from DB has more than 1 element. If you are using JDBC, its a very common mistake to not move the result set objects further. Secondly if you need such collection manipulation utilities i suggest take a look at commons-collections ListUtils class.
score: 0
type: Answer

http://stackoverflow.com/a/20771179
has comment: http://stackoverflow.com/comment/31132973
has comment: http://stackoverflow.com/comment/31144151
has comment: http://stackoverflow.com/comment/31144175
score: 3
has comment: http://stackoverflow.com/comment/31132625
has comment: http://stackoverflow.com/comment/31132348
has comment: http://stackoverflow.com/comment/31142632
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20771106
has body: In terms of Big-O complexity, your solution is optimal. It doesn't matter if you're using an array or an ArrayList, sorting takes O(nlogn) in both cases. You could optimize in the small, such as avoiding creating new throw-away objects in your compare method. But in the big picture this will have a marginal effect on performance. Thus, are you sure that your general approach to the task is correct? I mean, do you really need to sort the list? For instance, if the task is just to find the minimum qi, you could do without sorting the whole list. This can be generalized to the n smallest qi's like this: List&lt;Song&gt; list; // all songs int n; // provided by user TreeSet&lt;Song&gt; set = new TreeSet&lt;Song&gt;(new Comparator() ...); for (int i = 0; i &lt; n; i++) { set.add(list.get(i)); } Song max = set.last(); for (int i = n; i &lt; list.size(); i++) { Song song = list.get(i); if (song.qi &lt; max.qi) { set.remove(max); set.add(song); max = set.last(); } } Here, we assume that the list of songs is very big and that n is smaller than the number of songs in the list. As you can see, you don't have to sort the whole list, it's sufficient to iterate over the list linearly once, and only keep the output set sorted. The Comparator is the same that you used in your own code, but you can do without the new Long if you do the comparison "manually" public int compare(Song s1, Song s2) { if (s1.qi &lt; s2.qi) return -1; if (s1.qi &gt; s2.qi) return 1; return 0; }
has comment: http://stackoverflow.com/comment/31142989
has comment: http://stackoverflow.com/comment/31134388
type: Answer
has comment: http://stackoverflow.com/comment/31132706
has comment: http://stackoverflow.com/comment/31135829
accepted answer of: http://stackoverflow.com/q/20771106

http://stackoverflow.com/comment/31107875
type: Comment
comment on: http://stackoverflow.com/a/20757326
score: 0
type: AnswerComment
has text: I updated my answer to give you idea how to handle async way. If MainActivity is not the Activity of Fragment, you could have a separate class which fetches the location and then notifies all listeners and passes the address to them. Static class could be useful here.

http://stackoverflow.com/comment/31287659
comment on: http://stackoverflow.com/a/20803508
has text: Check the $PATH environment variable, you will find which java is configured for your environement
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20842203
type: Answer
answers question: http://stackoverflow.com/q/20822820
score: 0
accepted answer of: http://stackoverflow.com/q/20822820
type: AcceptedAnswer
has body: In regards to what I wrote below, according to Google "Some features of the App Engine Java SDK tools are only available by running the tools directly from the command line," so not using the the command line tool may come back and bite me in the future, but for now the Eclipse plugin will suffice. If anyone can provide insight on my question above, please share. Here's a Google page on the various command line functions. I ended up using Eclipse with the Google App Engine plug-in and that was so much easier and faster than using the command line tool to execute Google App Engine functions. The Eclipse Google App Engine plugin also has Endpoints, which generates APIs and client libraries for web, Android, and iOS clients from an App Engine application. Here's the link for the Google documentation on the Eclipse Google App Engine plug-in. Here's the link on Using the Google Plugin for Eclipse Here's the link for the page that has the download instuctions for the Eclipse Google App Engine plugin.

http://stackoverflow.com/comment/30982698
type: Comment
comment on: http://stackoverflow.com/q/20688085
has text: @ajb, a lot of my professors have advised against using try... unless you are specifically working with exceptions, and even to be very wary then. What's your standing behind using try...finally?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/30977837
type: AnswerComment
type: Comment
has text: @PeteVerdon, he's comparing them **exactly** for equality. Check his `if` statement. ;)
comment on: http://stackoverflow.com/a/20685734
score: 0

http://stackoverflow.com/a/24573187
type: Answer
has comment: http://stackoverflow.com/comment/38065290
has body: Document doc = Jsoup.connect("http://sports.163.com/13/0830/22/97IFSI5I00051CD5.html").get(); **Entities.EscapeMode.base.getMap().clear();** Elements elements = doc.select("textarea[id^=photoList]"); for(Element e:elements){ System.out.println(e.html()); }
answers question: http://stackoverflow.com/q/20736303
score: 0
has comment: http://stackoverflow.com/comment/38064391

http://stackoverflow.com/comment/31236047
has text: @user3144438, I was giving you the suggestion, btw the spelling of Position is wrong, that may be reason.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20828494

http://stackoverflow.com/comment/31190647
comment on: http://stackoverflow.com/q/20804067
score: 0
type: Comment
type: QuestionComment
has text: There isn't any way you could distribute workload evenly over day? (e.g queues)

for-loop
tags question: http://stackoverflow.com/q/20826010
tags question: http://stackoverflow.com/q/20730309
tags question: http://stackoverflow.com/q/20685670
tags question: http://stackoverflow.com/q/20721557
tags question: http://stackoverflow.com/q/20818598
tags question: http://stackoverflow.com/q/20759528
tags question: http://stackoverflow.com/q/20707218
tags question: http://stackoverflow.com/q/20731679
tags question: http://stackoverflow.com/q/20686855
tags question: http://stackoverflow.com/q/20698090
tags question: http://stackoverflow.com/q/20849551
tag name: for-loop
tags question: http://stackoverflow.com/q/20692940
tags question: http://stackoverflow.com/q/20849512
tags question: http://stackoverflow.com/q/20835324
tags question: http://stackoverflow.com/q/20845223
tags question: http://stackoverflow.com/q/20761690
tags question: http://stackoverflow.com/q/20812479
type: Tag
tags question: http://stackoverflow.com/q/20796676
tags question: http://stackoverflow.com/q/20840967
tags question: http://stackoverflow.com/q/20823514
tags question: http://stackoverflow.com/q/20770344
tags question: http://stackoverflow.com/q/20777749
tags question: http://stackoverflow.com/q/20807240
tags question: http://stackoverflow.com/q/20811430
tags question: http://stackoverflow.com/q/20750746
tags question: http://stackoverflow.com/q/20792161

http://stackoverflow.com/comment/105919856
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20727900
has text: use this https://github.com/kiranbjm/xlsxparser

http://stackoverflow.com/comment/31098507
type: Comment
has text: Well, then the `list.size()` in the outer for would be counted, too.
comment on: http://stackoverflow.com/q/20752062
score: 0
type: QuestionComment

http://stackoverflow.com/a/20743673
has body: First of all Android Application Project is different from Java Project. You can not use File file = new File("C:\\Users\\John\\Desktop\\try.txt"); in android. Place your text file in the /assets directory under the Android project. Use AssetManager class to access it. AssetManager am = context.getAssets(); InputStream is = am.open("test.txt"); If you are going to access file from memory card, Then use inputsteram is in your program. Also you need the following permission to read the text file &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
type: Answer
has comment: http://stackoverflow.com/comment/31086992
score: 0
answers question: http://stackoverflow.com/q/20743025

random
tags question: http://stackoverflow.com/q/20729116
tags question: http://stackoverflow.com/q/20848422
tags question: http://stackoverflow.com/q/20733741
tags question: http://stackoverflow.com/q/20723568
tags question: http://stackoverflow.com/q/20692940
tags question: http://stackoverflow.com/q/20755631
tags question: http://stackoverflow.com/q/20694571
tags question: http://stackoverflow.com/q/20817374
tags question: http://stackoverflow.com/q/20771479
tag name: random
tags question: http://stackoverflow.com/q/20713673
tags question: http://stackoverflow.com/q/20782919
tags question: http://stackoverflow.com/q/20695159
type: Tag
tags question: http://stackoverflow.com/q/20787760

http://stackoverflow.com/q/20775487
type: Question
tagged with: junit4
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20776685
accepted answer: http://stackoverflow.com/a/20776685
has body: I'm extremely new to spring testing. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/applicationContextTest.xml") public class joinTest { @Mock @Autowired private AccountDAO DAO; @Test public void testMethod() { (DAO).getJoin(); } } The test complains about the transactionManager that I have in my applicationContextTest. Obviously I'm running this out of a container. I don't really know how to deal with transactions in a Spring Test context. <context:component-scan base-package="com.abstinence.Logic"/> <context:annotation-config/> org.hibernate.dialect.HSQLDialect <tx:advice id="txAdvice"> <tx:attributes> <tx:method name="*"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="hibernateDAOOperation" expression="execution(* com.abstinence.Logic.AccountDAO.*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="hibernateDAOOperation"/> </aop:config> The exact error I get is this: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountDAO' defined in file [/home/user/NetBeansProjects/WebAbstinenceMaven/target/classes/com/abstinence/Logic/AccountDAO.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContextTest.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getConnectionProvider()Lorg/hibernate/service/jdbc/connections/spi/ConnectionProvider; I've been confused for a few days trying to figure this out. Can someone point in the right direction?
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: spring test and transaction management

http://stackoverflow.com/q/20818056
favorite count: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20819936
tagged with: xmlpullparser
score: 1
tagged with: java
upvote count: 1
has body: That's my xml file: John 1 1 Jordan 2 2 And my Java parseXML() method looks like this: public void parseXML() throws XmlPullParserException, IOException, NullPointerException { XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser xpp = factory.newPullParser(); File file = new File("in.xml"); FileInputStream fis = new FileInputStream(file); xpp.setInput(new InputStreamReader(fis)); int eventType = xpp.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { String tag = xpp.getName(); Currency c = new Currency(); if (tag.equals("euro")) { eventType = xpp.next(); c.setEuro(Integer.parseInt(xpp.getText())); } if (tag.equals("dollar")) { eventType = xpp.next(); c.setDollar(Integer.parseInt(xpp.getText())); } if (tag.equals("name")) { eventType = xpp.next(); nameList.add(xpp.getText()); } How to parse tags euro and dollar inside currency tag? I have no idea how to do this. Anyone can help me with this problem? I looked for it in google but didn't get my solution.
type: Question
has comment: http://stackoverflow.com/comment/31216714
accepted answer: http://stackoverflow.com/a/20819936
has title: XmlPullParser parsing inside tag
answer count: 1
downvote count: 0
tagged with: parsing

http://stackoverflow.com/comment/31009411
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20696074
has text: According to the code, this is what to be expected right? What exactly do you want to achieve (desired result)?

http://stackoverflow.com/q/20824943
has comment: http://stackoverflow.com/comment/31229155
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31229142
possible better answer: http://stackoverflow.com/a/20824959
linked to: http://stackoverflow.com/q/17489250
accepted answer: http://stackoverflow.com/a/20824962
has title: Best way to create objects in Java, and when do we have memory leak
has body: Class A { A(); } First way: A a = null; Second way: A a = new A(); What is the difference between these two object declarations? Is there any eventual Memory Leak problem?
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/31229181
has answer: http://stackoverflow.com/a/20824962
tagged with: java
has answer: http://stackoverflow.com/a/20824959
type: Question

http://stackoverflow.com/comment/31267764
comment on: http://stackoverflow.com/a/20845287
score: 0
type: AnswerComment
has text: Sir I have no clue where it goes out of bound , its just that whenever more than 2 letters are typed in the jTextPane2 , the exception comes in the console saying "String index out of range: 2" and program freezes.
type: Comment

http://stackoverflow.com/comment/31183122
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20799512
has text: @dbw I entered `عتباري` in the jsp input box and in used `request.getParameter("faMSg")` to get the value and here i got `عتباري` but i should get `عتباري`
type: Comment

while-loop
tags question: http://stackoverflow.com/q/20812479
type: Tag
tags question: http://stackoverflow.com/q/20816555
tags question: http://stackoverflow.com/q/20802808
tags question: http://stackoverflow.com/q/20800006
tags question: http://stackoverflow.com/q/20682128
tags question: http://stackoverflow.com/q/20681008
tags question: http://stackoverflow.com/q/20761486
tags question: http://stackoverflow.com/q/20713355
tags question: http://stackoverflow.com/q/20691697
tags question: http://stackoverflow.com/q/20835324
tags question: http://stackoverflow.com/q/20847697
tag name: while-loop
tags question: http://stackoverflow.com/q/20760062

http://stackoverflow.com/comment/31135575
type: AnswerComment
score: 0
type: Comment
has text: Somehow beans.xml didn't work I placed it in resources/WEB-INF, but still Nullpointer, I will give @EJB a try
comment on: http://stackoverflow.com/a/20772999

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/20778865
tags question: http://stackoverflow.com/q/20687203
tags question: http://stackoverflow.com/q/20768467
tags question: http://stackoverflow.com/q/20821112
tags question: http://stackoverflow.com/q/20847191

date
tags question: http://stackoverflow.com/q/20836653
tags question: http://stackoverflow.com/q/20744474
tags question: http://stackoverflow.com/q/20717425
tag name: date
tags question: http://stackoverflow.com/q/20733472
tags question: http://stackoverflow.com/q/20800879
tags question: http://stackoverflow.com/q/20720417
tags question: http://stackoverflow.com/q/20693131
tags question: http://stackoverflow.com/q/20694628
tags question: http://stackoverflow.com/q/20690598
tags question: http://stackoverflow.com/q/20800895
tags question: http://stackoverflow.com/q/20819872
tags question: http://stackoverflow.com/q/20724591
tags question: http://stackoverflow.com/q/20796970
tags question: http://stackoverflow.com/q/20702055
tags question: http://stackoverflow.com/q/20806032
tags question: http://stackoverflow.com/q/20744007
type: Tag
tags question: http://stackoverflow.com/q/20782600
tags question: http://stackoverflow.com/q/20730790
tags question: http://stackoverflow.com/q/20782524
tags question: http://stackoverflow.com/q/20754288
tags question: http://stackoverflow.com/q/20823477
tags question: http://stackoverflow.com/q/20755666
tags question: http://stackoverflow.com/q/20774765
tags question: http://stackoverflow.com/q/20762089
tags question: http://stackoverflow.com/q/20800548
tags question: http://stackoverflow.com/q/20741426
tags question: http://stackoverflow.com/q/20816701
tags question: http://stackoverflow.com/q/20750097
tags question: http://stackoverflow.com/q/20742015
tags question: http://stackoverflow.com/q/20754813
tags question: http://stackoverflow.com/q/20738911
tags question: http://stackoverflow.com/q/20790546
tags question: http://stackoverflow.com/q/20786418

http://stackoverflow.com/comment/31101084
comment on: http://stackoverflow.com/a/20747211
type: AnswerComment
score: 0
type: Comment
has text: Thanks for creating and sharing this post. I believe that this excellent post could be made more elaborate for the benefit of the community. Please let me know if you would be open to collaborating on it.

http://stackoverflow.com/comment/31087211
has text: Eclipse. It's a school project.
type: Comment
comment on: http://stackoverflow.com/a/20729004
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31263580
comment on: http://stackoverflow.com/a/20837093
type: AnswerComment
score: 0
type: Comment
has text: They have done a very impressive talk in the GWT.Create event (so, yes, you are playing with GWT stuff :D ).

http://stackoverflow.com/comment/31011455
comment on: http://stackoverflow.com/a/20704587
has text: @Stoffelchen - you could try the `Connection` interface, it is closer to the metal.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/20809432
tagged with: swing
linked to: http://stackoverflow.com/q/13717826
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31200959
has comment: http://stackoverflow.com/comment/31201384
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31201489
has comment: http://stackoverflow.com/comment/31201694
has title: Updating JProgressBar from separate class
has comment: http://stackoverflow.com/comment/31201263
has comment: http://stackoverflow.com/comment/31200766
tagged with: class
has comment: http://stackoverflow.com/comment/31200991
has body: I've been following this thread to try to update a JProgressBar from a separate class in my program: java - Progress Bar - Is it possible to use setProgess() of Progress Bar outside the doInBackground() method? Unfortunately my code isn't work properly. I probably missed something, but I can't seem to figure out what it was. This is the code I have written so far: Here is the propertyChangeListener I use to update the progress bar: PropertyChangeListener listener = new PropertyChangeListener(){ public void propertyChange(PropertyChangeEvent event){ if("progress".equals(event.getPropertyName())){ progressBar.setValue((int)currentPercent); progressBar.setString(Integer.toString((int)currentPercent)); } } }; SwingWorker class: class Task extends SwingWorker&lt;Void, String&gt;{ public Task(){ md = new ManipulateDirectories(this); } @Override public Void doInBackground(){ for(int i = 0; i &lt; directories.length; i++){ md.copyDirectory(directories[i], backupDir); } return null; } @Override public void process(List&lt;String&gt; chunks){ } @Override public void done(){ closeWindow(); } public void updateProgress(int tick){ setProgress(tick); } } ManipulateDirectories class: public class ManipulateDirectories{ Task task; public ManipulateDirectories(Task task){ this.task = task; } //Recursive function to loop through and copy individual files public void copyDirectory(File file, File dest){ if(file.isFile()){ try { FileUtils.copyFileToDirectory(file, dest); currentSize = currentSize + getDirSize(file); if(currentSize &gt;= ONE_PERCENT){ currentPercent = currentPercent + (currentSize / ONE_PERCENT); task.updateProgress((int)currentPercent); //THIS LINE DOES NOT WORK currentSize = currentSize % ONE_PERCENT; } } catch (IOException e) { e.printStackTrace(); } } else if (file.isDirectory()){ File newDir = new File(String.format("%s\\%s", dest.getAbsolutePath(), file.getName())); if(!newDir.exists()){ newDir.mkdir(); for(File f : file.listFiles()){ copyDirectory(f, newDir); } }…
answer count: 1
tagged with: external
favorite count: 0
tagged with: updateprogress
has comment: http://stackoverflow.com/comment/31202729
has answer: http://stackoverflow.com/a/20810676
accepted answer: http://stackoverflow.com/a/20810676

http://stackoverflow.com/comment/31041309
type: Comment
type: QuestionComment
has text: Are you only allowed to use array or can you use any collection?
comment on: http://stackoverflow.com/q/20720766
score: 0

http://stackoverflow.com/q/20823409
tagged with: logging
type: AnsweredQuestion
tagged with: java
has title: Spring logging threshold not being set by logback
type: Question
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/20823447
tagged with: logback
has answer: http://stackoverflow.com/a/20823438
favorite count: 0
tagged with: slf4j
has answer: http://stackoverflow.com/a/20853156
answer count: 3
has body: I am working with Spring (Core/Security/ldap and more), and logback. But for some reason spring does not receive the loggin threshhold set in the logback XML I can see that as well when i debug springs source code and i see that the final boolean debug = logger.isDebugEnabled(); Is false As well i would like to mention (I don't know if it has any relevance) that the logger that spring uses is: org.apache.commons.logging.LogFactory org.apache.commons.logging.Log And not SLF4j like i use So how am i supposed to enable the debug level and bring the logs into my SLF4J configuration.. Thanks
possible better answer: http://stackoverflow.com/a/20853156
score: 4
accepted answer: http://stackoverflow.com/a/20823447
tagged with: spring

http://stackoverflow.com/a/20734660
upvote count: 74
has comment: http://stackoverflow.com/comment/31067058
downvote count: 0
has comment: http://stackoverflow.com/comment/94504048
has comment: http://stackoverflow.com/comment/31067030
type: Answer
has comment: http://stackoverflow.com/comment/36472942
answers question: http://stackoverflow.com/q/20734540
has body: Hibernate 4.3 is the first version to implement the JPA 2.1 spec (part of Java EE 7). And it's thus expecting the JPA 2.1 library in the classpath, not the JPA 2.0 library. That's why you get this exception: Table.indexes() is a new attribute of Table, introduced in JPA 2.1
has comment: http://stackoverflow.com/comment/37761844
has comment: http://stackoverflow.com/comment/31067012
has comment: http://stackoverflow.com/comment/31070515
score: 74
has comment: http://stackoverflow.com/comment/31067032

http://stackoverflow.com/q/20685306
has comment: http://stackoverflow.com/comment/30977268
type: UnansweredQuestion
tagged with: android
score: 6
has answer: http://stackoverflow.com/a/20687901
upvote count: 6
has comment: http://stackoverflow.com/comment/30979292
tagged with: java
type: Question
tagged with: libgdx
has title: Libgdx for android shows black before main screen
has body: I am making a game in LibGDX, and I have noticed that when my game is launched a black screen is shown for a few moments before the white screen of my game is drawn. I have set the background of my app's theme to be a different color with android:windowBackground in my app's style.xml, and the preview window shows that color. However, right before the main screen of my app loads, the screen goes black for a moment before displaying the main screen. I've tried setting Gdx.gl.glClearColor(1,1,1,1) in the main activity and Game class of my game, but the black screen still shows for a moment before drawing the main screen. The only way I've found to fix this is to set the android:windowDisablePreview to true, but that disables the preview window all together. Is there any way to fix this without disabling the preview?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31189529
comment on: http://stackoverflow.com/q/20803436
score: 0
has text: i encrypted image file using java class. also I wrote decrypt class to decrypt those image. then I load those image to label. @ElliottFrisch
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20817896
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20817873
answers question: http://stackoverflow.com/q/20817873
type: Answer
has comment: http://stackoverflow.com/comment/31216769
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31216312
has body: You cannot cast ArrayList to Set, they are at the same level in inheritance tree (like brothers), Not sure what are you trying to achieve by this If you want to create HashSet out of ArrayList use the constructor new HashSet&lt;SomeType&gt;(arrayListInstance); as @nacho mentioned, You will need to implement Set interface and name your implementation some meaning full name (for example ListBackedSet or ArraySet) If you want to create new implementation of Set backed by ArrayList, You need to preserve uniqueness property and for that you will have to customize add(), addAll() and constructors to avoid duplication

http://stackoverflow.com/comment/31095183
type: QuestionComment
has text: It's either a poor Photoshop joke, or you modified the code while debugging...
score: 6
comment on: http://stackoverflow.com/q/20745964
type: Comment

http://stackoverflow.com/comment/31114867
type: QuestionComment
has text: @TimB yes another thread change it
comment on: http://stackoverflow.com/q/20761486
score: 0
type: Comment

algorithm
tags question: http://stackoverflow.com/q/20783941
tags question: http://stackoverflow.com/q/20817665
tags question: http://stackoverflow.com/q/20830145
tags question: http://stackoverflow.com/q/20710970
tag name: algorithm
tags question: http://stackoverflow.com/q/20686896
tags question: http://stackoverflow.com/q/20830480
tags question: http://stackoverflow.com/q/20751176
tags question: http://stackoverflow.com/q/20814609
tags question: http://stackoverflow.com/q/20757100
tags question: http://stackoverflow.com/q/20808479
tags question: http://stackoverflow.com/q/20830918
tags question: http://stackoverflow.com/q/20686255
tags question: http://stackoverflow.com/q/20738079
tags question: http://stackoverflow.com/q/20807647
tags question: http://stackoverflow.com/q/20802509
tags question: http://stackoverflow.com/q/20714452
tags question: http://stackoverflow.com/q/20828886
tags question: http://stackoverflow.com/q/20702174
tags question: http://stackoverflow.com/q/20708659
tags question: http://stackoverflow.com/q/20833878
tags question: http://stackoverflow.com/q/20784777
tags question: http://stackoverflow.com/q/20781708
tags question: http://stackoverflow.com/q/20807093
tags question: http://stackoverflow.com/q/20686578
type: Tag
tags question: http://stackoverflow.com/q/20778139
tags question: http://stackoverflow.com/q/20840808
tags question: http://stackoverflow.com/q/20694571
tags question: http://stackoverflow.com/q/20680145
tags question: http://stackoverflow.com/q/20773741
tags question: http://stackoverflow.com/q/20737980
tags question: http://stackoverflow.com/q/20836092
tags question: http://stackoverflow.com/q/20723333
tags question: http://stackoverflow.com/q/20760072
tags question: http://stackoverflow.com/q/20731226
tags question: http://stackoverflow.com/q/20754771
tags question: http://stackoverflow.com/q/20827649
tags question: http://stackoverflow.com/q/20702782
tags question: http://stackoverflow.com/q/20790289
tags question: http://stackoverflow.com/q/20773855
tags question: http://stackoverflow.com/q/20820631

http://stackoverflow.com/q/20708389
tagged with: swing
type: AnsweredQuestion
has title: Transparent JTextField and JLabel to show background image
accepted answer: http://stackoverflow.com/a/20708485
tagged with: java
tagged with: jtextfield
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20708485
tagged with: jlabel
has body: I'm having difficulty with the JTextField and JLabel not appearing with an image in the background of my JFrame. I've set the opacities to false using .setOpaque(false); but it is not working. Thanks for the help in advance. package Game; import javax.swing.*; //window public class Frame { public void window(){//window method JPanel jp = new JPanel(); JLabel jl = new JLabel("Enter a Letter"); JTextField tf = new JTextField(10); jl.setOpaque(false); jl.setBorder(null); jp.add(jl); jp.add(tf); LoadImageApp i = new LoadImageApp(); i.setOpaque(false); JFrame gameFrame = new JFrame();//declaration gameFrame.getContentPane().add(jp); gameFrame.add(i);//adds image to window gameFrame.setTitle("Hangman");//title of frame window gameFrame.setSize(850, 600);//set size of frame gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//exit when 'x' button pressed gameFrame.setIconImage(new ImageIcon("Hangman-Game-grey.png").getImage());//set the frame icon to an image loaded from a file gameFrame.setLocationRelativeTo(null);//window centered over null(center) gameFrame.setResizable(false); //gameFrame.getContentPane().setBackground(Color.WHITE); gameFrame.setVisible(true);//display frame } } package Game; //import statements import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JPanel; public class LoadImageApp extends JPanel{ private static final long serialVersionUID = 1L; private ImageIcon image; public void paintComponent (Graphics g){ super.paintComponent(g); image = new ImageIcon("hangman.png"); image.paintIcon(this, g, 0, 9); } } package Game; //main class public class GameMain { public static void main (String []args){ Frame frame = new Frame();//declaration frame.window();//window call } }
tagged with: jframe

http://stackoverflow.com/comment/31225301
type: AnswerComment
has text: @IanLundberg: Maybe it was a tricky question, but well, does this answer clears your doubts or not?
comment on: http://stackoverflow.com/a/20822624
type: Comment
score: 0

http://stackoverflow.com/q/20844525
accepted answer: http://stackoverflow.com/a/20844633
tagged with: locale
possible better answer: http://stackoverflow.com/a/54245063
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/54245063
favorite count: 0
has answer: http://stackoverflow.com/a/20844594
has answer: http://stackoverflow.com/a/20844578
score: 9
type: Question
has body: What is the difference between a Locale country and language such as Locale.ITALY and Locale.ITALIAN? Where can I find all these differences for other locales? When should I use each one? And is it possible to develop our required locale? How?
has answer: http://stackoverflow.com/a/20844633
has title: What is the different from Locale.ITALY and Locale.ITALIAN
has comment: http://stackoverflow.com/comment/31265498
tagged with: java
upvote count: 10
downvote count: 1
answer count: 4

http://stackoverflow.com/comment/31185596
score: 0
type: Comment
has text: @sanket I am actually learning how to save users in a database safely so all suggestions are great.
comment on: http://stackoverflow.com/a/20801421
type: AnswerComment

http://stackoverflow.com/comment/31117042
type: Comment
has text: Directory structure of my Application is Correct but I still getting same error ..
comment on: http://stackoverflow.com/a/20762784
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31284153
has text: @Aniket when i use Serie for other operation it's work...
comment on: http://stackoverflow.com/q/20848291
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20704056
has answer: http://stackoverflow.com/a/20704740
tagged with: spring
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2699608
tagged with: autowired
type: Question
has answer: http://stackoverflow.com/a/20704101
has title: Spring & No unique bean of type
score: 0
accepted answer: http://stackoverflow.com/a/20704185
answer count: 3
has body: I have the following Beans for Spring based unit test: abstract class A { // some injections using @Value } class B extends A { // some injections using @Autowired, @Qualifier, @PersistenceUnit and @Value } class C extends A { // some injections using @Autowired, @Qualifier, @PersistenceUnit and @Value } class Foo{ @Autowired private A a; ... } class BarTest{ @Autowired private B b; @Autowired private C c; @Autowired // Expected: fooB.a = b private Foo fooB; @Autowired // Expected: fooC.a = c private Foo fooC; ... } In class BarTest: is it possible to control what gets injected into the 2 instances of Foo? Or do I have a design issue and I should setup things differently?
has comment: http://stackoverflow.com/comment/31011231
has answer: http://stackoverflow.com/a/20704185
has comment: http://stackoverflow.com/comment/31010321
possible better answer: http://stackoverflow.com/a/20704740

http://stackoverflow.com/a/20788487
has body: Actually, I realized there was a way to 'hack it' by drawing the graphic elements in a different order. This still draws the entire line, but then effectively 'erases the unwanted bits' by ..drawing over the top of them! import java.awt.*; import javax.swing.*; public class Panneau extends JPanel { public void paintComponent(Graphics g){ // declaration String text = "test"; int x = 250, y = 200; int height = 50, width = 50; g.setColor(Color.black); g.drawLine(x,y,x+100,y+50); g.setColor(Color.yellow); g.fillOval(x-height/2, y-width/2,width, height); g.fillOval((x-height/2)+100, (y-width/2)+50,width, height); FontMetrics fm = g.getFontMetrics(); double textWidth = fm.getStringBounds(text, g).getWidth(); g.setColor(Color.black); g.drawString(text, (int) (x - textWidth/2),(int) (y + fm.getMaxAscent() / 2)); g.drawString(text, (int) (x - textWidth/2)+100,(int) (y + fm.getMaxAscent() / 2)+50); } public Dimension getPreferredSize() { return new Dimension(400,280); } public static void main(String[] args) { Runnable r = new Runnable() { public void run() { Panneau p = new Panneau(); JOptionPane.showMessageDialog(null, p); } }; SwingUtilities.invokeLater(r); } }
accepted answer of: http://stackoverflow.com/q/20788311
answers question: http://stackoverflow.com/q/20788311
score: 5
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/31162850
type: Answer
has comment: http://stackoverflow.com/comment/31162779
downvote count: 0

http://stackoverflow.com/q/20749275
answer count: 1
accepted answer: http://stackoverflow.com/a/20765590
tagged with: redis
has body: Also, what are the best practices around managing the Resque built in "management structures" (like the ones in the title)? Should I ever be clearing them with jedis.del(String key) or something similar?
has title: What's the difference between resque:failed and resque:stat:failed keys?
type: AnsweredQuestion
tagged with: java
tagged with: resque
tagged with: jedis
type: Question
score: 0
has answer: http://stackoverflow.com/a/20765590

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/20720502
tags question: http://stackoverflow.com/q/20680430
tags question: http://stackoverflow.com/q/20739894
type: Tag

http://stackoverflow.com/a/22150193
has comment: http://stackoverflow.com/comment/43749376
type: Answer
answers question: http://stackoverflow.com/q/20829091
downvote count: 0
has comment: http://stackoverflow.com/comment/33626483
score: 1
upvote count: 1
has body: The C++ and python version of NetStream are not in sync with the implementation in gs-core version 1.2. We have to update the C++ and python implementations. In the mean time you can use an older version of gs-core. I suggest checking out revision a3f70d2 from the github repository.

http://stackoverflow.com/a/25119624
accepted answer of: http://stackoverflow.com/q/20782120
type: Answer
answers question: http://stackoverflow.com/q/20782120
score: 19
downvote count: 0
upvote count: 19
has body: I had the same problem when configuring Jaxb2Marshaller at runtime. The proposed solution to set the schema via Spring XML got me thinking: What's the difference between my code setting the property and Spring? The answer is simple: Jaxb2Marshaller implements org.springframework.beans.factory.InitializingBean which defines the lifecycle method afterPropertiesSet() and this method is called by Springs BeanFactory after the properties have been set. So the Solution is to call afterPropertiesSet() after setSchema() has been used to set the schema property. Because in that method the schema property (which is a org.springframework.core.io.Resource array) is actually used to set the internal schema field of type javax.xml.validation.Schema which is later used for schema validation. Example: Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); Resource schema = new ClassPathResource("fruit.xsd"); marshaller.setSchema(schema); marshaller.setContextPath("com.fruit.xml.jaxb"); // manually call Spring lifecycle method which actually loads the schema resource marshaller.afterPropertiesSet(); // use marshaller...
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/66037125

http://stackoverflow.com/a/20683684
type: Answer
has body: BigDecimal[] val = {new BigDecimal(0),new BigDecimal(0),new BigDecimal(0)}; BigDecimal is an object, not a primitive type, so you need to create new instances of the object in order to fill an array with them. It's no different from if you do: BigDecimal val = 0; // Fails BigDecimal val = new BigDecimal(0); // Succeeds
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/20683665
downvote count: 0

http://stackoverflow.com/comment/31034068
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20716764
has text: See here: http://stackoverflow.com/questions/19275447/oncreateoptionsmenu-causing-error-in-an-activity-with-no-actionbar

http://stackoverflow.com/q/20722550
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20722626
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/46898
has body: One can iterate through a SortedMap by using the iterator from myMap.entrySet().iterator(). But does this iterator preserve the ordering of the sorted map object ? The SortedMap interface does not have its own methods to iterate through the entries. What is the standard way to iterate ordered through the entries?
tagged with: java
has comment: http://stackoverflow.com/comment/31044563
has comment: http://stackoverflow.com/comment/31044543
has title: How many ways to iterate a map in java? why iterat a mai if we have already for loop?
type: Question
has answer: http://stackoverflow.com/a/20722635
has comment: http://stackoverflow.com/comment/31044597

http://stackoverflow.com/a/20807708
has body: You have to use Pattern#quote because \ is a special character in RegEx. message.replaceFirst(Pattern.quote(cmd), ""); You can encounter the same kind of problems in the replacement String as well, in this case use Matcher#quoteReplacement.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/20807667
score: 3
accepted answer of: http://stackoverflow.com/q/20807667
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31038459
type: Comment
score: 2
comment on: http://stackoverflow.com/q/20718566
has text: Never ever mix m2e and the maven-eclipse plugin, they have different strategies and are not compatible with each other. The maven-eclipse plugin will generate eclipse files based on the pom. Any modification in the `pom.xml` requires you to close eclipse, run `eclipse:eclipse` and restart eclipse. m2e is the preferred way: it will dynamically update the eclipse project if you make changes.
type: QuestionComment

listener
tags question: http://stackoverflow.com/q/20768138
tags question: http://stackoverflow.com/q/20789067
type: Tag
tag name: listener
tags question: http://stackoverflow.com/q/20791788
tags question: http://stackoverflow.com/q/20832462
tags question: http://stackoverflow.com/q/20820873
tags question: http://stackoverflow.com/q/20701612

http://stackoverflow.com/q/20832242
tagged with: java
accepted answer: http://stackoverflow.com/a/20832270
type: Question
has title: task restore InterruptionException but cannot catch in Thread
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20832270
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/31243485
tagged with: multithreading
upvote count: 1
type: AnsweredQuestion
has body: This is an example of the code I'm using: class PrimeGenerator implements Runnable{ public void run(){ try{ Thread.currentThread().sleep(1000);//a blocking method }catch(InterruptedException e){ System.out.println("interruptedException"); Thread.currentThread().interrupt();//Restore the interrupt } } } public class Scheduling{ private static final ScheduleExecutorService cancelExec = Executors.newScheduledThreadPool(1); public static void timeRun(final Runnable r, long timeout,TimeUnit unit) throws InterruptedException{ class RethrowableTask implements Runnable{ @Override public void run(){ try{ r.run(); }catch(Throwable t){ System.out.println("catch"+t); this.t = t; } } } }//end RethrowableTask RethrowableTask task = new RethrowableTask(); final Thread taskThread = new Thread(task); taskThread.start(); cancelExec.schedule(new Runnable(){ public void run(){ while(!taskThread.isInterrupted()){ taskThread.interrupt();//i want taskThread can catch interruptedException } } },1,TimeUnit.SECONDS); } //end timeRun method } public class TestPrimeGenerator{ try{ Scheduling.timeRun(new Primegenerator(),1,TimeUnit.SECONDS); }catch(Exception e){ e.printStackTrace(); } } When I run TestPrimeGenerator, the interruptedException is caught and and printed as interruptedException, but the "catch"+t is not printed. Why can't RethrowableTask catch the InterruptionException which PrimeGenerator restored? please give some help.and appreciate for your any suggestion.
score: 1

http://stackoverflow.com/comment/31159297
has text: Sadly this does not work. It seems as if the servlet cannot be accessed this way. Should it be? Am I missing something?
type: AnswerComment
comment on: http://stackoverflow.com/a/20786670
type: Comment
score: 0

http://stackoverflow.com/q/20746429
has answer: http://stackoverflow.com/a/52472225
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20765715
has answer: http://stackoverflow.com/a/55812232
linked to: http://stackoverflow.com/q/25569836
has comment: http://stackoverflow.com/comment/95978695
has comment: http://stackoverflow.com/comment/31109399
score: 220
linked to: http://stackoverflow.com/q/32495069
has answer: http://stackoverflow.com/a/32304962
has answer: http://stackoverflow.com/a/44570690
has answer: http://stackoverflow.com/a/31063252
has comment: http://stackoverflow.com/comment/66997105
has answer: http://stackoverflow.com/a/30600756
favorite count: 0
linked to: http://stackoverflow.com/q/19803058
answer count: 19
possible better answer: http://stackoverflow.com/a/20765715
has answer: http://stackoverflow.com/a/51423563
has answer: http://stackoverflow.com/a/32304570
accepted answer: http://stackoverflow.com/a/32304570
has answer: http://stackoverflow.com/a/40896610
has answer: http://stackoverflow.com/a/25668681
has comment: http://stackoverflow.com/comment/89708898
tagged with: java-8
upvote count: 220
has answer: http://stackoverflow.com/a/43779847
has title: Limit a stream by a predicate
has answer: http://stackoverflow.com/a/20772290
has answer: http://stackoverflow.com/a/46911329
has comment: http://stackoverflow.com/comment/63589329
has body: Is there a Java 8 stream operation that limits a (potentially infinite) Stream until the first element fails to match a predicate? In Java 9 we can use takeWhile as in the example below to print all the numbers less than 10. IntStream .iterate(1, n -&gt; n + 1) .takeWhile(n -&gt; n &lt; 10) .forEach(System.out::println); As there is no such operation in Java 8, what's the best way of implementing it in a general way?
has answer: http://stackoverflow.com/a/46446546
downvote count: 0
tagged with: java-stream
tagged with: java
has answer: http://stackoverflow.com/a/24531394
has answer: http://stackoverflow.com/a/26919665
has answer: http://stackoverflow.com/a/42706892
has answer: http://stackoverflow.com/a/26255154

performance
tags question: http://stackoverflow.com/q/20807388
tags question: http://stackoverflow.com/q/20758543
tags question: http://stackoverflow.com/q/20846340
tags question: http://stackoverflow.com/q/20811061
tags question: http://stackoverflow.com/q/20808100
tags question: http://stackoverflow.com/q/20774321
tags question: http://stackoverflow.com/q/20757684
tags question: http://stackoverflow.com/q/20696441
tags question: http://stackoverflow.com/q/20694581
tags question: http://stackoverflow.com/q/20729597
tags question: http://stackoverflow.com/q/20762283
tags question: http://stackoverflow.com/q/20696213
tags question: http://stackoverflow.com/q/20827354
tags question: http://stackoverflow.com/q/20729220
tags question: http://stackoverflow.com/q/20811169
tags question: http://stackoverflow.com/q/20820266
tags question: http://stackoverflow.com/q/20772961
tags question: http://stackoverflow.com/q/20693481
tags question: http://stackoverflow.com/q/20767397
tag name: performance
tags question: http://stackoverflow.com/q/20708169
tags question: http://stackoverflow.com/q/20750020
tags question: http://stackoverflow.com/q/20699035
type: Tag
tags question: http://stackoverflow.com/q/20841300
tags question: http://stackoverflow.com/q/20806590
tags question: http://stackoverflow.com/q/20796925
tags question: http://stackoverflow.com/q/20702071

java-8
tags question: http://stackoverflow.com/q/20746429
tags question: http://stackoverflow.com/q/20774670
tags question: http://stackoverflow.com/q/20843263
tags question: http://stackoverflow.com/q/20827047
tags question: http://stackoverflow.com/q/20771449
tags question: http://stackoverflow.com/q/20828254
tags question: http://stackoverflow.com/q/20840800
tag name: java-8
type: Tag

http://stackoverflow.com/comment/30997015
has text: See also ["Concurrency in Swing"](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/).
comment on: http://stackoverflow.com/a/20696096
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/20757153
accepted answer of: http://stackoverflow.com/q/20743916
type: AcceptedAnswer
downvote count: 0
has body: I found the solution, just put this in your context.xml file in your_tomcat_home_directory/Config: &lt;Context antiJARLocking="true" antiResourceLocking="true"&gt; Everything works fine.
type: Answer
has comment: http://stackoverflow.com/comment/138917257
has comment: http://stackoverflow.com/comment/43670905
score: 15
answers question: http://stackoverflow.com/q/20743916
has comment: http://stackoverflow.com/comment/138918096
upvote count: 15

http://stackoverflow.com/comment/31331615
has text: james have you send response in multiple server at the same time right?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20810928

http://stackoverflow.com/comment/31214608
has text: Really helpful, Thanks! So all others are just introspection(examination of structure)?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20817092
type: Comment

http://stackoverflow.com/comment/31238221
type: AnswerComment
score: 0
type: Comment
has text: by the way , I'm not at school ! but I'm trying to understand how array list works thats all ! just trying to learn how to make array of objects !
comment on: http://stackoverflow.com/a/20829088

http://stackoverflow.com/comment/31089051
type: AnswerComment
comment on: http://stackoverflow.com/a/20747032
score: 0
type: Comment
has text: won't compile : `Math` methods won't work with `Number`, why not just using `float` ?

http://stackoverflow.com/comment/31129283
score: 1
has text: Yes, reduce bitmap size by reducing image dimensions i.e. resolution.
type: AnswerComment
comment on: http://stackoverflow.com/a/20680508
type: Comment

http://stackoverflow.com/q/20707203
tagged with: java
has answer: http://stackoverflow.com/a/21183375
has comment: http://stackoverflow.com/comment/31035091
answer count: 2
has comment: http://stackoverflow.com/comment/31507044
has comment: http://stackoverflow.com/comment/31072311
downvote count: 0
favorite count: 0
has body: am currently using spring-boot to create a web app using Spring MVC and JPA data however am getting an issue with property spring.jpa.hibernate.ddl-auto: create as it appears that on the first run my tables A , B , C are created correctly. Then i populate all the 3 tables and when I close the application and re-run it only Table A still contains the populated data. The tables B and C are wiped out completely which is a bit strange . Any one know why this is the case? I have the following within my pom.xml as dependencies org.springframework.boot spring-boot-starter-parent 0.5.0.M6 mysql mysql-connector-java 5.1.26 org.springframework.boot spring-boot-starter-web com.fasterxml.jackson.core jackson-databind org.thymeleaf thymeleaf-spring3 nz.net.ultraq.thymeleaf thymeleaf-layout-dialect org.springframework.boot spring-boot-starter-data-jpa org.springframework spring-test mysql mysql-connector-java 5.1.26 org.hibernate hibernate-validator spring.jpa.hibernate.ddl-auto
has title: Spring boot and issue with ddl-auto
tagged with: spring
tagged with: properties
score: 2
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/20740324

http://stackoverflow.com/q/20802808
tagged with: while-loop
has comment: http://stackoverflow.com/comment/31188090
tagged with: string
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31188657
has comment: http://stackoverflow.com/comment/31188075
has comment: http://stackoverflow.com/comment/31188636
tagged with: java
has answer: http://stackoverflow.com/a/20803524
has comment: http://stackoverflow.com/comment/31188126
has title: Java String New Line Loop
type: Question
answer count: 2
has body: I wrote a method that loops through a string and adds '/n' to create a line length that was given in the parameters. That description is not the best but it's hard to describe so look at the code below. Thanks in advance! My Code: public static String lineLength(String str, int length){ int totalLength = 0; //total length of the document int lengthConst = 0; //constant value of the length for the loop int nLength = 0; // length of \n = 2 characters String work1, work2; //Strings to work with in the loop. Used as string buffers in substrings if(str != null){ totalLength = str.length(); lengthConst = length; } if(length &lt; 1){ throw new NullPointerException("Length must be &gt;= 1"); } /* Main Loop: check again if length is not zero, check if totalLength is not zero, check if pseudoCursor is not zero, check if length is less than or equal to totalLength */ while((length != 0) &amp;&amp; (totalLength != 0) &amp;&amp; (lengthConst != 0) &amp;&amp; (length &lt;= totalLength)){ work1 = str.substring(0, length); //store string of beginning to line length work2 = str.substring(length + nLength, str.length()); //store string from length to end work1 = work1.concat("\n"); //add new line str = work1.concat(work2); //add work1 and work2 and store in str nLength += 1; //nLength increases by 2 because we are going to add another \n length += length; } return str; } When provided with the string "Daniel" and the new line length of 2 this is the run when printed to the console: run: Da n el BUILD SUCCESSFUL (total time: 4 seconds)
tagged with: newline
has comment: http://stackoverflow.com/comment/31188142
has answer: http://stackoverflow.com/a/20804014
score: 0

http://stackoverflow.com/q/20831681
tagged with: java
tagged with: sorting
has comment: http://stackoverflow.com/comment/31243121
has comment: http://stackoverflow.com/comment/31243960
has comment: http://stackoverflow.com/comment/31243101
has body: I have a gui class in which there are four buttons when a button is clicked the program should run an animation of a sorting algorithm. The problem is when i click a button it pops up a Jframe but nothing shows up on the jframe it appears black. Most probably because of the delay that i am using in Bubble Sort animation class. The screen goes black of the Jframe and when animation gets completed it shows the final result in the end. So does any one knows how to fix the problem? //This is the main GUI class import java.awt.*; import java.awt.event.*; import javax.swing.*; public class GUIMain { Bubble gui=new Bubble(); Selection gui2=new Selection(); private JFrame mainFrame; private JLabel headerLabel; private JLabel statusLabel; private JPanel controlPanel; public GUIMain(){ prepareGUI(); } public static void main(String[] args){ GUIMain swingControlDemo = new GUIMain(); swingControlDemo.showEventDemo(); } private void prepareGUI(){ mainFrame = new JFrame("Sorting Animations"); mainFrame.setSize(400,400); mainFrame.setLayout(new GridLayout(3, 1)); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //labels are for texts headerLabel = new JLabel("",JLabel.CENTER ); statusLabel = new JLabel("",JLabel.CENTER); statusLabel.setSize(350,100); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent){ System.exit(0); } }); //panel contains both the buttons and the text controlPanel = new JPanel(); controlPanel.setLayout(new FlowLayout()); mainFrame.add(headerLabel); mainFrame.add(controlPanel); mainFrame.add(statusLabel); mainFrame.setVisible(true); } private void showEventDemo(){ headerLabel.setText("Select any of the sorting algorithm!"); JButton Insertion = new JButton("Insertion"); JButton Selection = new JButton("Selection"); JButton Bubble = new JButton("Bubble"); JButton Shell = new JButton("Shell"); // JButton Quick= new JButton ("Quick"); Insertion.setActionCommand("Insertion"); Selection.setActionCommand("Selecti…
has title: Button clicks and delay issues
answer count: 0
score: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11366330
tagged with: animation
tagged with: swing
has comment: http://stackoverflow.com/comment/31242277
type: Question
has comment: http://stackoverflow.com/comment/31242268

http://stackoverflow.com/q/20737457
tagged with: layout
has comment: http://stackoverflow.com/comment/31077973
has body: I am facing the different issue, whenever i am trying to resize the contents of my window it is not getting resized. I also tried the Resize Handler way. As we can see there is two components SnapshotChooserView and RunLogGrid and i have made it collapsible. So, that when i make the SnapshotChooserView collapsed, then all the space should be occupied by the RunLogGrid and when i collape the RunLogGrid all the other space should be occupied by the SnapshotChooserView. Can anyone help to figure this out. public class RunView implements IsWidget { // Client factory private ClientFactory iClientFactory; // Main Container private BorderLayoutContainer borderLayoutContainer; // Components private SnapshotChooserView snapshotChooserView; // Components private RunLogGrid runLogGrid; ContentPanel north; ContentPanel south; ResizeHandler handler1; ResizeHandler handler2; // ---- CONSTRUCTORS ---- public RunView() { } public RunView(ClientFactory aClientFactory) { iClientFactory = aClientFactory; borderLayoutContainer = new BorderLayoutContainer(); borderLayoutContainer.setBorders(true); snapshotChooserView = iClientFactory.getSnapshotChooserView(); runLogGrid = new RunLogGrid(iClientFactory); final double SnapshotChooserHeight = 500; final int RunLogGridHeight = 350; handler1 = new ResizeHandler(){ @Override public void onResize(ResizeEvent event) { north.setWidth(event.getWidth()); north.setHeight(event.getHeight()); } }; handler2 = new ResizeHandler(){ @Override public void onResize(ResizeEvent event) { south.setWidth(event.getWidth()); south.setHeight(event.getHeight()); } }; north = new ContentPanel(); north.setHeadingText("Run Details"); north.add(snapshotChooserView.asWidget()); north.setCollapsible(true); north.setResize(true); north.addResizeHandler(handler1); // north.forceLayout(); south = new ContentPanel(); south.setHeadingText("Run Log Info"); south.add(runLogGrid.asWidget()); south.setCollapsible(true); south.setResize(true); south.addResizeHandler(handler2); //…
score: 0
has comment: http://stackoverflow.com/comment/31088229
answer count: 0
type: UnansweredQuestion
tagged with: gwt
tagged with: java
tagged with: gxt
type: Question
has title: Arranging layouts is not proper when using BorderLayoutContainer of gxt3

http://stackoverflow.com/a/20814576
has body: Look at methods onDragEnter and onDragExit in ImageCell. Those two methods are the ones called as your finger passes over a cell on the grid. They set the background of the image view. onDragEnter: int bg = mEmpty ? R.color.cell_empty_hover : R.color.cell_filled_hover; setBackgroundResource (bg); onDragExit: int bg = mEmpty ? R.color.cell_empty : R.color.cell_filled; setBackgroundResource (bg); The color definitions are in mycolor.xml. Reference: http://blahti.wordpress.com/2012/03/03/improved-drag-drop-for-gridview/
accepted answer of: http://stackoverflow.com/q/20803817
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41333995
answers question: http://stackoverflow.com/q/20803817
type: Answer
has comment: http://stackoverflow.com/comment/31393029

http://stackoverflow.com/q/20841581
downvote count: 0
linked to: http://stackoverflow.com/q/9203685
tagged with: android
has comment: http://stackoverflow.com/comment/31260251
has answer: http://stackoverflow.com/a/20841997
accepted answer: http://stackoverflow.com/a/20841997
has body: I'm trying to upload a name and a score to with a HTTP post request on a button click, but I get a weird error. Here is my code. public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.bMenu: Intent i = new Intent(ShowScore.this, Menu.class); startActivity(i); break; case R.id.bUpload: postData(); break; } } private void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.ratemyplays.com/form.php"); try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("name", "Steve")); nameValuePairs.add(new BasicNameValuePair("score", "24")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request // HttpResponse response = httpclient.execute(httppost); // Execute HTTP Post Request ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); String responseBody = httpclient.execute(httppost, responseHandler); // Just display the response back displayToastMessage(responseBody); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } } private void displayToastMessage(String responseBody) { // TODO Auto-generated method stub } Here is my error Invalid layout of java.lang.String at value A fatal error has been detected by the Java Runtime Environment: Internal Error (javaClasses.cpp:136), pid=9736, tid=10668 fatal error: Invalid layout of preloaded class JRE version: (7.0_40-b43) (build ) Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode windows-amd64 compressed oops) Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
type: AnsweredQuestion
score: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/20842370
tagged with: error-handling
has comment: http://stackoverflow.com/comment/31261232
type: Question
upvote count: 2
answer count: 2
has title: Error at Java HTTP request
has comment: http://stackoverflow.com/comment/31260488
has comment: http://stackoverflow.com/comment/31260463
has comment: http://stackoverflow.com/comment/31261845
has answer: http://stackoverflow.com/a/20842370
has comment: http://stackoverflow.com/comment/31260687
favorite count: 0

http://stackoverflow.com/q/20720098
has answer: http://stackoverflow.com/a/20720158
has body: I discovered this oddity: for (long l = 4946144450195624l; l &gt; 0; l &gt;&gt;= 5) System.out.print((char) (((l &amp; 31 | 64) % 95) + 32)); Output: hello world How does this work?
has answer: http://stackoverflow.com/a/20720185
accepted answer: http://stackoverflow.com/a/20756843
upvote count: 198
tagged with: string
has answer: http://stackoverflow.com/a/20769218
has comment: http://stackoverflow.com/comment/31345106
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/27322692
has answer: http://stackoverflow.com/a/27705533
has answer: http://stackoverflow.com/a/20756843
score: 171
has answer: http://stackoverflow.com/a/20752933
downvote count: 27
type: AnsweredQuestion
tagged with: bit-shift
tagged with: java
has comment: http://stackoverflow.com/comment/31141303
possible better answer: http://stackoverflow.com/a/20721366
has answer: http://stackoverflow.com/a/20721366
type: Question
has answer: http://stackoverflow.com/a/27726471
has title: How does this print "hello world"?

http://stackoverflow.com/q/20815643
type: Question
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/20825707
score: 0
has title: Exception querying inherited entities
tagged with: jpa
answer count: 1
tagged with: persistence
linked to: http://stackoverflow.com/q/1373294
has body: In my db I have something similar: +---------+ | answer | +---------+ -----------------------&gt;--+--------------+ | id +------) | answer_type_b| ----&gt;-+--------------+ +--------------+ ... | answer_type_a| | id | +--------------+ | field_b | | id | | ... | | field_a | | ... | In my answer table I have common information, then I have two inheriting tables related to the parent table and having different specific fields. I created model in my application using JPA 2 + Hibernate 4.2.6: @Entity public abstract class Answer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; // ... } @Entity public class AnswerA extends Answer{ @Column(name = "field_a") private String fieldA; // ... } @Entity public class AnswerB extends Answer{ @Column(name = "field_b") private String fieldB; // ... } Now when I try to query all Answer entities I expect to get a collection with ALL the answers both Type A and Type B, instead I get an exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'answer0_.field_a' in 'field list' I suppose this appens because there is no field_a field in parent table, so how can I solve this? Is there a way to query all the inheriting tables?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31230628
has comment: http://stackoverflow.com/comment/31211880
has comment: http://stackoverflow.com/comment/31212118
has answer: http://stackoverflow.com/a/20825707
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/20793464
answers question: http://stackoverflow.com/q/20793452
has comment: http://stackoverflow.com/comment/31177946
has comment: http://stackoverflow.com/comment/31172747
upvote count: 1
downvote count: 1
has body: In jQuery it means "starting with this" For example id^='my_' means "id starts with 'my_'"
has comment: http://stackoverflow.com/comment/31171940
score: 0
type: Answer

http://stackoverflow.com/comment/31144417
score: 0
comment on: http://stackoverflow.com/q/20771106
type: Comment
type: QuestionComment
has text: @Thomas yeah, i did figure that out just after posting this revision. Thanks anyways. Have a look at the link I posted.

http://stackoverflow.com/q/20751374
tagged with: applet
has answer: http://stackoverflow.com/a/20751628
accepted answer: http://stackoverflow.com/a/20751628
type: AnsweredQuestion
tagged with: jsf
has title: What's the best option for a virtual keyboard component in a Java web application?
tagged with: java
type: Question
tagged with: servlets
tagged with: security
score: 0
has body: I would like to know what kind of technology would be better to create a virtual keyboard component, that needs to be installed in different web applications. All these application are Java, but some use Struts, other uses JSF. A Java applet + servlet would be the best choice concerning security? My idea is to write an applet + servlet. All applications would need to add the servlet/mapping in their "web.xml" file. The applet would communicate with the servlet passing information. The fact of signing an applet with a certificate make it secure?
answer count: 1

http://stackoverflow.com/a/20697192
downvote count: 1
type: Answer
upvote count: 4
score: 3
has body: Code: stack=2, locals=2, args_size=1 Stack Refers , how deep a stack is required for execution of the method, arg_size Refers , how many parameters it takes in, locals Refers , how many local variable slots need to be reserved in the local variables table. And LineNumberTable: section The LineNumberTable is one of the optional attributes that holds metadata for debugging purposes. It specifies which offsets in the bytecode correspond to each line in the original source code. This is useful for printing more informative stack traces and for providing features like single step in the debugger. For more details about these two , Refer this. You can refer Wikipedia for instruction set listing. And refer this for more details.
answers question: http://stackoverflow.com/q/20697091

http://stackoverflow.com/comment/31023942
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20711072
has text: The statements 1: "relative location of workspace and local repos shouldn't matter" and 2: "repos shouldn't be under workspace" are both true and completely independent from each other. So I don't understand what you disagree with.

http://stackoverflow.com/q/20737099
has answer: http://stackoverflow.com/a/20737225
tagged with: user-interface
downvote count: 0
has body: So basically I am learning some basic java and I am currently writing a little "game" that tells you which button to click and if you click the correct one you receive a point. The buttons are defined as b1, b2, b3, and b4. The text on them says "Button 1", "Button 2", "Button 3", and "Button 4". What I wish to accomplish is each time I click a button, the values are reassigned randomly so that the b1 text for example might say "Button 3". But it would be random. I used Java random to get it to work how I want but now I need to solve the problem of having the buttons being assigned the same values. For example, b1 and b3 might both be named "Button 2". I'm not sure how to go about solving this problem, any help would be greatly appreciated. It is kind of frustrating me. Ok so here is my code.... finally. Have a terrible internet connection atm. I put comments where I need the help import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Gui extends JFrame implements ActionListener { private JButton b1 = new JButton("Button 1"); private JButton b2 = new JButton("Button 2"); private JButton b3 = new JButton("Button 3"); private JButton b4 = new JButton("Button 4"); private static JLabel label = new JLabel(); private static JLabel label2 = new JLabel("You currently have 0 points."); private JPanel p = new JPanel(new GridBagLayout()); private int points = 0; private int randomButton; public Gui() { super("Button Game"); newLabel(); setSize(400, 400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(10,10,10,10); c.gridx = 2; c.gridy = 1; p.add(b1,c); c.gridx = 1; c.gridy = 2; p.add(b2, c); c.gridx = 3; c.gridy = 2; p.add(b3, c); c.gridx = 2; c.gridy = 3; p.add(b4, c); c.gridx = 2; c.gridy = 2; p.add(la…
has comment: http://stackoverflow.com/comment/31071626
favorite count: 0
accepted answer: http://stackoverflow.com/a/20737225
has comment: http://stackoverflow.com/comment/31071627
upvote count: 1
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
has title: Switching values in java
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20737160
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20737160

http://stackoverflow.com/comment/31241351
comment on: http://stackoverflow.com/a/20823085
type: AnswerComment
score: 0
type: Comment
has text: when double click you want to open a new window with fields to modify selected data ?

http://stackoverflow.com/a/20810761
has comment: http://stackoverflow.com/comment/31202946
downvote count: 0
score: 1
upvote count: 1
has body: Do i need to include try - catch - finally in getData2? The answer depends on other places from which you call getData2: If getData is the only place, then the answer is "no", a try/finally would be sufficient. If there are other places all of which expect a SQLException and process it in the same way, the answer is also "no", for the same reason (no catch is required). If there are other places, some of which do not expect SQLException, then you need to keep the try - catch - finally However, there is a problem with the way that you coded your call of getData2: since getData2 has a finally that releases the connection, your getData releases the connection twice. You need to either add a useExistingConnection(conn) and modify your releaseConnection in a way to count references to the same connection, or pass a flag that indicates whether or not the connection should be closed. Generally, I would prefer to structure the code to open and close the connection in the same method, pass the connection around to other methods, and use try/finally only to close the PreparedStatements opened inside subordinate methods, such as getData2.
answers question: http://stackoverflow.com/q/20810703
has comment: http://stackoverflow.com/comment/31202978
type: Answer

http://stackoverflow.com/comment/31239185
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20818459
type: QuestionComment
has text: I may not understand your problem correctly. If you just want to localize your Spring MVC application, including the validation messages, you could follow a tutorial like [this one](http://viralpatel.net/blogs/spring-3-mvc-internationalization-i18n-localization-tutorial-example/). Validation messages can be localized as any other string. They have predefined codes like `validation.constraints.NotNull.message`. If you want to do something more tricky, let's wait for other answers :)

http://stackoverflow.com/q/20825855
has answer: http://stackoverflow.com/a/20825892
accepted answer: http://stackoverflow.com/a/20825942
tagged with: android
has title: Android Dev - Android:versioncode won't update
has body: Receiving the following message when uploading my latest APK: You need to use a different version code for your APK because you already have one with version code 1. I am setting the android:versionCode and android:versionName correctly (in /app/src/main/AndroidManifest.xml): android:versionCode="2" android:versionName="1.1" Also, I am using the same keystore that the project was initialized / originally built with This is my 5th app and I've never encountered this issue before. Is there some other place within a typical Android app project that could override the versionCode found in the AndroidManifest.xml file? Or maybe some kind of "de-linter" tool that'll help?
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20825942
possible better answer: http://stackoverflow.com/a/20825892
score: 0
answer count: 2

http://stackoverflow.com/a/57526278
type: Answer
score: 1
upvote count: 1
has body: Adding below to pom.xml solved my problem &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
downvote count: 0
answers question: http://stackoverflow.com/q/20740703

http://stackoverflow.com/comment/31256143
comment on: http://stackoverflow.com/q/20839046
type: QuestionComment
has text: I didn't find better names for this than "Frameworks like Spring or Seam". ... hm. perhaps "whole stack frameworks"? In difference I would rather call Jackson a "library". Or a "component". Wording is a little bit difficult here.
type: Comment
score: 0

configuration
tags question: http://stackoverflow.com/q/20838271
tags question: http://stackoverflow.com/q/20788396
tags question: http://stackoverflow.com/q/20811494
tags question: http://stackoverflow.com/q/20819155
type: Tag
tags question: http://stackoverflow.com/q/20731298
tags question: http://stackoverflow.com/q/20780945
tags question: http://stackoverflow.com/q/20730967
tags question: http://stackoverflow.com/q/20767649
tags question: http://stackoverflow.com/q/20798570
tags question: http://stackoverflow.com/q/20737623
tag name: configuration
tags question: http://stackoverflow.com/q/20726425

http://stackoverflow.com/comment/31163353
comment on: http://stackoverflow.com/a/20788915
score: 0
type: AnswerComment
type: Comment
has text: I tried to take random integer in range 4-8 (int nu=ra.nextInt(5)+4;) for enough number of results.

http://stackoverflow.com/a/24775281
answers question: http://stackoverflow.com/q/20817417
score: 1
upvote count: 1
has body: I also get like your ploblem. I fixed it with my own solution but I am not sure it is good solution. The solution is using the class-path. Web application directory struture - app-root - WEB-INF - classes - mydb.db program protected Connection getConnection() { Connection con = null; try { Class.forName("org.sqlite.JDBC"); con = DriverManager.getConnection("jdbc:sqlite:" + this.getClass().getResource("/").getPath() + "/mydb.db"); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } return con; } Now, I don't need to worrry missing db file. It is sure at my class path directory.
downvote count: 0
type: Answer

http://stackoverflow.com/q/20845223
has comment: http://stackoverflow.com/comment/31269150
has comment: http://stackoverflow.com/comment/31267104
has comment: http://stackoverflow.com/comment/31267406
has comment: http://stackoverflow.com/comment/31267240
has body: I came across a very strange problem in my program I wrote to copy Pictures, Documents, Videos, and Music (from the Windows file system) to a backup drive. I set a string array directories[] equal to {picturesDirectory, documentsDirectory, videosDirectory, musicDirectory} and use a for loop to loop through each one to copy the files. I use a GUI so I have a SwingWorker that runs the actual copy methods. However, when I run the program, it only loops through the "for" loop twice, only copying pictures and documents. I don't think I can really post a SSCCE that will help, so I'm just posting my entire class. inDrive is the main Windows drive ("C" by default), outDrive is the backup drive letter, username is the windows username, and space is the total disk space that the files/directories will take up. package diana; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.text.DefaultCaret; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JButton; import javax.swing.JProgressBar; import javax.swing.JLabel; import javax.swing.SwingWorker; import org.apache.commons.io.FileUtils; @SuppressWarnings("serial") public class BasicCopy extends JFrame { private JPanel contentPane; private JPanel bottomPane; private JTextArea txtCopiedDirs; private JScrollPane scrollPane; private JButton btnCancel; private JProgressBar progressBar; private JLabel lblCopying; private JLabel lblPr…
has comment: http://stackoverflow.com/comment/31266905
has comment: http://stackoverflow.com/comment/31268932
has comment: http://stackoverflow.com/comment/31267547
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31268816
tagged with: java
has answer: http://stackoverflow.com/a/20846115
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/31267145
has comment: http://stackoverflow.com/comment/31267040
type: Question
tagged with: swingworker
has comment: http://stackoverflow.com/comment/31268705
has comment: http://stackoverflow.com/comment/31267291
has comment: http://stackoverflow.com/comment/31268268
score: -1
possible better answer: http://stackoverflow.com/a/20846489
answer count: 2
tagged with: for-loop
has title: For loop only executes twice when copying files
accepted answer: http://stackoverflow.com/a/20846115
has answer: http://stackoverflow.com/a/20846489
upvote count: 0
has comment: http://stackoverflow.com/comment/31268431
has comment: http://stackoverflow.com/comment/31267252
has comment: http://stackoverflow.com/comment/31267318
linked to: http://stackoverflow.com/q/19968131
favorite count: 0

http://stackoverflow.com/comment/31191132
score: 0
comment on: http://stackoverflow.com/q/20804043
type: Comment
has text: @dcsohl I do not want to have to open a connection for my application to run
type: QuestionComment

http://stackoverflow.com/q/20801008
tagged with: java
tagged with: mysql
tagged with: prepared-statement
type: Question
linked to: http://stackoverflow.com/q/3160756
has answer: http://stackoverflow.com/a/20801122
has title: What kind of lock on MySQL is set when I use connection.setAutoCommit(false) in java?
upvote count: 1
answer count: 1
has body: Suppose I have the following piece of code . try { connection.setAutoCommit(false) ; .... .... connection.commit(); } catch (Exception e) { } Does the above transaction acquires locks on the MySQL tables which are referenced in the code in the try statement ? If it does, what kind of locks are these ? Are these read locks or write locks ? Also, does it make a row level lock or a complete lock on the table ?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31184849
tagged with: jdbc
downvote count: 0
score: 1

http://stackoverflow.com/q/20696237
downvote count: 0
has answer: http://stackoverflow.com/a/20696566
upvote count: 1
tagged with: version
answer count: 1
has body: I have some code importing sun.plugin.javascript.JSContext. What has happened to the package in JDK7?
favorite count: 0
tagged with: sun
type: UnansweredQuestion
has title: What has sun.plugin.javascript become in JDK 7?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/30997369

http://stackoverflow.com/q/20746172
tagged with: java
has answer: http://stackoverflow.com/a/37095649
tagged with: processing
upvote count: 5
tagged with: gaussian
type: UnansweredQuestion
has title: Blur an image using 3x3 Gaussian kernel?
tagged with: image
has comment: http://stackoverflow.com/comment/31087120
has answer: http://stackoverflow.com/a/20746268
downvote count: 0
favorite count: 0
type: Question
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/31087155
has body: I want to create a method to blur a 24 bit image using 3x3 Gaussian kernel. I was given the following things. The 3x3 Gaussian kernel: A is the original image and B is the resulting image. B(i,j) = 1/16 * A(i-1,j-1) +1/8 * A(i,j-1) +1/16 * A(i+1,j-1) +1/8 * A(i-1,j) +1/4 * A(i,j) +1/8 *A(i+1,j) +1/16 * A(i-1,j+1) +1/8 * A(i,j+1) +1/16 * A(i+1,j+1) The method: public static BufferedImage gaussianBlur(Image img) where img is a reference variable of an input image. The returned value is an address of an object of the resulting image. Should I divided the image into 9 parts to implement this method?

http://stackoverflow.com/comment/31223599
score: 0
has text: added the full stack trace. I do not have hibernate.cfg.cml or hibernate.properties in the classpath.
comment on: http://stackoverflow.com/q/20813012
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20829030
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20816451
answers question: http://stackoverflow.com/q/20816451
has body: If I were you, I will not return a 400 bad request. Rather, I will just ignore that extra field that comes in as a part of the json. I find it a lot more graceful of a way to not return an error just because some extra field(s) are sent as a part of the request (although, that is dependent on who implements it). Now coming back to you real question, the problem is HOW the conversion happens from JSON to your UserCreateRequest. It seems like you are using the built-in deserializer of JAX-RS (or some other built-in deserializer) which does not understand what to do when having extra fields in the json object. The way I normally handle this is using GSON library (gson) and convert the json string that comes in, manually. GSON library is by default capable of handling/ignoring extra fields that come in as a part of JSON String. In terms of code, here's how I would handle it: @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createUser(String request) { Gson gson = new Gson(); UserCreateRequest user = gson.fromJson(request, UserCreateRequest.class); return user.getHandler().handle(); } The above code will let gson handle the conversion of JSON string to UserCreateRequest object, ignoring the extra fields. That being said, GSON library is highly customizable in terms of how you want to handle serialization/deserialization of JSON strings (look at GSON's exclusion and inclusion strategies). I have found this to be the easiest way of handling serialization/deserialization of JSON strings after playing around with couple of other (such as Jackson) libraries. I hope you do too!
has comment: http://stackoverflow.com/comment/31311341
type: AcceptedAnswer

http://stackoverflow.com/q/20829305
answer count: 2
has comment: http://stackoverflow.com/comment/31401898
favorite count: 0
upvote count: 3
downvote count: 2
accepted answer: http://stackoverflow.com/a/20829373
has body: I have a problem with caesar cipher in Java with ACM. Here's my code: import acm.program.*; public class Ceasar extends ConsoleProgram{ public void run() { println("This program encodes a message using a Caesar cipher."); int shifter=readInt("Enter the number of character positions to shift: "); String msg=readLine("Enter a message :"); String Solution=encodeCaesarCipher(msg,shifter); println("Encoded message: "+Solution); } private String encodeCaesarCipher(String str,int shift){ String result=""; for (int i=0;i&lt;str.length();i++){ char helper=str.charAt(i); helper=(helper+shift); if (helper&gt;'Z'||helper&gt;'z') helper =(helper-26); if (helper&lt;'A'||helper&lt;'a') helper=(helper+26); result= result+helper; } return result; } } When I compile I have these errors: Ceasar.java:21: error: possible loss of precision helper=helper+shift; ^ required: char found: int Ceasar.java:22: error: possible loss of precision if (helper&gt;'Z'||helper&gt;'z') helper =helper-26; ^ required: char found: int Ceasar.java:23: error: possible loss of precision if (helper&lt;'A'||helper&lt;'a') helper=helper+26; ^ required: char found: int 3 errors
has answer: http://stackoverflow.com/a/20829373
type: AnsweredQuestion
tagged with: acm-java-libraries
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20829386
has answer: http://stackoverflow.com/a/20829386
type: Question
has title: Caesar cipher in Java ACM

http://stackoverflow.com/q/20747655
has body: When my Android app reaches a specific time (say, 1400 hours) the app should do a specific thing, such as enter a Night Mode. At no other time would the app want to do this, and it seems like a waste to poll for this time. Is there a way to have Android notify my app when this time is reached?
has answer: http://stackoverflow.com/a/20747674
possible better answer: http://stackoverflow.com/a/20747860
tagged with: android
has answer: http://stackoverflow.com/a/20747860
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20747674
tagged with: java
has title: Android How to be Notified at a Specific Time
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/31294902
comment on: http://stackoverflow.com/q/20843273
has text: yeah somewhat. The logs reveal that the functions iterate over a range of data - so either the data is summing up in your android app, or in your java class. Dump the data in console at both ends and see if there is something different from what you expect.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/20759227
has answer: http://stackoverflow.com/a/20824065
type: AnsweredQuestion
has body: I have a simple image in my Slick2d based Java game and I am trying to rotate it 90 degrees. However, when using the "Image.rotate(angle)" method the image ends up moving as well as rotating. I have tried forcefully setting the centre of rotation to be the exact centre of the image but the results are the same. Here are the before and after shots. The idea is that the tank will rotate 90 degrees and remain in the same square. The centre of rotation that was forcefully set is shown by the dot after the rotation: Before: After: The code: public void turn(String direction){ if(direction.equals("right")){ if(movableEntityImage.getRotation() != 90){ System.out.println("Pre rotate x = " + x + " . Pre rotate y = " + y + ". width = " + width + ". height = " + height); System.out.println("Pre rotate rotation = " + movableEntityImage.getRotation()); float rotX = (x + (width/2)); float rotY = (y + (height/2)); movableEntityImage.setCenterOfRotation(rotX, rotY); System.out.println("center of rotation X = " + movableEntityImage.getCenterOfRotationX() + ".center of rotation y = "+ movableEntityImage.getCenterOfRotationY()); movableEntityImage.rotate(90); System.out.println("Post rotate x = " + x + " . Post rotate y = " + y); System.out.println("Post rotate rotation = " + movableEntityImage.getRotation()); } } And finally the console output: The tank has been created with an x of: 50.0 and a y of: 50.0 Pre rotate x = 50.0 Pre rotate y = 50.0 width = 25.0 height = 25.0 Pre rotate rotation = 0.0 Center of rotation X = 62.5 Center of rotation y = 62.5 Post rotate rotation = 90.0 Am I missing something? Or have I gone about this in the wrong way. Thanks, Josh
tagged with: rotation
tagged with: java
tagged with: slick2d
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20824065
has title: My Slick2d Image does not rotate as expected
tagged with: image-rotation

http://stackoverflow.com/a/20845809
answers question: http://stackoverflow.com/q/20845735
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31268396
has body: Where do you have below lines of code in your onCreate method ? super.onCreate(instance1); setContentView(R.layout.yourlayout);

http://stackoverflow.com/a/20732758
answers question: http://stackoverflow.com/q/20732705
upvote count: 1
downvote count: 0
has body: Well, the == operator compares references. You want to use the equals() method here: if (sLine[1].equals("true")) { [...] } Also, you should use the String.trim() method, to ensure that there are no leading or trailing spaces in your strings. A line like this: param = true would parse to " true" with your code, which is not equal to "true". if (sLine[1].trim().equals("true")) { [...] }
type: Answer
score: 1

object
tags question: http://stackoverflow.com/q/20826711
tag name: object
tags question: http://stackoverflow.com/q/20729220
tags question: http://stackoverflow.com/q/20829005
tags question: http://stackoverflow.com/q/20838750
tags question: http://stackoverflow.com/q/20746444
tags question: http://stackoverflow.com/q/20843401
tags question: http://stackoverflow.com/q/20684719
tags question: http://stackoverflow.com/q/20811190
tags question: http://stackoverflow.com/q/20823645
tags question: http://stackoverflow.com/q/20731961
tags question: http://stackoverflow.com/q/20715537
tags question: http://stackoverflow.com/q/20824943
tags question: http://stackoverflow.com/q/20778881
tags question: http://stackoverflow.com/q/20786961
tags question: http://stackoverflow.com/q/20720571
tags question: http://stackoverflow.com/q/20714964
tags question: http://stackoverflow.com/q/20741168
tags question: http://stackoverflow.com/q/20831885
tags question: http://stackoverflow.com/q/20729459
tags question: http://stackoverflow.com/q/20790272
tags question: http://stackoverflow.com/q/20725191
tags question: http://stackoverflow.com/q/20744546
tags question: http://stackoverflow.com/q/20810113
type: Tag
tags question: http://stackoverflow.com/q/20711084
tags question: http://stackoverflow.com/q/20833380
tags question: http://stackoverflow.com/q/20735132
tags question: http://stackoverflow.com/q/20780972
tags question: http://stackoverflow.com/q/20817789

http://stackoverflow.com/a/20801369
downvote count: 0
answers question: http://stackoverflow.com/q/20801267
has comment: http://stackoverflow.com/comment/31185627
type: Answer
has body: Comparable is in itself a generic. What happens if you change to public static final &lt;T extends Comparable&lt;? super T&gt;&gt; T doStuff(List&lt;T&gt; list, int k) ... ?
score: 1
upvote count: 1

http://stackoverflow.com/q/20831028
downvote count: 1
has comment: http://stackoverflow.com/comment/31245272
type: Question
has answer: http://stackoverflow.com/a/20831093
has answer: http://stackoverflow.com/a/20831244
has body: I need someone to elaborate on certain parts of this code. class ContinueWithLabelDemo { public static void main(String[] args) { String searchMe = "Look for a substring in me"; String substring = "sub"; boolean foundIt = false; int max = searchMe.length() - substring.length(); test: for (int i = 0; i &lt;= max; i++) { int n = substring.length(); int j = i; int k = 0; while (n-- != 0) { if (searchMe.charAt(j++) != substring.charAt(k++)) { continue test; } } foundIt = true; break test; } System.out.println(foundIt ? "Found it" : "Didn't find it"); } } more specifically, I don't understand this part: int n = substring.length(); int j = i; int k = 0; while (n-- != 0) { if (searchMe.charAt(j++) != substring.charAt(k++)) { continue test; } } Why is it necessary to declare j and k in this code at all? I know that there is a reason in it for the if statement if (searchMe.charAt(j++) != substring.charAt(k++)) but I don't understand what the code is actually doing at this part. Also, what does while (n-- != 0) mean?
has answer: http://stackoverflow.com/a/20831059
score: 0
has answer: http://stackoverflow.com/a/28437235
has answer: http://stackoverflow.com/a/20831054
answer count: 7
has answer: http://stackoverflow.com/a/20831247
favorite count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/34991327
has title: Need help understanding parts of this class
upvote count: 1

http://stackoverflow.com/q/20680913
has comment: http://stackoverflow.com/comment/30968874
answer count: 1
tagged with: shell
favorite count: 0
has comment: http://stackoverflow.com/comment/30968985
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/30969194
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/20681257
accepted answer: http://stackoverflow.com/a/20681257
has title: Maven commands in shell scripts
tagged with: java
has body: I'm trying to create a script which can build a number of different Maven projects where each has it's own pom.xml file. So from the parent directory I wish to run the command mvn -f Project1/pom.xml clean This works fine from the command line but if I place it into a shell script and execute it, it fails with unknown lifecycle phase "clean". The overall goal is to have a sequence of these commands executing within a script i.e. mvn -f Project1/pom.xml clean mvn -f Project2/pom.xml clean mvn -f Project3/pom.xml clean with the calling script residing in the parent directory.
has comment: http://stackoverflow.com/comment/30981650
upvote count: 1

http://stackoverflow.com/q/20838857
answer count: 4
has answer: http://stackoverflow.com/a/20838940
has comment: http://stackoverflow.com/comment/31313544
has comment: http://stackoverflow.com/comment/31255272
has comment: http://stackoverflow.com/comment/31255066
has comment: http://stackoverflow.com/comment/31255200
tagged with: java
has answer: http://stackoverflow.com/a/20838908
type: Question
has comment: http://stackoverflow.com/comment/31254933
has title: NullPointerException - But why?
score: 0
has answer: http://stackoverflow.com/a/20838918
has body: In the following part: Statusframe statusframe = new Statusframe(); long sendetBytes = 0; int percent = 0; while((i = in.read(buffer)) != -1) { outF.write(buffer, 0, i); outF.flush(); l += i; if(l==(int)sendetBytes) break; sendetBytes += 1048576; percent = (int) (sendetBytes / filelength); statsuframe.getPbStatus().setValue(percent); } outF.close(); statusframe.getFrStatusframe().dispose(); I get a NullPointerException of "statusfenster" in the line statusframe.getPbStatus().setValue(percent); and later i would get it too in statusframe.getFrStatusframe().dispose(); But i don't understand why? I created already a object for "statusframe" in the first line...Also i created in Statusframe.java a object for pbStatus. Additional information: This code here is running in a seperate thread. EDIT: @Zaheer Ahmed: This mistake is but i written this code not in english and translate it here manually. The mistake was in the Statusframe.java constructor. The code for creating pbStatus and all this stuff was not in the constructor, it was in a seperate method and i forgot it to call it in the constructor.... Sorry for this mistake, but thanks for your help!!!
has answer: http://stackoverflow.com/a/20839080
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31254936
has comment: http://stackoverflow.com/comment/31254934

http://stackoverflow.com/comment/31153649
comment on: http://stackoverflow.com/q/20783574
has text: I use eclipse(sts). I am not sure. I think it is enterprise
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20718900
has comment: http://stackoverflow.com/comment/37135448
has body: I'm fairly sure there must have been something wrong in your test. The symptoms you describe should never happen. The only way for == not to be equals() is if there was a bad implementation of your equals method. In the case of an Integer, which is a core Java class, that is just not going to happen. However what might have happened is if the data type came back as a different format (Float or Long for example) than you expected the equals() may have failed there. For example 3 == 3L returns true but new Integer(3).equals(new Long(3)) returns false. That's because the == case with primitives is allowed to promote the integer to long to perform the comparison. Try it yourself here: http://www.tryjava8.com/app/snippets/52b5878ce4b0f5090255bc17
upvote count: 2
has comment: http://stackoverflow.com/comment/37120639
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31057191
accepted answer of: http://stackoverflow.com/q/20718592
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20718592

http://stackoverflow.com/q/20808870
type: Question
upvote count: 2
has title: How to run a .exe file through the command prompt in a Java program?
answer count: 1
tagged with: command-line
tagged with: java
has answer: http://stackoverflow.com/a/20808942
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31199374
score: 2
downvote count: 0
has body: I've read other questions about running .exe files through command prompt but the answers given did not work for me--I tried several. I am generating input files for this .exe and I need to run them and get the output. The command is this: C:\exeDir\myExe.exe -b C:\inDir\in.txt C:\outDir\out.txt I have tried: Process process = new ProcessBuilder("C:\\exeDir\\myExe.exe", "-b C:\\inDir\\in.txt", "C:\\outDir\\out.txt").start(); And String[] cmd = { "C:\\exeDir\\myExe.exe", "-b C:\\inDir\\in.txt", "C:\\outDir\\out.txt" }; Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); As well as a few other variations. None have worked. What is the proper way for me to handle this? Thanks.
favorite count: 0

http://stackoverflow.com/comment/31100062
type: Comment
has text: @DavidWallace: I think it is deeper than that, by calling it a supertype, you cannot possibly define it in a way that works, since `<? super M>` always includes `object` which can't satisfy the requirement anyway.
comment on: http://stackoverflow.com/q/20752781
score: 0
type: QuestionComment

http://stackoverflow.com/q/20775599
score: 0
answer count: 2
tagged with: ubuntu
has body: I have a small app which crashes if I run it with open-jdk/jre so I would like to run it with oracles Java, how can I force it to run with the original Java? I use ubuntu 12 lts.
possible better answer: http://stackoverflow.com/a/20775703
has answer: http://stackoverflow.com/a/20775696
accepted answer: http://stackoverflow.com/a/20775696
type: AnsweredQuestion
type: Question
has title: Start java app with oracles java and not openjdk
tagged with: java
has answer: http://stackoverflow.com/a/20775703
tagged with: coredump

http://stackoverflow.com/a/20956456
has comment: http://stackoverflow.com/comment/78751242
type: Answer
has body: According to the documentation, use a relative path for a local jar dependency as follows. Groovy syntax: dependencies { implementation files('libs/something_local.jar') } Kotlin syntax: dependencies { implementation(files("libs/something_local.jar")) }
has comment: http://stackoverflow.com/comment/139329945
has comment: http://stackoverflow.com/comment/59975202
score: 1018
downvote count: 1
has comment: http://stackoverflow.com/comment/75783497
has comment: http://stackoverflow.com/comment/133204970
upvote count: 1019
answers question: http://stackoverflow.com/q/20700053
has comment: http://stackoverflow.com/comment/78118725
has comment: http://stackoverflow.com/comment/89255779
has comment: http://stackoverflow.com/comment/44223075
has comment: http://stackoverflow.com/comment/131000910
has comment: http://stackoverflow.com/comment/120035788

http://stackoverflow.com/q/20794305
tagged with: java
has comment: http://stackoverflow.com/comment/31173314
type: Question
has comment: http://stackoverflow.com/comment/31174119
tagged with: android-timepicker
has comment: http://stackoverflow.com/comment/31173409
accepted answer: http://stackoverflow.com/a/20795329
possible better answer: http://stackoverflow.com/a/20794528
has title: Simple timepicker for a fragment activity
has comment: http://stackoverflow.com/comment/31173972
has answer: http://stackoverflow.com/a/20795329
has comment: http://stackoverflow.com/comment/31173951
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31174640
favorite count: 0
has comment: http://stackoverflow.com/comment/31173378
has comment: http://stackoverflow.com/comment/31173865
has comment: http://stackoverflow.com/comment/31173886
has comment: http://stackoverflow.com/comment/31174955
has answer: http://stackoverflow.com/a/20794528
tagged with: android
has comment: http://stackoverflow.com/comment/31174007
has body: I am trying to launch a timepicker from a edittext in a fragment Buffet_offerings_breakfast_menu2.java public class Buffet_offerings_breakfast_menu2 extends Fragment implements PickTime{ RadioGroup radioGroup; EditText ed1,ed2; boolean flag =false; TimePickerFragment newFragment; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub final View view=inflater.inflate(R.layout.buffet_offerings_breakfast_menu2, container, false); ed1 = (EditText) view.findViewById(R.id.from_lunch_edit_text_id); ed2 = (EditText) view.findViewById(R.id.to_lunch_edit_text_id); radioGroup = (RadioGroup) view.findViewById(R.id.radioGroup1); newFragment = new TimePickerFragment(); ed1.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(hasFocus){ flag =false; newFragment.show(getFragmentManager(), "timePicker"); } } }); ed2.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(hasFocus){ flag =true; newFragment.show(getFragmentManager(), "timePicker"); } } }); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(RadioGroup group, int checkedId) { // checkedId is the RadioButton selected if(checkedId == R.id.SelectDaysRG_ID) { view.findViewById(R.id.linearLayout_individualdays).setVisibility(View.VISIBLE); } else if(checkedId == R.id.WeekdaysRG_ID) { view.findViewById(R.id.linearLayout_individualdays).setVisibility(View.INVISIBLE); } else if(checkedId == R.id.WeekendsRG_ID) { view.findViewById(R.id.linearLayout_individualdays).setVisibility(View.INVISIBLE); } } }); return view; } @Override public void returnTime(String value) { // TODO Auto-generated method stub if(flag==false) ed1.setText(value); else if(flag==true) ed2.setText(value); } } TimePickerFragment.java public class TimePickerFragment extends DialogFragment implem…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31174707
has comment: http://stackoverflow.com/comment/31173298
downvote count: 0
tagged with: android-fragments
score: 1

http://stackoverflow.com/q/20841577
favorite count: 0
answer count: 4
score: 2
has title: Find biggest value in Java
type: AnsweredQuestion
has body: For an input like the following is it ok to use Float.compare to find the biggest float in an array? Float[] v = {0.38118651972530804, 0.3580139606405057, 0.7358862700995704}; float max = -1; for (int i = 0; i &lt; v.length; i++) if (Float.compare(max,v[i]) &gt; 0) max = v[i]; Is there a better way? or maybe there could be some precision error?
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/20841688
has comment: http://stackoverflow.com/comment/31260214
has answer: http://stackoverflow.com/a/20841742
type: Question
tagged with: find
has comment: http://stackoverflow.com/comment/31260128
has comment: http://stackoverflow.com/comment/31260028
has answer: http://stackoverflow.com/a/20841743
tagged with: compare
possible better answer: http://stackoverflow.com/a/20841688
downvote count: 0
has answer: http://stackoverflow.com/a/20841759
accepted answer: http://stackoverflow.com/a/20841759

http://stackoverflow.com/a/20705808
type: Answer
has body: int [] value = new int [ctr]; The above line is initializing the array with 0 length. You can use the getFetchSize() method of the ResultSet class to find out the number of rows returned and the initialize the array with it.
answers question: http://stackoverflow.com/q/20705652
score: 0

http://stackoverflow.com/comment/31210258
has text: So, is your question really about the JSON library yiu are using, rather than Java itself? How that library handles reserved names?
comment on: http://stackoverflow.com/q/20814287
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31243230
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20831982
has text: @HotLicks 1L of a good comment...
score: 0

http://stackoverflow.com/q/20753372
has answer: http://stackoverflow.com/a/20753700
has comment: http://stackoverflow.com/comment/31100852
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31100819
score: 3
tagged with: oop
has comment: http://stackoverflow.com/comment/31100883
has body: I am completing Sun/Oracle's Trail (http://docs.oracle.com/javase/tutorial/java/TOC.html) and it keeps reiterating the importance of encapsulation. How important, really, is encapsulation? I mean, if I may need to access the value of a given class field, why would I do so through a method when I could just access the field directly? Since the field would be accessed through its corresponding object anyway, where could this really go wrong? Is it just for code extensibility purposes? In other words, because that way in the future if I decide I want to somehow alter or sanitize the field before returning it I can? I'm more looking for an example or two than anything.
has title: When should encapsulation be used?
tagged with: encapsulation
has answer: http://stackoverflow.com/a/20753519
downvote count: 0
has answer: http://stackoverflow.com/a/20753416
favorite count: 0
has answer: http://stackoverflow.com/a/20753376
has comment: http://stackoverflow.com/comment/31100834
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31100840
answer count: 4

http://stackoverflow.com/comment/31050956
comment on: http://stackoverflow.com/q/20725717
score: 0
has text: I'm pretty shure you would get the wrong results for non-commutative operations (i.e. -, /) even if you solve the error, since you exchanged the operands. (You want to input A before B for calculating A / B , right?)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20779799
has body: The number is too big for an Integer, and if you might use a value that is arbitrarily big I suggest using an appropriate type like new BigInteger("565a3eea61", 16);
score: 0
answers question: http://stackoverflow.com/q/20779761
type: Answer

http://stackoverflow.com/a/20755805
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31116000
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/20732853
has body: The second way ("is not so neat") is the canonical way of doing it. This is called a capture helper. It takes advantage of capture to be able to introduce a "local" type variable. The helper method is usually made private so that outside code doesn't have to know it's there. P.S. S is not used anywhere
answers question: http://stackoverflow.com/q/20732853
downvote count: 0

http://stackoverflow.com/comment/30978257
has text: Thanks. So if I wrap any object with atomic reference it will be completely thread-safe, including all its attributes? Or is it possible only for an immutable object like enum? so I will be able to be sure that if I substitute an enum with an atomic enum no object will lock my class in this example? http://stackoverflow.com/questions/20685372
type: AnswerComment
comment on: http://stackoverflow.com/a/20686023
type: Comment
score: 1

http://stackoverflow.com/comment/31251114
type: Comment
type: QuestionComment
has text: print statement should be as System.out.println("the date is "+df.format(dtt));
score: 1
comment on: http://stackoverflow.com/q/20836653

http://stackoverflow.com/comment/31027292
type: QuestionComment
has text: Activity A and B did not create eachother
score: 0
comment on: http://stackoverflow.com/q/20712827
type: Comment

http://stackoverflow.com/q/20730288
type: Question
has comment: http://stackoverflow.com/comment/31058803
has comment: http://stackoverflow.com/comment/31059414
has answer: http://stackoverflow.com/a/20730515
has comment: http://stackoverflow.com/comment/31058894
has comment: http://stackoverflow.com/comment/31058853
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31058840
has answer: http://stackoverflow.com/a/20730457
linked to: http://stackoverflow.com/q/3864175
has title: How can I get the name of a method without using class.getDeclaredMethod
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31058802
has comment: http://stackoverflow.com/comment/31058827
tagged with: java
has body: How can I get the name of a method just like I can get the name of a class? (RandomClass.class.getName()) Hardcoding won't work because the obfuscator destroys it. Reason: I'm injecting methods like this: MethodNode getLocalPlayer = GetterAdapter.insert(false, true, "getLocalPlayer", "Lvanquish/accessors/Player;", "client", "yD", "LQZ;"); classNode.methods.add(getLocalPlayer); //class client implements my interface which contains the method getLocalPlayer public interface Client { public int[] getPlayerIndices(); public Player getLocalPlayer(); public Player[] getPlayers(); public int getBaseX(); public int getBaseY(); public int getCameraX(); public int getCameraY(); } //when I obfuscate my files getLocalPlayer get's a name like a2 //when you look above you see that the method name was hard code and so // will it create an error Declared method wont work here, because I don't know the method name and there are like 4 vars of the same type. Would this work or would it be a mess? @DataMap.varDetails(name = "getPlayerIndices") public int[] getPlayerIndices();

http://stackoverflow.com/comment/114575399
type: AnswerComment
type: Comment
has text: I don't see anything related to JSON or Any ORM mapping in the question. This error can occur due to multiple reasons. Mostly when you try to send something to the client when response has already been sent and committed from the server.
comment on: http://stackoverflow.com/a/64802199
score: 0

http://stackoverflow.com/comment/31113192
type: AnswerComment
score: 5
comment on: http://stackoverflow.com/a/20760659
has text: That doesn't modify the value in the list.
type: Comment

http://stackoverflow.com/q/20822077
has answer: http://stackoverflow.com/a/20822221
accepted answer: http://stackoverflow.com/a/20822221
has comment: http://stackoverflow.com/comment/31224033
score: 0
has title: Better way of implementing synchronous and asynchronous behavior in a client code?
answer count: 1
tagged with: asynchronous
tagged with: future
has comment: http://stackoverflow.com/comment/31224050
has body: I am working on a project in which I am supposed to make synchronous and asynchronous behavior of my client. In general, how our client will work as below - Customer will call our client with a userId and we will construct a URL from that userId and make a HTTP call to that URL and we will get a JSON String back after hitting the URL. And after we get the response back as a JSON String, then we will send that JSON String back to our customer. So in this case, as I mentioned above, I need to have synchronous and asynchronous methods, some customer will call synchronous method to get the same feature and some will call our asynchronous method to get the data back. So now I am thinking, what is the best way to implement synchronous and asynchronous feature in a same client code. I know there might be different answers depending on how people implement but as a developer there might be better way of implementing it as the way currently I am doing. I am still learning so wanted to know better way of doing this by which I can also tell other people that to solve these kind of problems, you need to do it like this. For now, I have created an interface like this - public interface Client { // for synchronous public String execute(final String userId); // for asynchronous public Future&lt;String&gt; executeAsync(final String userId); } And then I have our SmartClient which implements the above Client interface. I am not sure whether I should be doing like this or there is a better way of implementing synchronous and asynchronous feature. Below is my SmartClient code and other high level code inside it which I think is sufficient to understand the whole flow. public class SmartClient implements Client { ExecutorService executor = Executors.newFixedThreadPool(5); // This is for synchronous call @Override public String execute(String userId) { String response = null; Future&lt;String&gt; future = executor.submit(new Task(userId)); try { response = future.get(3, TimeUnit.SECONDS…
tagged with: java
tagged with: multithreading
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/31213592
has text: thank you for editing may question Mr.Don Roby
comment on: http://stackoverflow.com/q/20816389
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20740448
has body: add to activity: public void modelTextViewClick(View v) { //do something on click } and to layout: &lt;TextView android:id="@+id/state1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Tracker_model" android:clickable="true" android:onClick="modelTextViewClick"/&gt; and remove your on click listener.
answers question: http://stackoverflow.com/q/20740345
score: 0
has comment: http://stackoverflow.com/comment/31077815
type: Answer

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/20712827

computer-science
tags question: http://stackoverflow.com/q/20821592
tags question: http://stackoverflow.com/q/20833147
type: Tag
tags question: http://stackoverflow.com/q/20822315
tag name: computer-science
tags question: http://stackoverflow.com/q/20832276

http://stackoverflow.com/q/20848157
type: UnansweredQuestion
tagged with: java
tagged with: lwjgl
tagged with: render
type: Question
linked to: http://stackoverflow.com/q/22515295
has title: Speeding up lwjgl rendering?
tagged with: minecraft
linked to: http://stackoverflow.com/q/17155662
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20848449
has comment: http://stackoverflow.com/comment/31273085
favorite count: 0
has body: I wanted to make the Minecraft block rendering using OpenGl(lwjgl). Anyway I kind of did it but I'm having FPS problems. I wish somebody could tell me how to optimize it so i can render faster more chunks.I will show you the code which shows how i did render the simple map so far based on 0 and 1 values. CODE: Chunk Calculation: public void calculate(){ for(int x=0;x&lt;w;x++) for(int y=0;y&lt;d;y++) for(int z=0;z&lt;h;z++){ for(int i=0;i&lt;6;i++){ Vector3 d =dir[i]; if(isVisible(x,y,z)==false)continue; if(!isVisible(-(int)d.x+x,-(int)d.y+y,-(int)d.z+z) ){ pList.add(new Point4B((byte)x,(byte)y,(byte)z,(byte) i)); } } } thats the way i do calculations based on 3D Bit Array: Point4B simply has arguments position x,y,z and side s Thats how i render the chunk: public void draw(){ for(Point4B a : pList){ glPushMatrix(); glTranslatef(a.x,a.y,a.z); glBegin(GL_QUADS); DrawSide((int)a.s); glEnd(); glPopMatrix(); } pList is list of all rects i need to render Here is the code i render all the chunks: for(float x=0;x&lt;16;x++){ for(float z=0;z&lt;16;z++){ glPushMatrix(); glTranslatef((float)x*16,0f,(float)z*16); chunks[(int)x][(int)z].draw(); glPopMatrix(); } here i render 16x16 chunks and this is extremly slow. I know that there is an optimization that i can do for rendering sides between chunks but i belive even if so i will still not be able to render about 50 chunks with no huge FPS damage Here i draw Side: switch(side){ case B_UP: glColor3f(0.1333f,0.54509f,0.1333f); glVertex3f(-1,1,-1); glVertex3f(1,1,-1); glVertex3f(1,1,1); glVertex3f(-1,1,1); break; and so on for all cases for the 6 sides Pls note if i have missed something to explain
has answer: http://stackoverflow.com/a/23316336
tagged with: opengl

http://stackoverflow.com/q/20724136
has answer: http://stackoverflow.com/a/20724153
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20724144
has title: Access private inner class, through a public outer class - from another class
possible better answer: http://stackoverflow.com/a/20724144
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20724153
has comment: http://stackoverflow.com/comment/31047637
has comment: http://stackoverflow.com/comment/31047667
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31047693
answer count: 2
has comment: http://stackoverflow.com/comment/31047680
has comment: http://stackoverflow.com/comment/31047717
has body: I am completely stuck on this and have been playing around with it for a while. I have a class "launcher", from which I want to access an instance of a private inner class "PropertyInstance", through the outer class "PropertyManager". So, in my launcher I would like to write: PropertyManager pm = new PropertyManager(); PropertyInstance pi = pm.getInstance("brickbreaker.properties"); In my PropertyManager class I have written the following code: public PropertyInstance getInstance(String location) { PropertyInstance pi = null; if(!propertyList.contains(location)) { System.out.println("it does not contain it yet, so we will create it"); pi = new PropertyInstance(location); propertyList.add(pi); } return pi; } And inside this class, I have the following inner class: private class PropertyInstance { } Which is irrelevant apart from the private modifier. The problem is that I can not access the PropertyInstance class from my Launcher due to it being private, and I do not seem able to find a workaround so really any help is appreciated. If it can even be done. EDIT: It seems to be unclear that I'm looking for a workaround whilst keeping the inner class private, sorry for the confusion! :)

newline
tags question: http://stackoverflow.com/q/20730648
tag name: newline
type: Tag
tags question: http://stackoverflow.com/q/20802808
tags question: http://stackoverflow.com/q/20706206

http://stackoverflow.com/a/56731034
type: Answer
answers question: http://stackoverflow.com/q/20740444
has body: Here is the implementation of Luhn algorithm. public class LuhnAlgorithm { /** * Returns true if given card number is valid * * @param cardNum Card number * @return true if card number is valid else false */ private static boolean checkLuhn(String cardNum) { int cardlength = cardNum.length(); int evenSum = 0, oddSum = 0, sum; for (int i = cardlength - 1; i &gt;= 0; i--) { System.out.println(cardNum.charAt(i)); int digit = Character.getNumericValue(cardNum.charAt(i)); if (i % 2 == 0) { int multiplyByTwo = digit * 2; if (multiplyByTwo &gt; 9) { /* Add two digits to handle cases that make two digits after doubling */ String mul = String.valueOf(multiplyByTwo); multiplyByTwo = Character.getNumericValue(mul.charAt(0)) + Character.getNumericValue(mul.charAt(1)); } evenSum += multiplyByTwo; } else { oddSum += digit; } } sum = evenSum + oddSum; if (sum % 10 == 0) { System.out.println("valid card"); return true; } else { System.out.println("invalid card"); return false; } } public static void main(String[] args) { String cardNum = "4071690065031703"; System.out.println(checkLuhn(cardNum)); } }
score: 0

http://stackoverflow.com/q/20806470
tagged with: java
answer count: 3
upvote count: 16
has comment: http://stackoverflow.com/comment/31194998
accepted answer: http://stackoverflow.com/a/20806950
has title: Resource specification not allowed here for source level below 1.7
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/64541322
has comment: http://stackoverflow.com/comment/31194924
favorite count: 0
score: 16
has answer: http://stackoverflow.com/a/64541322
type: Question
has answer: http://stackoverflow.com/a/20806950
has answer: http://stackoverflow.com/a/57309380
has body: While running java program getting following error in eclipse Caused by: java.lang.Error: Unresolved compilation problem: Resource specification not allowed here for source level below 1.7 Although I am using java 1.7.25 and all eclipse settings are in place but not sure why getting this error SOLUTION. Problem solved by updating project in eclipse using maven.

http://stackoverflow.com/a/20831512
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You should avoid "goto" statements in all languages, according to the rules of "structured programming", instead using if-then-else or do or while or for loops to control program flow. Java DOES have a sort of "goto" statement that you COULD use to only slightly modify your code, but consider the while loop below and the break statement, which jumps out of the loop. public static void main(String[] args) { String method = ""; while(! method.equals("tax")){ System.out.print("What do you want to calculate? "); method = sc.nextLine(); if(method.equals("tax")) break; System.out.print("Please input a valid method. \n\n"); } tax(); } The break statement enables your "Please ... valid" statement to display. You could also use this: public static void main(String[] args) { String method = ""; while(! method.equals("tax")){ System.out.print("What do you want to calculate? "); method = sc.nextLine(); } tax(); } I also kind of like this: public static void main(String[] args) { String method = ""; while(1==1){ System.out.print("What do you want to calculate? "); method = sc.nextLine(); if(method.equals("tax") break; System.out.print("Please input a valid method. \n\n"); } tax(); } You might go to the Java tutorials; they're good.
type: Answer
accepted answer of: http://stackoverflow.com/q/20831324
answers question: http://stackoverflow.com/q/20831324
downvote count: 0

http://stackoverflow.com/a/20698834
has comment: http://stackoverflow.com/comment/31003187
has comment: http://stackoverflow.com/comment/31002878
has comment: http://stackoverflow.com/comment/31002549
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31003088
has comment: http://stackoverflow.com/comment/31005705
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20698725
has body: Try this: Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,"1"); intent.setData(uri); intent.setType("audio/*"); List&lt;ResolveInfo&gt; apps = getPackageManager().queryIntentActivities(intent, 0); for (ResolveInfo rInfo : apps) { //process list here }

http://stackoverflow.com/comment/31158759
has text: You might try using the C runtime library functions for changing the current working directory (`chdir`?) prior to accessing the DLL. This may or may not affect your running VM as well, though. If that is the case you may have to spawn a child process to communicate with the DLL; I don't think changing the directory for the entire framework for the sake of the DLL makes sense anyway.
score: 0
comment on: http://stackoverflow.com/q/20765744
type: QuestionComment
type: Comment

hikaricp
tags question: http://stackoverflow.com/q/20775165
tag name: hikaricp
type: Tag

http://stackoverflow.com/q/20683086
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22681551
tagged with: jackson
answer count: 1
downvote count: 0
has body: I have two class News and NewsList News.class @Entity @Table(name = News.TABLE_NAME) @NamedQueries({ @NamedQuery(name = News.FIND_ALL, query = "SELECT n FROM News n"), @NamedQuery(name = News.FIND_BY_SWID, query = "SELECT n FROM News n WHERE n.swId = :swId"), @NamedQuery(name = News.FIND_BY_LINK, query = "SELECT n FROM News n WHERE n.link = :link"), @NamedQuery(name = News.FIND_BY_LIST, query = "SELECT n FROM News n WHERE n.list = :list ORDER BY n.lastModified DESC") }) public class News { public static final String TABLE_NAME = "news"; public static final String ID_SEQ = "seq_news_id"; public static final String FIND_ALL = "News.findAll"; public static final String FIND_BY_SWID = "News.findBySwId"; public static final String FIND_BY_LINK = "News.findByLink"; public static final String FIND_BY_LIST = "News.findByList"; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = ID_SEQ) @SequenceGenerator(name = ID_SEQ, allocationSize = 1, initialValue = 1, sequenceName = ID_SEQ) private long id; @Column(name = "swid", nullable = false, unique = true) private long swId; @Column(name = "link", nullable = false, unique = true) private String link; @Temporal(TemporalType.TIMESTAMP) @Column(name = "lastmodified") private Date lastModified; @Column(name = "title", nullable = false) private String title; @Column(name = "lead", nullable = false, length = 500) private String lead; @Lob @Basic(fetch = FetchType.LAZY) @Column(name = "content", nullable = true) private String content; @ElementCollection(fetch = FetchType.LAZY, targetClass = Media.class) @CollectionTable(name = "news_media") private List&lt;Media&gt; medias = new ArrayList&lt;Media&gt;(); @ManyToOne(fetch = FetchType.LAZY, targetEntity = NewsList.class, optional = false) @JoinColumn(name = "newslist_id", nullable = false) @JsonProperty(value = "newslist_id") @JsonSerialize(using = NewsListPropertySerializer.class) private NewsList list; //Getters and Setters } NewsList.class @Entity @Table(name = NewsLis…
favorite count: 0
tagged with: serialization
type: UnansweredQuestion
tagged with: wildfly
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Custom serializer only for property but not for class

http://stackoverflow.com/a/20804733
has comment: http://stackoverflow.com/comment/31193020
has comment: http://stackoverflow.com/comment/31193332
type: Answer
has body: Handler myHandler Declare this as a instance variable. You have declared and initialized myHandler in setAlarmHandler which makes it local to that method public void setAlarmHandler (long difference) { Handler myHandler = new Handler();// local to setAlaramHandler Its the same for Runnable setAlarm
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31194128
has comment: http://stackoverflow.com/comment/31192965
accepted answer of: http://stackoverflow.com/q/20804704
has comment: http://stackoverflow.com/comment/31192927
has comment: http://stackoverflow.com/comment/31192514
answers question: http://stackoverflow.com/q/20804704
has comment: http://stackoverflow.com/comment/31193399
has comment: http://stackoverflow.com/comment/31193688
has comment: http://stackoverflow.com/comment/31193051
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31192467

http://stackoverflow.com/q/20768354
tagged with: java
has comment: http://stackoverflow.com/comment/31127593
has comment: http://stackoverflow.com/comment/31127568
type: Question
downvote count: 0
tagged with: jackson
favorite count: 0
tagged with: resteasy
tagged with: nullpointerexception
has title: Spring session bean and RESTEasy + Jackson nullPointerException
has comment: http://stackoverflow.com/comment/31127711
answer count: 0
type: UnansweredQuestion
has body: I am building a spring based WebApp including a RESTful method call. I use RESTeasy and jackson to return the username of the current logged in user (this information is stored in a session bean called "UserBean") UserBean: @Component("userBean") @Scope("session") public class UserBean implements Serializable { @Autowired private InitApp app; private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } } OverviewBean is the bean that contains the rest method (including the jackson conversion to json): @Component("overviewBean") @Scope("view") @Path("/repairs") public class OverviewBean { @Autowired private InitApp app; @Autowired private UserBean userBean; private List&lt;Repair&gt; openRepairsClient; private List&lt;Repair&gt; closedRepairsClient; @PostConstruct public void fillRepairs() { try { String username = userBean.getUsername(); openRepairsClient = app.repairService.findOpenRepairsByClient((Client) app.userService.getUser(userBean.getUsername())); closedRepairsClient = app.repairService.findClosedRepairsByClient((Client) app.userService.getUser(userBean.getUsername())); } catch (UserServiceException ex) { Logger.getLogger(OverviewBean.class.getName()).log(Level.SEVERE, null, ex); } } //Getters and setters openRepairsClient/closedRepairsClient @GET @Path("/getrepairs") @Produces("application/json") public String getOpenRepairsInJson() { String username = userBean.getUsername(); return "test"; } } fillRepairs() is able to use userBean without any errors. For example the "String username = userBean.getUsername();" within the try catch returns the username correctly. My issue is that when getOpenRepairsInJson gets called it throws a nullPointerException on "String username = userBean.getUsername();". It seems that my userBean is not "linked" at the moment of the method call. What am I doing wrong? Thanks in advance!
upvote count: 1
tagged with: spring
score: 1

http://stackoverflow.com/comment/31115043
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20761357
has text: no, i am still looking but thanks for your help

http://stackoverflow.com/comment/31047968
has text: Yes, you can. Inner classes have access to outer class variables. Get rid of `int` in inner classes. This way your inner classes will be able to update the same outer class variable and your getError() will return this value. Another question is: why would you want to do it this way?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20724247
score: 0

http://stackoverflow.com/comment/31014029
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20705860
type: Comment
has text: Perfect, I knew there was something simple I was missing, just didn't know the right search term. Thanks!

http://stackoverflow.com/q/20729919
has answer: http://stackoverflow.com/a/20731175
accepted answer: http://stackoverflow.com/a/20731175
upvote count: 3
tagged with: java
has title: Steps of converting C++ opencv project on computer to opencv android
tagged with: android-ndk
type: Question
has body: I wrote a c++ project on my computer for stabilizing a video using OpenCV. But I want to write this project to android using Opencv4Android. For doing this, should I make new project or Is any way to convert that project for android by using NDK? If I can use project of mycompter, Did need many changes on that c++ codes? What steps need to convert or porting a computer opencv project to android opencv project?
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
tagged with: c++
tagged with: opencv
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/20698355
has body: import java.io.*; public class Check { public static void main(String [] args) { BufferedReader br = null; try { br= new BufferedReader(new FileReader(Fname)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } String xmlinput; StringBuffer sb= new StringBuffer(); try { while((xmlinput=br.readLine()) !=null) { sb.append(xmlinput.trim()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(sb.toString()); } } Now you have the content of your xml as string.
answers question: http://stackoverflow.com/q/20698013
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20698013

http://stackoverflow.com/q/20713631
linked to: http://stackoverflow.com/q/24931965
has answer: http://stackoverflow.com/a/34841425
score: 1
tagged with: jtextpane
upvote count: 1
has body: I can't make the horizontal scrollbar appear. I've tried using JTextPane.setSize(), JTextPane.setPreferredSize() and no size method for JTextPane. I'm also using JScrollPane.setPreferredSize(). The vertical scroll bar appears, but the horizontal one doesn't. Here is an example: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test { private int textPaneWidth = 500; private int textPaneHeigth = 200; private int scrollPaneWidth = 100; private int scrollPaneHeigth = 100; private JTextPane textPane; private JButton button; private JFrame frame; private JScrollPane scrollPane; public static void main(String[] args) { Test gui = new Test(); gui.go(); } private void go() { frame = new JFrame("Test"); button = new JButton("button"); textPane = new JTextPane(); scrollPane = new JScrollPane(textPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); button.addActionListener(new ButtonListener()); textPane.setFont(new Font("Courier", Font.PLAIN, 12)); // Sizes: // textPane.setSize(textPaneWidth, textPaneHeigth); // ??? // textPane.setPreferredSize(new Dimension(textPaneWidth, textPaneHeigth)); // ??? scrollPane.setPreferredSize(new Dimension(scrollPaneWidth, scrollPaneHeigth)); frame.add(button); frame.add(scrollPane, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } private class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { textPane.setText("==================================================================== \n" + "==================================================================== \n" + "==================================================================== \n" + "==================================================================== \n" + "==================================================================== \n"); } } } When the button is pressed, the string is added to t…
tagged with: swing
has comment: http://stackoverflow.com/comment/31028718
type: Question
has comment: http://stackoverflow.com/comment/31028773
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20713742
has comment: http://stackoverflow.com/comment/78975228
tagged with: java
tagged with: scrollbar
answer count: 3
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/31028640
downvote count: 0
has title: How to make the horizontal scroll bar appear in a JScrollPane that contains a JTextPane component
favorite count: 0
has answer: http://stackoverflow.com/a/20713742
has comment: http://stackoverflow.com/comment/55061254
possible better answer: http://stackoverflow.com/a/20713821
has answer: http://stackoverflow.com/a/20713821

http://stackoverflow.com/a/20796898
answers question: http://stackoverflow.com/q/20796819
upvote count: 2
type: Answer
has body: When using one of the showDialog()-variants you can use showDialog(Component parent, String approveButtonText) with an approveButtonText of your choice. If you instanciate your own JFileChooser use setApproveButtonText(String approveButtonText) to change the button's text.
score: 2
downvote count: 0

http://stackoverflow.com/a/21172843
has comment: http://stackoverflow.com/comment/51156208
has comment: http://stackoverflow.com/comment/51164418
type: Answer
answers question: http://stackoverflow.com/q/20708844
upvote count: 1
has body: As we discussed in comments. The issue was because Robolectric was configured to do not intercept http requests: Robolectric.getFakeHttpLayer().interceptHttpRequests(false)
has comment: http://stackoverflow.com/comment/51118639
accepted answer of: http://stackoverflow.com/q/20708844
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/51138029

http://stackoverflow.com/a/20832885
upvote count: 4
answers question: http://stackoverflow.com/q/20832804
accepted answer of: http://stackoverflow.com/q/20832804
score: 4
has body: You will notice that ObjectMapper#readTree(..) states Method to deserialize JSON content as tree expressed using set of JsonNode instances. So this parses the JSON once. You will also notice that ObjectMapper#readValue(..) also states Method to deserialize JSON content into a non-container type (it can be an array type, however): typically a bean, array or a wrapper type (like java.lang.Boolean). So you are actually parsing your JSON twice and that probably slows you down. You can parse it once directly with mapper.readValue(responseString, typeRef)
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31020895
type: AnswerComment
comment on: http://stackoverflow.com/a/20708485
type: Comment
has text: Can you elaborate on the painting method and possibly give me an example?Can you show me the most efficient way of coding the painting method. Can you also show me how to change the position of my JTextField and JLabel.
score: 0

http://stackoverflow.com/q/20772961
upvote count: 3
has comment: http://stackoverflow.com/comment/31135494
tagged with: collections
accepted answer: http://stackoverflow.com/a/20795850
has body: I have an algorithm where I pass through nodes in a graph in a certain way, occasionally passing through the same node several times, and I need to form a list of the nodes passed, such that a node appears once for the last time I passed it. For instance, if I passed through nodes A -&gt; B -&gt; C -&gt; A -&gt; C, the list I need in the end is [B, A, C]. What I wanted to do was to use a LinkedList, such that every node in the graph will contain a reference to its node in the LinkedList. Then, every time I pass through a node, I will remove its corresponding node from the LinkedList and insert it again into the end of the LinkedList, and the complexity of the operation will only be O(1). However, when I began implementing this, I ran into a problem: apparently, the java class LinkedList does not allow me to see its actual list nodes. Using the regular remove functions of LinkedList to remove the list node containing a given graph node will be O(n) instead O(1), negating the whole point of using a LinkedList to begin with. Naturally, I can implement LinkedList myself, but I would rather avoid that - it seems to me that if I have to implement LinkedList in java, I'm doing something wrong. So, is there a way to solve this problem without implementing LinkedList on my own? Is there something that I'm missing?
type: Question
has title: How to efficiently remove an element from java LinkedList
type: AnsweredQuestion
score: 3
tagged with: performance
has comment: http://stackoverflow.com/comment/31170052
has comment: http://stackoverflow.com/comment/31135298
tagged with: java
has comment: http://stackoverflow.com/comment/31175913
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31135588
has answer: http://stackoverflow.com/a/20773521
favorite count: 0
possible better answer: http://stackoverflow.com/a/20773257
has answer: http://stackoverflow.com/a/20795850
has answer: http://stackoverflow.com/a/20773257
tagged with: linked-list

http://stackoverflow.com/comment/31201957
type: QuestionComment
type: Comment
score: 2
has text: See http://stackoverflow.com/questions/6457109/java-concurrency-is-final-field-initialized-in-constructor-thread-safe
comment on: http://stackoverflow.com/q/20810210

http://stackoverflow.com/a/20699995
has body: Well, the code you show, cannot produce this XML. I guess somewhere in your real code, there is some inheritance (A class Expression extending your Test class) which is producing this result. Seems as if the ToAttributedValueConverter does not really work for derived classes and gets ignored there. If you have a more complex object structure which you want to map to a very specific XML representation, you should use converters. In doubt you can always create a custom converter which handles the marshalling / unmarshalling. For those converters, you can easily define for which classes they should be used (see the canConvert(Class) method. I did this for you for a very similar piece of code: import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; @XStreamAlias("text") class Test { String id = "unset"; String value = "0"; } @XStreamAlias("expression") class Expression extends Test { Expression() { value = "acos(x)"; } } class ValueConverter implements Converter { @Override public boolean canConvert(Class type) { return Test.class.isAssignableFrom(type); } @Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Test src = (Test)source; writer.addAttribute("id", src.id); writer.setValue(src.value); } @Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { Test test = new Test(); test.value = reader.getValue(); test.id = reader.getAttribute("id"); return test; } } public class Example { public static void main(String[] args) { XStream xStream = new XStream(); xStream.autodetectAnnotations(true); System.out.println("BEFORE setting a conver…
answers question: http://stackoverflow.com/q/20694210
type: Answer
has comment: http://stackoverflow.com/comment/31022510
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31028760
has comment: http://stackoverflow.com/comment/31047919
has comment: http://stackoverflow.com/comment/31039201
has comment: http://stackoverflow.com/comment/31029049
downvote count: 0

http://stackoverflow.com/comment/31189530
type: AnswerComment
comment on: http://stackoverflow.com/a/20803534
type: Comment
score: 0
has text: In that case you would declare the class with `class Square implements Func<Integer, Integer> { ... }` and then use it normally: `Func<Integer, Integer> fDouble = new Square();`

http://stackoverflow.com/a/20781107
has body: It is done that way to save space. For example, if String didn't use the hash value zero to mean (not cached), then the String class would need an extra boolean flag to say that the hash value wasn't cached. So the trade-off is a one-in-4-billion probability1 of recalculating the hash every time versus one extra word for every string object. 1 - This assumed that one choses string objects randomly from the domain of all possible Java strings. Real programs don't work that way ... but the point is that the impact of recalculating the hashcode is unlikely to be significant, unless you deliberately engineer the application to that end.
has comment: http://stackoverflow.com/comment/31171224
answers question: http://stackoverflow.com/q/20779861
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31167572
has comment: http://stackoverflow.com/comment/31169686
upvote count: 1
has comment: http://stackoverflow.com/comment/31170294

http://stackoverflow.com/q/20814464
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20814593
score: 15
favorite count: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31210067
has body: I am using latest Google Maps API. My problem goes like this: I want to remove the MyLocation button (The blue dot/arrow) WITHOUT disabling MyLocation layer. if I use this code: googleMap.getUiSettings().setMyLocationButtonEnabled(false); It doesn't work, unless I add: googleMap().setMyLocationEnabled(false); but I want to keep it true. any suggestions?
has title: Android - Disable MyLocation button on google map
tagged with: java
duplicate of: http://stackoverflow.com/q/14376361
tagged with: android-maps-v2
type: Question
has comment: http://stackoverflow.com/comment/31210321
upvote count: 15
linked to: http://stackoverflow.com/q/14376361
tagged with: google-maps

http://stackoverflow.com/q/20732109
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31062605
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/31062132
tagged with: extjs
has title: JavaScript and Java RPC-style communication
has body: I want some lightweight RPC-like communication mechanism between java and javascript. I like Ext Direct and there are some pretty easy to use java implementations, but I don't want to take whole ext-js to my project. So, I'm looking for some specific java and JS lib to simplify client-server communication.
answer count: 0

http://stackoverflow.com/comment/31587898
score: 1
comment on: http://stackoverflow.com/a/20829376
type: AnswerComment
type: Comment
has text: It was a version problem. I upgraded the Jenkins to the latest version and the issue got fixed automatically.

http://stackoverflow.com/comment/30991026
comment on: http://stackoverflow.com/q/20692750
has text: If what you're trying to do is log the error (as your method name implies), then log it. Leave it to the caller whether or not to close the object.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31175979
has text: Hi Jeevan sorry to say but you cannot track others website without prior permission...there is something called robots.txt which gives you permission to scrap others website . And your competitor will never include you in robots.txt :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20795610

http://stackoverflow.com/a/59547185
answers question: http://stackoverflow.com/q/20738207
has body: In Java 12, you can call someClass.arrayType() to get the "array of someClass" class. If you need a two dimensional array, that will be someClass.arrayType().arrayType(). Of course, you can load someClass itself like Class&lt;?&gt; someClass = someClassLoader.loadClass("com.example.A"). I couldn't find a solution in the standard API of earlier Java versions, so I have written this utility method: /** * Returns the array type that corresponds to the element type and the given number of array dimensions. * If the dimension is 0, it just returns the element type as is. */ public static Class&lt;?&gt; getArrayClass(Class&lt;?&gt; elementType, int dimensions) { return dimensions == 0 ? elementType : Array.newInstance(elementType, new int[dimensions]).getClass(); } And then you can do this: Class&lt;?&gt; arrayClass = getArrayClass(someClass, 1); Kind of an ugly workaround, but... unlike with Class.forName, you control what ClassLoader is used, and you don't have to write another utility to generate funny names like "[[I" or "[Lcom.example.A;".
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31118966
type: AnswerComment
comment on: http://stackoverflow.com/a/20763639
type: Comment
score: 0
has text: Alright thanks. But that still doesn't answer the final question of the error 13.

http://stackoverflow.com/comment/31110258
has text: Depends how big your files is? If they are not so big, then yeah you can transfer them as JMS messages. If big files, you can use off-band. See this link also: http://activemq.apache.org/can-i-send-really-large-files-over-activemq.html
comment on: http://stackoverflow.com/q/20748433
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31096590
has text: could you please edit/mend the whole code? couse Im already desperate
type: Comment
comment on: http://stackoverflow.com/a/20750661
type: AnswerComment
score: 0

http://stackoverflow.com/q/20793781
tagged with: jakarta-ee
answer count: 2
downvote count: 0
score: 4
favorite count: 0
tagged with: file-io
accepted answer: http://stackoverflow.com/a/20793816
has comment: http://stackoverflow.com/comment/31172233
has title: How to get bytes/contents of each ZipFile entry from ZipInputStream without writing to outputstream?
tagged with: http://stackoverflow.com/tag/zip
has body: I am trying to get the bytes of a particular file from the zipped file input stream. I have the input stream data of the Zipped file. From this I am getting the ZipEntry and writing the contents of each ZipEntry to a output stream and returning the byte buffer. This will return the buffer size output stream, but not the contents of each particular file. Is there a way I can convert the FileOutputStream to bytes or directly read the bytes of each ZipEntry? I need to return the ZipEntry contents as output. I dont want to write to a file but just get the contents of each zip entry. Thank you for your help. public final class ArchiveUtils { private static String TEMP_DIR = "/tmp/unzip/"; public static byte[] unZipFromByteStream(byte[] data, String fileName) { ZipEntry entry = null; ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(data)); File tempDirectory = ensureTempDirectoryExists(TEMP_DIR); try { while ((entry = zis.getNextEntry()) != null) { if (!entry.isDirectory()) { System.out.println("-" + entry.getName()); File file = new File(tempDirectory + "/"+ entry.getName()); if (!new File(file.getParent()).exists()) new File(file.getParent()).mkdirs(); OutputStream out = new FileOutputStream(entry.getName()); byte[] byteBuff = new byte[1024]; int bytesRead = 0; while ((bytesRead = zis.read(byteBuff)) != -1) { out.write(byteBuff, 0, bytesRead); } out.close(); if(entry.getName().equals(fileName)){ return byteBuff; } } } } catch (Exception ex) { ex.printStackTrace(); } return null; } private static File ensureTempDirectoryExists(String outputPath) { File outputDirectory = new File(outputPath); if (!outputDirectory.exists()) { outputDirectory.mkdir(); } return outputDirectory; } }
possible better answer: http://stackoverflow.com/a/20793807
has answer: http://stackoverflow.com/a/20793807
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20793816
tagged with: inputstream
type: Question
upvote count: 4

http://stackoverflow.com/comment/31111723
type: AnswerComment
type: Comment
score: 0
has text: I don't want to project 3D points. I want to have fully three-dimensional plot with function surface AND additionally some points marked on it. In 3D as well.
comment on: http://stackoverflow.com/a/20755146

http://stackoverflow.com/a/20816158
has comment: http://stackoverflow.com/comment/31213336
has comment: http://stackoverflow.com/comment/31213275
has body: It may be a problem with you calling Thread.sleep(), which blocks the EDT. Maybe you should use a Swing Timer, or even SwingWorker if you need to perform background tasks. If there are no background tasks, I would just use a javax.swing.Timer something like this: Timer timer = new Timer(duration, new ActionListener(){ public void actionPerformed(ActionEvent e){ setVisible(false); } }); timer.setRepeats(false); timer.start(); instead of try { Thread.sleep(duration); } catch (Exception e) {} setVisible(false); Notice how I call the showSlashAndExit inside the timer also, instead in the main. Or maybe you don't want that. I'm not really sure about the flow of your program. EDit Test this program. It runs fine. It displays for 5 seconds then exits import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JWindow; import javax.swing.SwingUtilities; import javax.swing.Timer; public class Splash extends JWindow{ int duration; public Splash(int duration) { this.duration = duration; showSplash(); } public void showSplash() { setSize(300, 300); setLocationRelativeTo(null); setVisible(true); Timer timer = new Timer(duration, new ActionListener(){ public void actionPerformed(ActionEvent e) { setVisible(false); System.exit(0); } }); timer.start(); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { Splash splash = new Splash(5000); } }); } }
has comment: http://stackoverflow.com/comment/31213431
has comment: http://stackoverflow.com/comment/31213451
has comment: http://stackoverflow.com/comment/31213425
has comment: http://stackoverflow.com/comment/31213719
has comment: http://stackoverflow.com/comment/31213284
type: Answer
has comment: http://stackoverflow.com/comment/31213283
has comment: http://stackoverflow.com/comment/31214552
accepted answer of: http://stackoverflow.com/q/20816044
score: 3
has comment: http://stackoverflow.com/comment/31213243
has comment: http://stackoverflow.com/comment/31213984
upvote count: 3
answers question: http://stackoverflow.com/q/20816044
has comment: http://stackoverflow.com/comment/31213170
has comment: http://stackoverflow.com/comment/31214586
has comment: http://stackoverflow.com/comment/31214121
has comment: http://stackoverflow.com/comment/31213708
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31214622
downvote count: 0

http://stackoverflow.com/a/20802298
score: 0
answers question: http://stackoverflow.com/q/20801878
type: Answer
has comment: http://stackoverflow.com/comment/31190297
has comment: http://stackoverflow.com/comment/31257132
has body: OK.This is easy if i understand your problem. Step 1:Create setter and getter for your JList object reference. Step 2:On button click , when you open new JFrame pass your panel reference in constructor of class which inherits JFrame. Step 3:By doing this you are able to call getter method on panel reference. Step 4:Now you have reference of JList,do what you want. I hope this is best solution of your problem

http://stackoverflow.com/q/20722194
has comment: http://stackoverflow.com/comment/31044285
has comment: http://stackoverflow.com/comment/31044518
has answer: http://stackoverflow.com/a/20722613
possible better answer: http://stackoverflow.com/a/21174392
has comment: http://stackoverflow.com/comment/31046221
tagged with: java
has answer: http://stackoverflow.com/a/21174392
has comment: http://stackoverflow.com/comment/31043932
upvote count: 1
answer count: 2
has comment: http://stackoverflow.com/comment/31044176
has comment: http://stackoverflow.com/comment/31044077
tagged with: awt
has comment: http://stackoverflow.com/comment/31044590
accepted answer: http://stackoverflow.com/a/20722613
has body: I looked and the codes seems fine to me. Got an error but hopefully it's the source code, not something wrong with the cpu I have nor JDK. import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.*; import javax.swing.JFrame; public class Game extends Canvas implements Runnable { public static int width = 300; public static int height = width / 16*9; public static int scale = 3; private Thread thread; private boolean running = false; private JFrame frame; public synchronized void start() { running = true; thread = new Thread(this, "Display"); thread.start(); } public synchronized void stop() { running = false; try{ thread.join(); }catch(InterruptedException e){ e.printStackTrace(); } } public void run(){ while(running){ tick(); render(); } } public void tick() { } public void render() { BufferStrategy bs = getBufferStrategy(); if(bs==null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.setColor(Color.black); g.fillRect(0, 0, getWidth(), getHeight()); bs.dispose(); bs.show(); } public Game() { Dimension size = new Dimension(width * scale, height * scale); setPreferredSize(size); frame = new JFrame(); } public static void main(String[] args) { Game game = new Game(); game.frame.setResizable(false); game.frame.setTitle("Title"); game.frame.add(game); game.frame.pack(); game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); game.frame.setLocationRelativeTo(null); game.frame.setVisible(true); game.start(); } } Then I got this error, even when I countlessly modified the source code I had. Exception in thread "Display" java.lang.NullPointerException at java.awt.Component$BltBufferStrategy.showSubRegion(Component.java:4307) at java.awt.Component$BltBufferStrategy.show(Component.java:4255) at com.thecherno.Rain.Game.render(Game.java:58) at com.thecherno.Rain.Game.run(Game.java:39) at java.lang.Thread.run(Thread.java:695) Im starting to seem if it because of an outdated JDK. Current…
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Why Won't the Screen Change Color
favorite count: 0
type: Question
tagged with: jframe

http://stackoverflow.com/q/20817063
tagged with: java
linked to: http://stackoverflow.com/q/16571482
linked to: http://stackoverflow.com/q/4168772
score: 5
has body: Well, I was going through the Java concurrency in practice, by Brian Goetz, and found difficult to understand in different between CountDownLatch and Cyclic Barriers. It's look like both are same except that cyclic barriers can be reused ? The books says that: Latches are waiting for events, barriers are waiting for other threads This statement seems to be very confusing. Not sure if this is a misquote by the authors or it has a real meaning. Functionally they appear to be same and it isn't difficult to rewrite a better version of CountDownLatch which is re-usable with a method like reset(). Not sure of the practical life application of cyclic barriers over count down latches ? Though looks similar to one of the questions already asked on this blog ( about latches and barriers ), but this questions strives to understand some other subtleties.
favorite count: 0
has comment: http://stackoverflow.com/comment/31214544
upvote count: 5
has title: What is different between CountDownLatch and Cyclic Barriers?
type: UnansweredQuestion
answer count: 0
downvote count: 0
type: Question
duplicate of: http://stackoverflow.com/q/4168772

http://stackoverflow.com/a/20728619
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20728120
downvote count: 0
has body: You should store the name of image in drawable. In your case you should store "img" and use this code to get android Id in your app: int id = getResources().getIdentifier(elementName,"drawable", getPackageName());

http://stackoverflow.com/comment/30998154
has text: But here we are just replacing "System.out.println" with "sb.append() ".. Its making no difference whatsoever...
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20696794

http://stackoverflow.com/q/20747864
answer count: 2
accepted answer: http://stackoverflow.com/a/20747926
possible better answer: http://stackoverflow.com/a/20748114
has title: Android/Java : Is my code correct?
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: I am trying to make a simple login System. And This is the coed in database class. Is my Method correct? It should return true if both username and password are correct and false if either one of them is wrong or not in the database(not registered)? Is there any simpler way to code this method? public boolean getAccount(String name, String password) { int test = 0; database = getReadableDatabase(); String sql = "SELECT * FROM tbl_account WHERE username='name' AND password='password'"; Cursor c = database.rawQuery(sql, null); if (c.moveToFirst()) { do { if (c.getString(0).isEmpty()) { test = 0; } else if (c.getString(0).isEmpty() == false) { if (name.equals(c.getString(0))) { if (c.getString(1).isEmpty()) { test = 0; } else if (password.equals(c.getString(1))) { test = 1; } } } } while (c.moveToNext()); } if (test == 0) { return false; } else { return true; } }
has answer: http://stackoverflow.com/a/20747926
type: Question
has answer: http://stackoverflow.com/a/20748114
score: 0

http://stackoverflow.com/a/20803213
has body: Seems like you are getting JSON so why are you trying to parse SOAP? I found it complicated and almost impossible to deal with other then pure JSON responses. I had my server side responding both in SOAP (for .NET) and JSON for (Android). So here is what I use for getting the data from the remote service and to parse it (in this case as int). //This method receives 2 parameters and return string - just example... //I'm using HttpGet but there are also HttpPost objects public int getResults(String yourParameter1,String yourParameter2) { int results=0; Log.d("Webservice call:","Started"); //Creating the get URL String url= "http://my.webservice.url/targetfile.aspx?parameter1="+yourParameter1+"&amp;parameter2'"+yourParameter2; Log.d("URL:",url); HttpClient hc = new DefaultHttpClient(); HttpGet get = new HttpGet(url); String tempresult=""; Log.d("hc",hc.toString()); Log.d("post",get.getURI().toString()); try { HttpResponse rp = hc.execute(get); Log.d("rp",rp.getEntity().toString()); Log.d("rp2",rp.getStatusLine().toString()); // Get hold of the response entity HttpEntity entity = rp.getEntity(); // If the response does not enclose an entity, there is no need // to worry about connection release tempresult=rp.toString(); Log.d("tempresult",tempresult); if (entity != null) { // A Simple JSON Response Read InputStream instream = entity.getContent(); tempresult= convertStreamToString(instream); // now you have the string representation of the HTML request instream.close(); Log.d("result",tempresult.toString()); } //tempresults holding the JSON JSONObject json = new JSONObject(tempresult); //getting the "results" value results=Integer.parseInt(json.getString("result")); } catch (Exception e) { e.printStackTrace(); Log.d("error parsing JSON",e.toString()); } return results; } //This method is to handle response private static String convertStreamToString(InputStream is) { /* * To convert the InputStream to String we use the BufferedReader.readLine() * method. We iterate until…
upvote count: 1
answers question: http://stackoverflow.com/q/20795488
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20795488

http://stackoverflow.com/comment/31047998
type: AnswerComment
score: 0
has text: That's exactly what I was about to write.
comment on: http://stackoverflow.com/a/20724319
type: Comment

http://stackoverflow.com/comment/31177535
has text: So ask the service what encoding the text are, maybe you are getting the ISO-8859-1 encoding text that do not contains the 'heart' character.
type: AnswerComment
comment on: http://stackoverflow.com/a/20796560
score: 0
type: Comment

http://stackoverflow.com/q/20731679
type: Question
tagged with: for-loop
downvote count: 0
accepted answer: http://stackoverflow.com/a/20732094
has body: I have placed my JLabel.setText("__") inside a for loop so it can print the length of a word replacing each letter with a 'space' . It is for a hangman game to display the length of the word using blank spaces. However it is only printing once. Any tips on why? Also, if you have any tips on better organizing my code that would be appreciated. Thanks in advance. /*PACKAGE DECLARATION*/ package Game; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; /************************ * GAME MECHANICS CLASS * * **********************/ public class GameStructure { /* INSTANCE DECLARATIONS */ private String []wordList = {"computer","java","activity","alaska","appearance","article", "automobile","basket","birthday","canada","central","character","chicken","chosen", "cutting","daily","darkness","diagram","disappear","driving","effort","establish","exact", "establishment","fifteen","football","foreign","frequently","frighten","function","gradually", "hurried","identity","importance","impossible","invented","italian","journey","lincoln", "london","massage","minerals","outer","paint","particles","personal","physical","progress", "quarter","recognise","replace","rhythm","situation","slightly","steady","stepped", "strike","successful","sudden","terrible","traffic","unusual","volume","yesterday"}; private int []length = new int [64]; private JTextField tf;//text field instance variable (used) private JLabel jl2;//label instance variable (used) private JLabel jl3;//label instance (working on) private String letter; /***************** * LENGTH METHOD * * ***************/ public void length(){ jl3 = new JLabel(); int j = 0; for(j = 0; j&lt;64; j++) { length[j] = wordList[j].length();//gets length of words in wordList }//end for int l = 0; for(int m = 0; m&lt;length[l]; m++) {//supposed to print length of word with '__' as each letter jl3.setText("__ ");//instead only printing once l++; }//end for }//end length method /***************** * WINDOW M…
answer count: 1
favorite count: 0
tagged with: jlabel
tagged with: jframe
upvote count: 1
tagged with: swing
has title: JLabel.setText("__") will not print multiple times while in for loop
has answer: http://stackoverflow.com/a/20732094
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/20684687
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20684667
answers question: http://stackoverflow.com/q/20684667
type: Answer
score: 2
downvote count: 0
has body: Yes they do. The javadoc of the synthetic method values() states it. See JLS 8.9.2. Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows: and the javadoc for Enum.ordinal() states Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero). So if you do TestEnum.values[0] you will always get TestEnum.VALUE_A in your case.
has comment: http://stackoverflow.com/comment/30975815
upvote count: 2

http://stackoverflow.com/a/20742314
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20742257
type: Answer
answers question: http://stackoverflow.com/q/20742257
downvote count: 0
has body: They are not part of "pure" Object Oriented, but sometimes "pure" gets in the way of "getting the job done". Using primitives can make mathematical operations (in particular) much faster, and statics enable a lot of useful design patterns.
score: 3
has comment: http://stackoverflow.com/comment/31080189

http://stackoverflow.com/a/20746478
has body: i is private property in class Base so you can't access directly.This one of object oriented programming concepts. You can create getter for it In base class public int getI(){ return this.i } In BaseDemo you can call it System.out.println(objBase.getI());
upvote count: 1
answers question: http://stackoverflow.com/q/20746444
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/20750020
has comment: http://stackoverflow.com/comment/31094866
favorite count: 0
linked to: http://stackoverflow.com/q/10073025
has title: Java: Which is faster? Local variables or accessing encapsulation?
has body: I recently read a StackOverflow question that indicated, when accessing variables, it is faster to use the stack than the heap: void f() { int x = 123; // &lt;- located in stack } int x; // &lt;- located in heap void f() { x = 123 } However, I can't work it through my head which is faster in my example (since I assume they are both using the stack). I'm working on hitbox calculation and such, which uses alot of X-Y, width, height variables (up to 10-20 times for each) in the function. Is it faster to use an object's get() method each time or set it to a local variable at the start of the function? In code, is it faster to (or more efficient to): void f() { doSomething(foo.getValue() + bar.getValue()); doSomethingElse(foo.getValue(), bar.getValue()); doAnotherThing(foo.getValue(), bar.getValue()); // ... &lt;- lot's of accessing (something.getValue()); } or void g() { int firstInt = foo.getValue(); int secondInt = bar.getValue(); doSomething(firstInt + secondInt); doSomethingElse(firstInt, secondInt); doAnotherThing(firstInt, secondInt); // ... &lt;- lot's of accessing firstInt and secondInt } when foo and bar are MyObject's public class MyObject { int x = 1; public int getValue() { return x; } } If they are about the same efficiency, how many times do I have to perform a .getValue() for it to become less efficient? Thanks in advance!
has comment: http://stackoverflow.com/comment/31095143
has answer: http://stackoverflow.com/a/41826174
has comment: http://stackoverflow.com/comment/31095176
has comment: http://stackoverflow.com/comment/31094613
has comment: http://stackoverflow.com/comment/31095567
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20750074
linked to: http://stackoverflow.com/q/17703539
tagged with: java
has comment: http://stackoverflow.com/comment/31094525
type: Question
score: 5
has answer: http://stackoverflow.com/a/20750074
tagged with: performance
has comment: http://stackoverflow.com/comment/31094529
upvote count: 5
tagged with: encapsulation
possible better answer: http://stackoverflow.com/a/41826174
tagged with: optimization
answer count: 2
has comment: http://stackoverflow.com/comment/31095933
downvote count: 0
tagged with: variables
linked to: http://stackoverflow.com/q/504103

http://stackoverflow.com/comment/31090748
type: QuestionComment
has text: @CommonsWare is there anything to replace String.valueOf ? to avoid strings ?
comment on: http://stackoverflow.com/q/20746940
score: 0
type: Comment

http://stackoverflow.com/q/20847847
tagged with: criteriaquery
type: Question
accepted answer: http://stackoverflow.com/a/20848388
tagged with: java
tagged with: mysql
linked to: http://stackoverflow.com/q/11573591
tagged with: nativequery
score: 2
answer count: 1
tagged with: jpa
downvote count: 0
has title: Complex criteria query: using JPA instead of NativeQuery
favorite count: 0
has answer: http://stackoverflow.com/a/20848388
type: AnsweredQuestion
upvote count: 2
has body: I've in my Java EE project this NativeQuery for MySQL: SELECT *, ROUND((price_2-price_1)*100/price_1,2) AS varprice_1, ROUND((quantity_2-quantity_1)*100/quantity_1,2) AS varcant_1, ROUND((price_3-price_2)*100/price_2,2) AS varprice_2, ROUND((quantity_3-quantity_2)*100/quantity_2,2) AS varcant_2, 1 FROM ( SELECT c.id_customer AS id_customer, c.name AS customer, r.id_rep AS id_rep, r.descr AS rep, a.id_article AS id_article, a.name AS article, ROUND(SUM(if(docdate BETWEEN '2013-06-30' AND '2013-12-30',quantity ,0)),2) AS quantity_1, ROUND(SUM(if(docdate BETWEEN '2013-06-30' AND '2013-12-30',net_price,0)),2) AS price_1, ROUND(SUM(if(docdate BETWEEN '2012-06-30' AND '2012-12-30',quantity ,0)),2) AS quantity_2, ROUND(SUM(if(docdate BETWEEN '2012-06-30' AND '2012-12-30',net_price,0)),2) AS price_2, ROUND(SUM(if(docdate BETWEEN '2011-06-30' AND '2011-12-30',quantity ,0)),2) AS quantity_3, ROUND(SUM(if(docdate BETWEEN '2011-06-30' AND '2011-12-30',net_price,0)),2) AS price_3, 1 FROM documento d RIGHT JOIN pedido_cabezal pc ON d.id_documento = pc.id_documento LEFT JOIN pedido_linea pl ON pc.id_documento = pl.id_documento LEFT JOIN article a ON pl.id_article = a.id_article LEFT JOIN customer c ON pc.id_customer=c.id_customer LEFT JOIN rep r ON c.id_rep=r.id_rep WHERE ( (docdate BETWEEN '2013-06-30' AND '2013-12-30') OR (docdate BETWEEN '2012-06-30' AND '2012-12-30') OR (docdate BETWEEN '2011-06-30' AND '2012-12-30') ) GROUP BY a.id_article ) subq ORDER BY price_1 DESC this is a dinamically generated query, depending on user input. I don't like using native queries so I'm using it for now and I'm planning to change it with a criteria query, but I need help: I cannot figure out how this kind of queries can be substituted by a criteria query. Is there a way or it's ok to use native queries in cases like this and I should stop worrying about it? Thank you

http://stackoverflow.com/q/20781518
has comment: http://stackoverflow.com/comment/31160197
has comment: http://stackoverflow.com/comment/31150365
has body: I have an application written on Grails. I have some validation rules on server side, for instance. if(fieldB.value &gt; fieldC.value) { setMandatory(fieldA); } ...... I don't want to repeat validation logic on client side too, because of complexity. My question is: how can I use the same logic in client side and is there any technology with the help of which I can implement this concept ? p.s. I'm not familiar with MVC frameworks like angularjs, emberjs. Is it possible to do this with mentioned frameworks ?
upvote count: 3
downvote count: 1
type: Question
tagged with: java
tagged with: grails
tagged with: validation
answer count: 1
has comment: http://stackoverflow.com/comment/31150309
favorite count: 0
has answer: http://stackoverflow.com/a/20792945
tagged with: angularjs
type: UnansweredQuestion
tagged with: ember.js
score: 2
has comment: http://stackoverflow.com/comment/31152916
has title: Use same logic for client and server side validations

http://stackoverflow.com/comment/31292482
has text: StandardAnalyzer drops function words, you need to see what it is indexing . Or you need to QueryParser with Stabdard analyzer to run your query so that your query is also processed same way.
type: AnswerComment
comment on: http://stackoverflow.com/a/20846896
score: 0
type: Comment

http://stackoverflow.com/q/20756031
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: we have small project which is written in struts. At one place I see couple of action class calls one static helper method from static class. This the structure of the code MyAction implements ServletRequestAware{ // this is the SMD method which we are calling from client side buildCode() { Map&lt;String, String&gt; code = StaticHelper.validateAndGetCode(); } }` `StaticHelper { public Map&lt;String, String &gt;static validateAndGetCode() { initialzeVaiable(){ // here all the values are set to the empty values before build the // return map .... } } } StaticHelper have different static variables which are specific to each request. My question here does this is good design approach. Since variable are static in the class is their any possibility these might be goofed up when their are multiple request.
type: Question
has answer: http://stackoverflow.com/a/20756177
downvote count: 0
has title: Static helper class in struts action
accepted answer: http://stackoverflow.com/a/20756177
tagged with: struts2
answer count: 1

http://stackoverflow.com/comment/31206763
comment on: http://stackoverflow.com/a/20809013
type: Comment
has text: Yeah, don't get me wrong: EA sure is the major contributor to the cause. However, whatever EA can do is further improved by DCE. If you look into the assembly for ```newChar_DCE```, you will find ```charAt()``` partially DCE-d.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20762283
has comment: http://stackoverflow.com/comment/31115985
has comment: http://stackoverflow.com/comment/31116084
tagged with: eclipse
has body: In my case I have this to manipulate a shallow copy of given HashMap public class SomeClass { private HashMap&lt;String, String&gt; hashMap; public SomeClass( private HashMap&lt;String, String&gt; hashMap ) { this.hashMap = (HashMap&lt;String, String&gt;) hashMap.clone(); } } However eclipse suggests me to extract to local variable or method or add a cast and when I do so it keeps suggesting me same solutions :) I've came to this post and from the accepted answer I dont find it very clear "you're wasting memory with the new HashMap creation call" And when I apply that to my code I'll have if(songData.clone() instanceof HashMap) { this.songData = (HashMap&lt;String, String&gt;) songData.clone(); } I find that cosume more process as calling clone() twice. Is there a better way to do this? Could my snippet be harmful to resouces?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20762935
tagged with: shallow-copy
has answer: http://stackoverflow.com/a/20762935
has comment: http://stackoverflow.com/comment/31116159
has comment: http://stackoverflow.com/comment/31116095
linked to: http://stackoverflow.com/q/262367
has title: Eclipse warning "Type safety: Unchecked cast" has got recursive solutions
type: Question
type: AnsweredQuestion
tagged with: performance
tagged with: hashmap
tagged with: java
linked to: http://stackoverflow.com/q/2356809

http://stackoverflow.com/q/20719056
score: 1
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/20720588
upvote count: 1
tagged with: runjettyrun
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20720588
tagged with: atmosphere
downvote count: 0
has body: I'm trying to get the chat sample running from atmosphere-samples But I'm getting the following error in the console GET http://localhost:8080/javascript/atmosphere.js 404 (Not Found) When I look at the source for samples/chat I can't see atmosphere.js in the code. I'm guessing this file should be coming from one of the atmosphere jars? I was expecting to see it in src/main/webapp/javascript but it's not. I've done the following steps Checkout from git (git checkout https://github.com/Atmosphere/atmosphere-samples.git) Switch to latest stable branch (git checkout atmosphere-samples-project-2.0.5) Import samples/chat as an "existing maven project" in eclipse (using m2e plugin) Setup jetty run target (RunJettyRun) Go to http://localhost:8080/&lt;context&gt; in a browser. Note, I see the webapp running, it's just causing javascript errors because of the 404.
tagged with: maven
has title: Atmosphere Samples: Can't get chat demo working (atmosphere.js gives 404)
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/20750118
possible better answer: http://stackoverflow.com/a/20750615
has body: I started developing for Android yesterday, so I am a complete newbie. I am using ADT bundle that works with Eclipse. What I want to do is I have got an array of strings. I would like to display them in a scroll supported view. I found ListView can do that but all tutorials that I found are extremely complex and explaining nested views. I tried using ListView but I cannot even see the dummy view. Here is what I have tried: activity_main.xml: &lt;ListView android:id="@+id/wifiScanResList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/wifiScanButton" &gt; &lt;/ListView&gt; in MainActivity Class: private ListView wifiListView; @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); wifiListView = (ListView) findViewById(R.id.wifiScanResList); wifiListView.setEnabled(true); return true; } I have got two questions in regards to my problem now. First one is, am I using the right view for my needs? If not what should I use? Second one is, what is the reason that dummy view does not appear? Also how can I simply add strings into ListView?
has answer: http://stackoverflow.com/a/20750615
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20750202
accepted answer: http://stackoverflow.com/a/20750202
score: 5
has comment: http://stackoverflow.com/comment/31094908
tagged with: listview
has title: Displaying list of strings in Android
answer count: 2
tagged with: user-interface
favorite count: 0
upvote count: 5
tagged with: android

http://stackoverflow.com/q/20835858
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: Eclipselink JPA object com.test.entity.ReminderConfiguration@5d035a33 is not a known entity type
type: Question
tagged with: eclipselink
tagged with: jpa
has comment: http://stackoverflow.com/comment/31309808
score: 0
has comment: http://stackoverflow.com/comment/31340170
has comment: http://stackoverflow.com/comment/31258449
has body: I have seen a lot of questions about this issue, but no solution suits for me. Also I get this error only if I try to persist object. I am getting following error java.lang.IllegalArgumentException: Object: com.test.entity.ReminderConfiguration@5d035a33 is not a known entity type. at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4222) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:496) at com.test.TestController.confirmAction(AppointmentController.java:668) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor$Worker.runTa…

http://stackoverflow.com/comment/31023310
comment on: http://stackoverflow.com/q/20710946
score: 0
type: Comment
type: QuestionComment
has text: Instead of saying "Project euler question," please tell us what problem you are trying to solve.

http://stackoverflow.com/q/20799326
has comment: http://stackoverflow.com/comment/31246243
has answer: http://stackoverflow.com/a/53103409
has answer: http://stackoverflow.com/a/37720261
downvote count: 0
has comment: http://stackoverflow.com/comment/31365798
linked to: http://stackoverflow.com/q/11212652
has title: java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions;
answer count: 3
upvote count: 6
has answer: http://stackoverflow.com/a/20799455
favorite count: 0
has comment: http://stackoverflow.com/comment/31182019
tagged with: xmlbeans
has comment: http://stackoverflow.com/comment/31186652
has comment: http://stackoverflow.com/comment/31263917
type: UnansweredQuestion
score: 6
has body: I am trying to write a program which write the data in Excel. But i keep getting an error which is shown below: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions; at org.apache.poi.POIXMLDocumentPart.&lt;clinit&gt;(POIXMLDocumentPart.java:56) at wriExcel.main(wriExcel.java:19) On finding the solutions, I could only find that I should use XMLBeans 2.0 or higher. But, I am using xmlbeans 2.3.0. Is there any other reason for this error.
tagged with: java
type: Question

http://stackoverflow.com/comment/75433597
score: 0
type: Comment
has text: EndpointConfiguration endpointConfiguration = new EndpointConfiguration("ec2.us-west-2.amazonaws.com","us-west-2"); ec2 = AmazonEC2ClientBuilder.standard() .withEndpointConfiguration(endpointConfiguration) .build();
comment on: http://stackoverflow.com/a/20725534
type: AnswerComment

http://stackoverflow.com/comment/31090387
comment on: http://stackoverflow.com/q/20747529
has text: If you print to a file, make sure you specify an encoding that will display it properly. Ultimately I think it is an encoding issue.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31167430
type: Comment
comment on: http://stackoverflow.com/a/20787192
type: AnswerComment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ whats that ?
score: 0

http://stackoverflow.com/a/20708007
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20705065
type: Answer
answers question: http://stackoverflow.com/q/20705065
score: 2
has body: If it is an RCP (Rich Client Platform) application then it should be using SWT (not Swing) and you can do automation tasks using SWTBot.
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20766876
duplicate of: http://stackoverflow.com/q/355167
tagged with: android
has comment: http://stackoverflow.com/comment/31124609
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20766918
score: 0
has body: second day in android self teachin and saw this code bleow. from what I understood, it seems to me that the code is getting the button value final Button GetServerData = (Button) findViewById(R.id.GetServerData); and then I am not sure what happened. Being from php background this syntax looks very unfamiliar that a method is being called as a methods parameter in here GetServerData.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // WebServer Request URL String serverURL = "http://androidexample.com/media/webservice/JsonReturn.php"; // Use AsyncTask execute Method To Prevent ANR Problem new LongOperation().execute(serverURL); } }); I also am not sure what View arg0 is. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.rest_ful_webservice); final Button GetServerData = (Button) findViewById(R.id.GetServerData); GetServerData.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // WebServer Request URL String serverURL = "http://androidexample.com/media/webservice/JsonReturn.php"; // Use AsyncTask execute Method To Prevent ANR Problem new LongOperation().execute(serverURL); } }); }
answer count: 1
linked to: http://stackoverflow.com/q/355167
has title: code explaination. method within method and some other syntax
has answer: http://stackoverflow.com/a/20766918

http://stackoverflow.com/comment/31099947
type: QuestionComment
comment on: http://stackoverflow.com/q/20752781
has text: Note for those who are curious, replacing `<M>` with `<M extends Number>` in the later allows it to compile as well.
score: 0
type: Comment

http://stackoverflow.com/q/20828143
has answer: http://stackoverflow.com/a/20828222
type: Question
has comment: http://stackoverflow.com/comment/31235269
has title: Long binary string arithmetic in java
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/31235374
linked to: http://stackoverflow.com/q/17833463
has body: I'm doing a program, server based, that I want to multiply 2 binary strings together. these strings are quite long, so they arent transferable into long or int types. an example of one of these strings is: 01100010 00110110 00110011 00110111 00110100 00111001 00111001 00111001 00110110 01100011 00110110 01100101 00111001 00110011 00110011 00110010 00110010 00110010 01100001 00110101 01100100 01100011 01100011 01100010 01100100 00111000 01100100 01100100 00110010 00110110 00110110 00110100 00111000 01100110 00110001 00110100 00110110 01100110 01100110 01100100 00110100 00110101 00110100 01100010 01100010 00111001 00111001 00110110 01100110 01100010 00111000 00110011 00110000 00110011 00110010 01100110 01100010 00110001 01100010 01100001 00110100 01100011 01100011 00111000 00110110 00110111 01100110 00110001 00111001 00110110 00110110 00110001 00110001 01100101 00110010 00111000 01100100 01100110 01100110 01100001 01100100 00110100 00110110 00110000 00110010 00111001 00111001 00110011 00111000 01100001 00111001 00110111 00110111 00110011 00110010 01100011 00110100 00110000 01100011 01100101 01100010 01100011 01100011 00110101 01100110 00110111 00110000 00110110 00110000 00110110 00110101 01100101 01100001 01100100 00110011 01100100 00110100 01100110 01100110 00110111 00110110 00110011 00110111 00110100 00111001 00111001 00111001 00110000 00110001 00111001 01100001 01100010 01100101 00110011 00110010 00111001 01100011 01100110 01100101 00110011 00110010 01100011 01100011 00110010 00111000 00110110 00110001 01100001 00110111 00110110 00110101 01100010 this string can have the spaces, or not. it doesnt matter. my problem is, how do i multiply, lets say, 01100011 with this string? the length of the multiplier is variable, so flexibility would be a must. Thanks in advance!
has answer: http://stackoverflow.com/a/20828198
has answer: http://stackoverflow.com/a/20828230
linked to: http://stackoverflow.com/q/20761983
downvote count: 0
possible better answer: http://stackoverflow.com/a/20828198
has comment: http://stackoverflow.com/comment/31235397
accepted answer: http://stackoverflow.com/a/20828222
tagged with: string
has answer: http://stackoverflow.com/a/20828232
favorite count: 0
tagged with: binary
answer count: 4
score: 2
type: AnsweredQuestion
upvote count: 2
linked to: http://stackoverflow.com/q/3877765
has comment: http://stackoverflow.com/comment/31235340

http://stackoverflow.com/comment/31042055
type: AnswerComment
has text: Please don't answer questions with questions, leave it as a comment
type: Comment
comment on: http://stackoverflow.com/a/20721081
score: 0

http://stackoverflow.com/q/20717402
tagged with: timer
accepted answer: http://stackoverflow.com/a/20717488
tagged with: android
type: AnsweredQuestion
upvote count: 3
tagged with: multithreading
has title: Android: Pause/Resume Timer OR Thread
type: Question
score: 3
has answer: http://stackoverflow.com/a/20717488
tagged with: java
has body: I have checked all SO answers about how to pause/resume timer, but can't find a solution. I have created a Timer task which counts the effort time for an employee and puts it inside a TextView to show. Code below: Timer T = new Timer(); T.scheduleAtFixedRate(new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { String workingTime = "Your effort is " + format.format(Double.valueOf(hr)) + ":" + format.format(Double.valueOf(min)) + ":" + format.format(Double.valueOf(sec)) + " till now for the day"; storeEffort.setText(workingTime); sec++; if (sec &gt; 59) { sec = 0; min = min + 1; } if (min &gt; 59) { min = 0; hr = hr + 1; } } }); } }, 1000, 1000); where storeEffort is my TextView which shows the effort time which is stuck inside the running thread(main problem). I want to pause the effort timer with a button click and resume it when the same button clicked again.Is there any other way to do this kind of task?
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/20717478
favorite count: 0
has answer: http://stackoverflow.com/a/20717478

http://stackoverflow.com/q/20680482
has answer: http://stackoverflow.com/a/20683235
possible better answer: http://stackoverflow.com/a/20680731
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20680731
linked to: http://stackoverflow.com/q/6592192
tagged with: java
type: Question
has title: Sorting integer in jtable
downvote count: 0
accepted answer: http://stackoverflow.com/a/20683235
favorite count: 0
tagged with: jtable
answer count: 3
tagged with: integer
has body: when i click the 'Price' radiobutton it sorts the Price Row but in this order 1 11 12 13 2 21 200 3 32 300 how can i fix it? im still new in java. please help me. thanks. :D rdbtnNewRadioButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultRowSorter sorter = ((DefaultRowSorter)table.getRowSorter()); List &lt;RowSorter.SortKey&gt; sortKeys = new ArrayList&lt;RowSorter.SortKey&gt;(); sortKeys.add(new RowSorter.SortKey(4, SortOrder.ASCENDING)); sorter.setSortKeys(sortKeys); } });
has answer: http://stackoverflow.com/a/20680554
upvote count: 3
tagged with: swing
tagged with: rowsorter

http://stackoverflow.com/comment/31219812
type: Comment
score: 1
type: AnswerComment
has text: Yeah, all threads are started and they have no loops so they are guaranteed to finish. Actually, I appear to have exactly this problem: http://stackoverflow.com/questions/6445052/android-context-memory-leak-listview-due-to-audiomanager but it has no resolution.
comment on: http://stackoverflow.com/a/20808264

http://stackoverflow.com/a/20743159
accepted answer of: http://stackoverflow.com/q/20743120
answers question: http://stackoverflow.com/q/20743120
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31082514
score: 0
type: AcceptedAnswer
has body: I'm not entirely sure what you want to achieve, but to get it compile, simply add implicit constructor to class a: class a { public a(int x) { System.out.println(x); } public a() { // implicit constructor } } Since b extends a and doesn't call the super constructor, implicit constructor of a is called "behind the scene". Therefore a must provide one.
has comment: http://stackoverflow.com/comment/31082530
has comment: http://stackoverflow.com/comment/31083623
type: Answer

http://stackoverflow.com/q/20713592
has answer: http://stackoverflow.com/a/23766707
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31034296
type: AnsweredQuestion
tagged with: dll
tagged with: java-native-interface
tagged with: java
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/23766707
accepted answer: http://stackoverflow.com/a/24587998
score: 5
has body: I have looked for a solution, but all the ones I found didn't work. I have triple checked that I have both 64 bit JRE/JDK and Eclipse I have added the '-vm' argument to the eclipse.ini file. Here's the file content: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835 -product org.eclipse.epp.package.standard.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vm C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m EDIT: It works now, the vm argument was pointed to the wrong file!
has answer: http://stackoverflow.com/a/33539332
has answer: http://stackoverflow.com/a/24587998
answer count: 3
has comment: http://stackoverflow.com/comment/31028648
has title: 'Failed to load the JNI shared library "C:\Program Files\Java\jre7\bin\client\jvm.dll" '
tagged with: shared-libraries
favorite count: 0

http://stackoverflow.com/a/20715932
accepted answer of: http://stackoverflow.com/q/20715925
has comment: http://stackoverflow.com/comment/31032729
has comment: http://stackoverflow.com/comment/31032722
type: Answer
has body: Read the Swing tutorial on Custom Painting for an explanation on how painting works. Hint, you should NOT be overriding paint() and you should NOT be doing custom painting on a JFrame.
upvote count: 2
has comment: http://stackoverflow.com/comment/31032706
answers question: http://stackoverflow.com/q/20715925
score: 2
has comment: http://stackoverflow.com/comment/31032685
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20765872
has comment: http://stackoverflow.com/comment/31123167
type: Question
has answer: http://stackoverflow.com/a/20804431
tagged with: handler
answer count: 1
tagged with: javascript
has comment: http://stackoverflow.com/comment/31127349
has body: A project I am working with implements three JAVA script "timers" from a Master Page to track the session time out and to do a "heartbeat" check. The "setTimerout" timer redirects the user to a warning page if the time out count reaches 1 and a half minutes before a session time out will occur. The two "setInterval" timers are implemented to track if the user's browser is sill active on the site. Following are several code snippets that implement the "timers" and the "Heartbeat" and "Heartbeat Check" handlers. Master Page code to activate timers: Dim BaseAccountTimeout As Single = CType((CType(CurrentSessionTimeout, Single) - 1.5), Single) If Session.Item("UseSessionTimeout") Then Dim TimeoutAcount As String = CType(((BaseAccountTimeout * 60) * 1000), Integer).ToString Page.ClientScript.RegisterStartupScript(Me.GetType, "TimeoutScript", "setTimeout(""top.location.href = '" &amp; GotoTimeoutPage &amp; "'""," &amp; TimeoutAcount &amp; ");", True) End If If Session.Item("UseHeartBeat") Then Dim BaseHeartBeatTimeout As Single = CType(CurrentHeartBeatTimeout, Single) Dim BaseHeartBeatCheckTimeout As Single = CType((BaseHeartBeatTimeout + 1.5), Single) Dim TimeoutHeartBeat As String = CType(((BaseHeartBeatTimeout * 60) * 1000), Integer).ToString Dim TimeoutHeartBeatCheck As String = CType(((BaseHeartBeatCheckTimeout * 60) * 1000), Integer).ToString Page.ClientScript.RegisterStartupScript(Me.GetType, "HeartBeatScript", "setInterval(""ajax.post('/pages/heartbeat.ashx', {id: '" + Session.SessionID + "'}, function() {})""," &amp; TimeoutHeartBeat &amp; ");", True) Page.ClientScript.RegisterStartupScript(Me.GetType, "HeartBeatCheckScript", "setInterval(""ajax.post('/pages/heartbeatcheck.ashx', {id: '" + Session.SessionID + "'}, function() {})""," &amp; TimeoutHeartBeatCheck &amp; ");", True) End If Heartbeat handler code: &lt;%@ webhandler language="VB" class="HeartbeatHandler" %&gt; Imports System Imports System.Web Imports System.Data Imports System.Data.SqlClient Public Cla…
score: 0
has title: Scripting events no longer fire when a user leaves site or closes browser even though app is still active
has comment: http://stackoverflow.com/comment/31127330
tagged with: asp.net
tagged with: timer
has comment: http://stackoverflow.com/comment/31127294
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31122721

http://stackoverflow.com/a/20825783
type: Answer
answers question: http://stackoverflow.com/q/20825560
score: 0
has body: One easy way that comes to my mind would be as follows... Create a hashMap Object where the key is a string (the country) and the value is an integer (number of cities found for the country) so it would be something like Map countryResultsFoundMap = new HashMap&lt; String,Integer>(); In short, for each row you would pick the country, (I would recommend that you .trim() and .toLowerCase() the value first) and check if it is existing in the hashMap, if not, add the entry like countryResultsFoundMap.put(country,0), otherwise, if the country already exists the pick the value from the hashMAp and add +1 to its integer value. Eventually you will have all the values stored in the map and you can have access to that data for your calculations. Hope that helps

http://stackoverflow.com/comment/31273392
comment on: http://stackoverflow.com/q/20848442
has text: Doing that, you will only update the world, if you update it faster, it doesn't mean it will be faster. Set a global variabile that is initialized with 1, and in every place you want your game to speed up, add *speed . And increment this value with that button
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31212724
comment on: http://stackoverflow.com/a/20811406
has text: This is not at all a relevant answer to the question.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20806427
type: UnansweredQuestion
tagged with: lwjgl
has body: I am developing a race game in java using jbullet and lwjgl.I am currently having trouble in making my camera follow the vehicle.Here is my code.It follows the car until it rotates.Here is the code.Can someone tell me what i am doing wrong ?! import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT; import static org.lwjgl.opengl.GL11.GL_FRONT_AND_BACK; import static org.lwjgl.opengl.GL11.GL_LINE; import static org.lwjgl.opengl.GL11.GL_QUADS; import static org.lwjgl.opengl.GL11.glBegin; import static org.lwjgl.opengl.GL11.glCallList; import static org.lwjgl.opengl.GL11.glClear; import static org.lwjgl.opengl.GL11.glColor3f; import static org.lwjgl.opengl.GL11.glEnd; import static org.lwjgl.opengl.GL11.glLoadIdentity; import static org.lwjgl.opengl.GL11.glPolygonMode; import static org.lwjgl.opengl.GL11.glPopMatrix; import static org.lwjgl.opengl.GL11.glPushMatrix; import static org.lwjgl.opengl.GL11.glTranslated; import static org.lwjgl.opengl.GL11.*; import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import javax.vecmath.Matrix4f; import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; import model.Vehicle; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import utility.LWJGLTimer; import utility.LookAtCamera; import utility.Model; import utility.OBJLoader; import utility.TerrainLoader; import com.bulletphysics.collision.broadphase.BroadphaseInterface; import com.bulletphysics.collision.broadphase.DbvtBroadphase; import com.bulletphysics.collision.dispatch.CollisionConfiguration; import com.bulletphysics.collision.dispatch.CollisionDispatcher; import com.bulletphysics.collision.dispatch.CollisionObject; import com.bulletphysics.collision.dispatch.CollisionWorld; import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; impo…
type: Question
has title: Third Person Camera using JBullet and lwjgl
tagged with: camera
tagged with: java
downvote count: 0
favorite count: 0
tagged with: jbullet
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/31250299
comment on: http://stackoverflow.com/a/20836163
type: AnswerComment
score: 0
type: Comment
has text: The class name is Customer, not customer.

http://stackoverflow.com/comment/31126289
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20767732
has text: I think what you're looking for is a web scraper, take a look at this question (and answer): http://stackoverflow.com/questions/3202305/web-scraping-with-java

http://stackoverflow.com/comment/31162082
score: 1
type: Comment
type: QuestionComment
has text: You have omitted ***all*** the relevant details: the definition of `transactions` and its `get()` method, the definition of the class of objects returned by `transactions.get()` and how it implements its own `get()`, code showing how `transactions` was populated, the values of `row` and `idx`... `i` isn't even used inside the loop.
comment on: http://stackoverflow.com/q/20788265

http://stackoverflow.com/q/20819240
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
type: Question
tagged with: jakarta-ee
has body: I have a really simple and stupid question. I have a dynamic web application in eclipse that I am trying to convert to a WAR file and haven't had much luck finding the answer on the net. It is not a maven project, just a regular dynamic web application created from start. Surprisingly this is proving to be an annoying little task It is deployed with Tomcat. I don't know if that makes any difference. Thanks for everyone's assistance.
tagged with: tomcat
has title: How do I convert a dynamic web application to a war
upvote count: 1
has answer: http://stackoverflow.com/a/20819261
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/20831550
answers question: http://stackoverflow.com/q/20831457
type: Answer
downvote count: 0
score: 1
has body: you need to override the doPost() method and call your processRequest() inside it. @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
upvote count: 1

http://stackoverflow.com/q/20842729
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31691104
tagged with: encoding
score: 2
downvote count: 0
answer count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31309676
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31274708
upvote count: 2
has comment: http://stackoverflow.com/comment/31263792
has title: encoding japanese character in tomcat and in Java Deskop Produce Different result
has body: i have a question, why java desktop and webapps produce different result? for example i have to encode this String 秋田県秋田市山手台２ i have split that String into int array to be coded as Char the result is 31179 30000 30476 31179 30000 24066 23665 25163 21488 65298 and i encode it with WebApp in tomcat (no framework) with this QUery String ?x=秋田県秋田市山手台２ the code is protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int[] r = {31179, 30000, 30476, 31179, 30000, 24066, 23665, 25163, 21488, 65298}; StringBuilder sb = new StringBuilder(); for (int i = 0; i < r.length; i++) { int j = r[i]; sb.append((char) j); } System.out.println(sb.toString()); } the result is ???????? but when i decode it with Java Desktop with this code public static void main(String[] args) throws UnsupportedEncodingException { int[] r = {31179, 30000, 30476, 31179, 30000, 24066, 23665, 25163, 21488, 65298}; StringBuilder sb = new StringBuilder(); for (int i = 0; i < r.length; i++) { int j = r[i]; sb.append((char)j); } System.out.println(sb.toString()); } the result is 秋田県秋田市山手台２ why that can be different ? is that something wrong? i have tried with URLEncode utf-8 and it did same i have search it on google that i have to change the Server.xml in conf directory the XML is here <?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, e…
has comment: http://stackoverflow.com/comment/31262728
tagged with: java

http://stackoverflow.com/comment/31151684
comment on: http://stackoverflow.com/a/20782376
score: 0
type: AnswerComment
has text: The "allowable difference" is defined by the precision of the numbers, the multiplier is not necessarily constant.
type: Comment

http://stackoverflow.com/q/20696194
tagged with: libgdx
has comment: http://stackoverflow.com/comment/30997343
answer count: 2
accepted answer: http://stackoverflow.com/a/20698078
downvote count: 0
has body: Ok I have googled the hell out of this issue, but I can not for the life of me fix my issue. First off I am using eclipse making a game within the libGDX framework. I have imported kryonet within my projects. It works when I compile for the PC. My issue is when I compile for the Android, it gives me this error: Dx trouble writing output: already prepared [Dex Loader] Unable to execute dex: Multiple dex files define Lcom/esotericsoftware/jsonbeans/Json$FieldMetadata; [-android] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/esotericsoftware/jsonbeans/Json$FieldMetadata; I have done everything I can, I have added the libraries to my build list in my android project, I have added them to the /lib folder for the android project. I deleted my DEX folder. I cleaned my build and restarted. my /gen is above my /src in my order and export I am clearly missing something basic. I have spent all today googling this. List of library .JARs i am using relating to Kryonet: asm jsonbeans junit kryo kryo-debug minlog minlog-none objenesis reflectasm Can someone please help me out? Thank you :) -edit- if I remove jsonbean I get [2013-12-19 22:35:43 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/esotericsoftware/kryo/ClassResolver; [2013-12-19 22:35:43] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/esotericsoftware/kryo/ClassResolver;
tagged with: kryonet
favorite count: 0
upvote count: 2
tagged with: android
has title: Trying to get Kryonet to work with Android
has answer: http://stackoverflow.com/a/20696349
type: AnsweredQuestion
score: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/20696349
has answer: http://stackoverflow.com/a/20698078
type: Question

http://stackoverflow.com/comment/30986198
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20690186
score: 6
has text: @user3120480:- The same link gave the hint:- `On Eclipse, I just went to Preferences > Java > Compiler and then set "Compiler compliance level" to 1.6.`

http://stackoverflow.com/comment/31076882
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20739627
type: Comment
has text: Why won't there be anything to read? My theory was that on the second iteration, it gets opened back and asks for value provided again. Why isn't this the case?

http://stackoverflow.com/comment/31271593
has text: Always format your code correctly with proper indentation, and `String` is not `char[]` in java. `String` itself is a data type and `char[]` is another type and `char` literal are specified with single quote around them and String literal is specified with double quote around them: `'a'` is `char` but `"a"` is of type `String`
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20847550

http://stackoverflow.com/q/20820251
type: Question
has body: Sorry for the not-very professional question but I am new in Java and thread programming concept. If thread is sleep or waitting, is it alive or not? What would return thread.isAlive() True ore False in these two cases?
accepted answer: http://stackoverflow.com/a/20820265
has answer: http://stackoverflow.com/a/20820274
score: -2
has comment: http://stackoverflow.com/comment/31221912
has answer: http://stackoverflow.com/a/20820265
answer count: 2
has comment: http://stackoverflow.com/comment/31220682
linked to: http://stackoverflow.com/q/17293304
favorite count: 0
possible better answer: http://stackoverflow.com/a/20820274
has comment: http://stackoverflow.com/comment/31221930
tagged with: multithreading
type: AnsweredQuestion
upvote count: 0
has title: When is really alive a thread in java?
tagged with: java
downvote count: 2

http://stackoverflow.com/a/20828673
has body: Classpath has nothing to do with where your source files are located, it points to where necessary already compiled class files and jar files are located. If you want to be in the Desktop dir and compile src/Hello.java, just do; javac -cp ./src src/Hello.java or plain javac src/Hello.java
answers question: http://stackoverflow.com/q/20828625
score: 0
accepted answer of: http://stackoverflow.com/q/20828625
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/107909325
comment on: http://stackoverflow.com/a/27406064
type: AnswerComment
type: Comment
has text: All of the answers here helped me a lot. This pattern is one we are using and it makes it easy for people working in teams to just drop JARs into that directory when working on branches.
score: 1

http://stackoverflow.com/comment/31060201
type: Comment
has text: I've wrapped the code like you said, and I also set each operation to reset the choiceentry back to -1 before the break. However, after some of the operations I get an infinite print repeat of "Enter "1", "2", "3" or "4"", which doesn't allow me enter another option. Surely the next.Int() should shop this happening?
comment on: http://stackoverflow.com/a/20730672
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31164805
has text: First of all think that what do you want to do? A career or just a task? If you want to get money in your career choose java and spend years to stay in this field. But if you want quick earning money and complete projects in one or two days choose PHP. Never think that if something is hard and tricky then you must go to that way but think that what others are doing and where others are rushing to?
comment on: http://stackoverflow.com/q/20789577
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/30971700
type: QuestionComment
comment on: http://stackoverflow.com/q/20681038
has text: You could attempt different encoding instead of UTF-8. There's a list here you could try: http://en.wikipedia.org/wiki/ISO/IEC_2022#ISO.2FIEC_2022_character_sets.
score: 0
type: Comment

http://stackoverflow.com/a/20731415
answers question: http://stackoverflow.com/q/20697564
accepted answer of: http://stackoverflow.com/q/20697564
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Thank you all for your input, and it all worked to end the NPE, yet it didn't perform the task I wanted it to complete. I added the button to ,y Fragment1.java file and then it worked. package com.termite.pockettube; import com.termite.pockettube.MainActivity.SectionsPagerAdapter; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; public class Fragment1 extends Fragment implements View.OnClickListener { Button button; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Get the view from fragmenttab1.xml View view = inflater.inflate(R.layout.fragment1, container, false); button = (Button)view.findViewById(R.id.button); button.setOnClickListener(this); return view; } /* @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }*/ public void countryOnClick() { startActivity(new Intent("com.termite.pockettube.COUNTRY")); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.button: countryOnClick(); break; } } }
type: Answer

http://stackoverflow.com/a/20790417
answers question: http://stackoverflow.com/q/20790289
type: Answer
has body: Use: java.utils.Arrays.sort(yours_array); int largest = yours_array[yours_array.length - 1] ;
has comment: http://stackoverflow.com/comment/31166266
score: 0
has comment: http://stackoverflow.com/comment/31166902

http://stackoverflow.com/comment/31110044
has text: Your [screenshot](http://meta.stackexchange.com/questions/99734/how-do-i-create-a-screenshot-to-illustrate-a-post) is hard to read and `StandardCategoryToolTipGenerator` only defines `{0}…{2}`; please edit your question to include an [sscce](http://sscce.org/).
comment on: http://stackoverflow.com/q/20738334
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31110696
type: Comment
score: 0
type: AnswerComment
has text: If they're different you could add another count variable.
comment on: http://stackoverflow.com/a/20758835

http://stackoverflow.com/q/20820883
type: Question
tagged with: null
tagged with: arrays
has comment: http://stackoverflow.com/comment/31221841
has comment: http://stackoverflow.com/comment/31221905
has answer: http://stackoverflow.com/a/20820910
score: 0
possible better answer: http://stackoverflow.com/a/20820916
has answer: http://stackoverflow.com/a/20820916
has body: I'm reading from an XML file to populate some data structures and I run into this sort of problem when I inspect my final structure: arrayName [0] = null [1] = input [2] = null [3] = input etc input is what I want, and the type is my own class. I'm used to C# so I'd use LINQ to get rid of them normally, idea for doing something like this in Java? I'm going to look at what's wrong with the code that's making it happen but for now I need a quick solution. Ideas? EDIT: I found the issue, I create an array of size doc.getChildNodes().getLength(), and when I'm setting elements in the array (while looping through), I check if getNodeType() == Node.ELEMENT_NODE) And it doesn't work half the time. Problem is, I initialise the array based on the size, so half the array gets filled. Ideas?
has comment: http://stackoverflow.com/comment/31221822
has answer: http://stackoverflow.com/a/20820926
accepted answer: http://stackoverflow.com/a/20820910
has title: Removing Null elements in an array
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20820922

http://stackoverflow.com/a/20711498
has body: This code works by using the connection between binary numbers with exactly n bits and subsets of a set of n elements. If you assign each element of the set to a single bit and treat "1" to mean "include the element in the subset" and "0" to mean "exclude the element from the subset," then you can easily convert between the two. For example, if the set contains a, b, and c, then 100 might correspond to the subset a, 011 to the subset bc, etc. Try reading through the code again with this insight. In terms of efficiency, the above code is very fast both practically and theoretically. Any code that lists subsets has to spend some large amount of time just listing off those subsets. The time required is proportional to the total number of elements that have to be listed. This code spends O(1) work per item listed and therefore is asymptotically optimal (assuming, of course, that there aren't so many elements that you overflow the ints being used). The total complexity of this code can be determined by counting how many total elements get printed. We can work out some math to solve this. Note that there are n choose 0 subsets of size 0, n choose 1 subsets of size 1, n choose 2 subsets of size 2, etc. Therefore, the total number of elements printed is given by C = 0 × (n choose 0) + 1 × (n choose 1) + 2 × (n choose 2) + … + n × (n choose n) Note that (n choose k) = (n choose n - k). Therefore: C = 0 × (n choose n) + 1 × (n choose n - 1) + 2 × (n choose n - 2) + … + n × (n choose 0) If we add these two together, we get 2C = n × (n choose 0) + n × (n choose 1) + … + n × (n choose n) = n × (n choose 0 + n choose 1 + … + n choose n) The binomial theorem says that the parenthesized expression is 2n, so 2C = n2n So C = n2n-1 So exactly n2n-1 elements are printed, so the time complexity of this approach is &Theta;(n 2n). Hope this helps!
score: 8
downvote count: 0
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/20711347

http://stackoverflow.com/comment/31039201
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20699995
type: AnswerComment
has text: I couldn't get 1 step further, any news from you? :)

http://stackoverflow.com/comment/31690198
type: Comment
comment on: http://stackoverflow.com/a/21070202
has text: Thanks for the tip! I seemed to fix it by what I did but next time I'll be more careful.
score: 0
type: AnswerComment

http://stackoverflow.com/q/20723505
type: Question
has comment: http://stackoverflow.com/comment/31094559
has comment: http://stackoverflow.com/comment/31046884
has body: Is there a way to change the orientation of the Display with Java under Win8? Additionally I am curious if I can detect if auto-screenrotation is enabled (and toggle the settings). Perhaps this might be only possible in C#, but I am curious if this is also possible in Java directly. If not Java directly, is there a chance with some other commands? Main interest is to do it in Java...
has title: Change Screen resolution/orientation in Win8
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31063297
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31058247
tagged with: windows
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/31182340
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20799179
type: AnswerComment
has text: thank but didnt help stil same error mesage after adding this to my pom.xml org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final

http://stackoverflow.com/q/20808726
type: UnansweredQuestion
tagged with: android
score: 3
upvote count: 3
tagged with: java
type: Question
has title: JaCoCo Android Coverage with Ant
tagged with: ant
downvote count: 0
tagged with: jacoco
answer count: 1
has body: I have been working on a project that I want to start using JaCoCo. I was wondering if you could help me with an issue I have been having. The project is using Ant to automate building &amp; testing and has an Android component. I have been trying to integrate JaCoCo coverage reports into the project, but have not made much progress when it comes to Android. Unfortunately, the documentation for the Ant tasks are not all that detailed and the off-line example is only the most basic case. I found examples of how to use Maven, but nothing for Ant. I found vague references to the fact that JaCoCO on Android does work, but not explanation of how it all works. I was able to do the off-line instrumentation by putting that task in a -post-compile target the custom_rule.xml file within the Android project folder. However, I'm not sure about how to properly configure the java agent to run and retrieve the .exec file to use for generating a report. Should the java agent be in the libs directory of the main project or the test project? Should I be putting a jacoco-agent.properties in the project's libs folder? Or is there a better way to configure the agent? What is the easiest way to write the output to a file on the host computer? Is a TCP connection better than dumping to a file on the device that could then be copied off of the emulator?
has answer: http://stackoverflow.com/a/20851445
favorite count: 0

http://stackoverflow.com/comment/31224517
type: AnswerComment
type: Comment
has text: @peeskillet wowho! Now I can take a break...for 30 seconds and start working towards 200! Thanks everybody for the up-votes :D
score: 1
comment on: http://stackoverflow.com/a/20822312

http://stackoverflow.com/q/20722415
has answer: http://stackoverflow.com/a/20722499
downvote count: 1
has title: edit text in alert dialog
has body: i've this dialog case DIALOGO_EDIT: final EditText editText = new EditText(context); builder.setView(editText); builder.setPositiveButton("Send", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int i) { } }); builder.setNegativeButton("Close", null); break; But when i rotate the device the dialog dismiss... How can i solve this problem and mantein the dialog during rotation? Or display the edit text at "full screen" like WhatsApp
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11965154
linked to: http://stackoverflow.com/q/7977392
upvote count: 0
linked to: http://stackoverflow.com/q/6746978
favorite count: 0
has answer: http://stackoverflow.com/a/20723606
type: Question
tagged with: android
score: -1
linked to: http://stackoverflow.com/q/151777
tagged with: http://stackoverflow.com/tag/xml
answer count: 2

junit
tags question: http://stackoverflow.com/q/20825640
tags question: http://stackoverflow.com/q/20792700
type: Tag
tags question: http://stackoverflow.com/q/20845570
tags question: http://stackoverflow.com/q/20711964
tags question: http://stackoverflow.com/q/20764468
tags question: http://stackoverflow.com/q/20841805
tags question: http://stackoverflow.com/q/20757591
tags question: http://stackoverflow.com/q/20733703
tag name: junit
tags question: http://stackoverflow.com/q/20792560
tags question: http://stackoverflow.com/q/20820289
tags question: http://stackoverflow.com/q/20744391
tags question: http://stackoverflow.com/q/20767486
tags question: http://stackoverflow.com/q/20768738
tags question: http://stackoverflow.com/q/20697132
tags question: http://stackoverflow.com/q/20740465
tags question: http://stackoverflow.com/q/20712567
tags question: http://stackoverflow.com/q/20680076
tags question: http://stackoverflow.com/q/20734823
tags question: http://stackoverflow.com/q/20762356
tags question: http://stackoverflow.com/q/20748658
tags question: http://stackoverflow.com/q/20699091
tags question: http://stackoverflow.com/q/20730559
tags question: http://stackoverflow.com/q/20838580
tags question: http://stackoverflow.com/q/20736140
tags question: http://stackoverflow.com/q/20742238
tags question: http://stackoverflow.com/q/20848674
tags question: http://stackoverflow.com/q/20760781
tags question: http://stackoverflow.com/q/20797725
tags question: http://stackoverflow.com/q/20733021
tags question: http://stackoverflow.com/q/20708559
tags question: http://stackoverflow.com/q/20680864
tags question: http://stackoverflow.com/q/20711579

http://stackoverflow.com/a/20821643
has body: There are many errors in the sql statement! No primary key is defined for the category. The type of id in category and cat_id in task don't match. As PM77-1 has noted the spaces aren't respected. Anyway the working code is the following: s.addBatch("CREATE TABLE category ( id INT NOT NULL GENERATED ALWAYS AS IDENTITY \n" + "\t(START WITH 0, INCREMENT BY 1), title VARCHAR(100), " + "\tCONSTRAINT category_pk_id PRIMARY KEY (id))\n" ); s.addBatch("CREATE TABLE task (id SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY \n" + "\t(START WITH 0, INCREMENT BY 1), title VARCHAR(100), cat_id INT, visible BOOLEAN, " + "deprecated BOOLEAN," + "\t CONSTRAINT task_pk_id PRIMARY KEY (id)," + "\t CONSTRAINT fk_cat_id FOREIGN KEY (cat_id)\n" + "\t REFERENCES category(id))"); But there will still be an error in the code that these operations aren't atomic and if one happens and the next goes wrong the first isn't rolled back. It is not unsolved.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20821397
type: AcceptedAnswer
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/20821397
score: 2
has comment: http://stackoverflow.com/comment/31223433

http://stackoverflow.com/q/20832106
downvote count: 1
type: Question
has title: Class as a variable type
has answer: http://stackoverflow.com/a/20832148
has answer: http://stackoverflow.com/a/20832141
tagged with: java
possible better answer: http://stackoverflow.com/a/20832148
score: 0
favorite count: 0
tagged with: object-reference
accepted answer: http://stackoverflow.com/a/20832141
has answer: http://stackoverflow.com/a/20832169
answer count: 4
type: AnsweredQuestion
has body: im a programming newbie studying computerscience in second semester. sorry for the german language program. but i hope it won't be a problem understanding it. it basically is about converting currencies. My question is: what is the function of a class as a variable/data type here? i mean in the class dm (deutsche mark) you have the constructor with the given parameter (Euro a). should i think of "a" as a new object of the class euro? or what is it exactly? i saw this kind of variables in many occasions, apparently it is quite common. i hope someone can help. thanks! Mel public abstract class waehrung { public abstract double dollarBetrag(); } public class Euro extends waehrung { private static double kurs = 1; private double wert; public Euro(double wert){ this.wert = wert; } public double dollarBetrag(){ return wert*kurs; } public double euroBetrag(){ return wert; } public static void setEuroKurs(double Kurs){ kurs = kurs; } } class DM extends Euro{ public DM (double dm){ super(dm/1.95583); } public DM(Euro a){ super(a.euroBetrag()); } public double waehrungsBetrag() { return euroBetrag()*1.95583; } }
has answer: http://stackoverflow.com/a/20832158
upvote count: 1

http://stackoverflow.com/q/20697779
has answer: http://stackoverflow.com/a/20698024
downvote count: 0
has body: I wrote a program to convert a number From Binary to Decimal and it is giving wrong output if the input is 0011. For 0011 answer should be 3 but it is giving 9, otherwise it is correct for other input. Code: public class BinaryToDecimal { static int testcase1=1001; public static void main(String[] args) { BinaryToDecimal test = new BinaryToDecimal(); int result = test.convertBinaryToDecimal(testcase1); System.out.println(result); } //write your code here public int convertBinaryToDecimal(int binary) { int powerOfTwo=1,decimal=0; while(binary&gt;0) { decimal+=(binary%10)*powerOfTwo; binary/=10; powerOfTwo*=2; } return decimal; } }
has answer: http://stackoverflow.com/a/20697819
has title: A program Binary to Decimal giving error in Java code
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/20697813
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20698520
type: Question

http://stackoverflow.com/comment/31104788
type: Comment
comment on: http://stackoverflow.com/a/20728913
has text: If your server has no response and your connection timeout is infinity, your code will wait for response without any activity.
score: 1
type: AnswerComment

http://stackoverflow.com/a/20799700
type: Answer
answers question: http://stackoverflow.com/q/20799629
score: 0
has body: It doesn't matter in terms of efficiency, but (a) is the better of the two - it is better for code readability to define variables in the smallest possible scope.

http://stackoverflow.com/a/20813528
has body: Are you able to provide your users a "special" excel file? If you save your Excel as XML (from within Excel), windows still recognizes it as Excel file and it behaves like an Excel file, but it is XML which you can easily read and modify. You only have to be carefull with parsing empty cells - they are skipped in the XML format.
score: 0
answers question: http://stackoverflow.com/q/20808679
type: Answer

http://stackoverflow.com/comment/31018978
score: 0
comment on: http://stackoverflow.com/q/20707457
has text: @SotiriosDelimanolis I have added an image with the Stack Trace, I hope it helps (right click and open the image in a new tab if you are seeing too small)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20784325
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20783789
downvote count: 0
has body: First, these two string variables are declared globally: String userName,Password Try this easy Asyntask method: private class SetDataOfWebService extends AsyncTask&lt;Void, Void,Boolean&gt; { ProgressDialog pDialog; boolean success = false; ConnectivityManager connectivity; @Override protected void onPreExecute() { pDialog = new ProgressDialog(MailSettings.this); pDialog.setMessage("Please Wait.."); pDialog.show(); } @Override protected Boolean doInBackground(Void... params) { if (isNetworkAvailable()) { success = true; if (userName.length()&gt;0 || Password.length()&gt;0) { status = checkLogin(userName, Password); } else { errorMessage.setText(R.string.request); } } else { success = false; } return success; } @Override protected void onPostExecute(Boolean result) { if (pDialog != null &amp;&amp; pDialog.isShowing()) pDialog.dismiss(); if (result) { if (status) { Intent intent = new Intent(v.getContext(), MainPage.class); go(intent); } else { errorMessage.setText(R.string.login_error); } } else { return; } } public boolean isNetworkAvailable() { connectivity = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null) { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) { for (int i = 0; i &lt; info.length; i++) { Log.i("Class", info[i].getState().toString()); if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } } } return false; } } ////Calling This Function On Button CLick Like This userName = Login.this.user.getText().toString(); Password = Login.this.pw.getText().toString(); new SetDataOfWebService().execute();

http://stackoverflow.com/a/48939291
answers question: http://stackoverflow.com/q/20724938
type: Answer
has comment: http://stackoverflow.com/comment/91675669
upvote count: 1
has body: Thank´s everybody for your comments. OS windows XP,I installed FreeSSHd and setting the default directory, then, when I tryng connect by console ssh, the directory was "/", I writing chdir but directory was: C:\Windows\system32\ this is very confused... My Java code: public void recursiveFolderUpload(String sourcePath, String destinationPath) throws FileNotFoundException { if (c == null || session == null || !session.isConnected() || !c.isConnected()) { log.debug("Connection to server is closed. Open it first."); } try { // c.put(sourceFile, destinationFile); // log.info("Upload successfull."); File sourceFile = new File(sourcePath); if (sourceFile.isFile()) { // copy if it is a file c.cd(destinationPath); if (!sourceFile.getName().endsWith(".")) c.put(new FileInputStream(sourceFile), sourceFile.getName(), c.OVERWRITE); } else { log.info("Inside else " + sourceFile.getName()); File[] files = sourceFile.listFiles(); if (files != null &amp;&amp; !sourceFile.getName().startsWith(".")) { log.info("Directory remote server: " + c.pwd()); c.cd(destinationPath); SftpATTRS attrs = null; // check if the directory is already existing try { attrs = c.stat(destinationPath + sourceFile.getName()); } catch (Exception e) { log.warn(destinationPath + sourceFile.getName() + " not found"); //e.printStackTrace(); } // else create a directory if (attrs != null) { log.info("Directory exists IsDir : " + attrs.isDir()); } else { log.info("Creating dir /" + sourceFile.getName()); c.mkdir(sourceFile.getName()); } for (File f : files) { if(!f.getName().contains(".dtd")){ log.info("Uploading file: " + f.getAbsoluteFile()); recursiveFolderUpload(f.getAbsolutePath(), destinationPath + sourceFile.getName() + "/"); } } } } } catch (SftpException e) { e.printStackTrace(); } } My solution was only put the "/" en the input parameter destinationPath of method called recursiveFolderUpload In other words, my properties file than so: properties.host = IP properties.user = user properties.pass = pass prop…
score: 1
downvote count: 0

http://stackoverflow.com/a/20739571
has comment: http://stackoverflow.com/comment/31077809
answers question: http://stackoverflow.com/q/20739488
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31077548
downvote count: 0
has comment: http://stackoverflow.com/comment/31077597
has comment: http://stackoverflow.com/comment/31077933
has body: Um, no, this is not how multithreading works in Swing. There is a single UI thread (known as the Event Dispatching Thread), all updates and interactions with the UI are expected to be done from within the context of the EDT, so doing things like... @Override public void run() { try { UI ui = new UI(); ui.startThread(); } catch(Exception ae) { ae.printStackTrace(); } } And... @Override protected Integer doInBackground() throws Exception { for(int i=0; i&lt;10;i++) { jTextArea1.append(""+i); Thread.sleep(3000); } return 0; } Are actually breaking this rule. Instead, each UI should have its own SwingWorker (as it does now), but should be created from within the context of the EDT. Each SwingWorker should be calling publish in order to push the results of the doInBackground method back to the EDT. SwingWorker has its own progress support via the PropertyChange support For example... import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.GridLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class MultiThreadedUI { public static void main(String[] args) { new MultiThreadedUI(); } public MultiThreadedUI() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } final List&lt;TestPane&gt; panes = new ArrayList&lt;&gt;(5); for (int index = 0; index &lt; 5; index++) { panes.add(new TestPane(Integer.toString(index))); } JFrame frame = new …

http://stackoverflow.com/q/20769536
linked to: http://stackoverflow.com/q/10294122
has answer: http://stackoverflow.com/a/20769549
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/20770543
type: Question
possible better answer: http://stackoverflow.com/a/20769627
score: 0
answer count: 3
tagged with: sql
has title: What is the standard practice for extracting an auto-incrementing primary key?
has body: I have some objects that will be created an entered into the database. There is no guarantee that any of their fields will be unique except for the auto-incrementing primary key. I would like to be able to access these objects later in the program using their primary key. What is the best way to get this key out of the database? I can think of two methods to obtain the primary key after adding the object's data to the database: Find the maximum primary key as this was the one most recently added. Delete the current object, compare the data in the database with the data in the program, and then create a new object based on the row that is not contained in the program. Both of these seem error-prone and hacky and I am wondering if there was a more standard way do to this.
has answer: http://stackoverflow.com/a/20769627
accepted answer: http://stackoverflow.com/a/20769549
has comment: http://stackoverflow.com/comment/31129632
type: AnsweredQuestion

http://stackoverflow.com/comment/30990844
comment on: http://stackoverflow.com/a/20686041
score: 0
type: AnswerComment
has text: I updated my source above to match your suggestion but it still doesn't work
type: Comment

http://stackoverflow.com/comment/31154321
has text: Just found this : http://stackoverflow.com/a/12384693/1646652 It explain how to do it step by step ;-)
comment on: http://stackoverflow.com/a/20781825
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20772037
answers question: http://stackoverflow.com/q/20772002
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20772002
has body: Because derived#f() does not override parent's class private f() method. You could confirm it by adding @Override annotation to f() method in derived class and see that it won't compile. Extra tips : To override method f(), it should be inherited from parent's class, i.e. visible in your subclass, which is never the case for private methods. Additional rules for correct method overriding are summarized in this table.
upvote count: 7
score: 7

http://stackoverflow.com/a/20733135
score: 1
answers question: http://stackoverflow.com/q/20733123
downvote count: 0
type: Answer
has body: private int a=show(); By the time you calling show() method the value of b not yet set and hence the default value of integer is 0 results. To see desired output private int b=5; private int a=show();
upvote count: 1

http://stackoverflow.com/q/20772837
tagged with: glassfish
has title: Java servlet throw http 500 error on purpose
upvote count: 3
tagged with: http-error
tagged with: web
has comment: http://stackoverflow.com/comment/43379508
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/31135899
has answer: http://stackoverflow.com/a/20772864
accepted answer: http://stackoverflow.com/a/20772864
possible better answer: http://stackoverflow.com/a/20773344
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20773344
has body: I am developing a java servlet. I am using glassfish server 4. End users are sending me information through URL parametars, something like this: http://myIP:8080/TestProject/TestServlet?param1=test1&param2=test2&param3=test3 I am getting the values from param1, param2 and param3 and i want to write them in my database. If I get a SQL exception while writing the informations in my db i want to throw "500 Internal Server Error" to let them know that i have some technical problems and to resend their request. I want to know is there a default way to do this, set some status, display text ...? Here is the code: @WebServlet(urlPatterns = {"/TestServlet"}, initParams = { @WebInitParam(name = "param1", value = ""), @WebInitParam(name = "param2", value = ""), @WebInitParam(name = "param3", value = "")}) public class TestServlet extends HttpServlet { String param1; String param2; String param3; boolean dbOK; /** * Processes requests for both HTTP * GET and * POST methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Get parametars from the request param1 = request.getParameter("param1"); param2 = request.getParameter("param2"); param3 = request.getParameter("param3"); //Input in db dbOK = Database.saveParams(param1,param2,param3); //Print response response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ out.println(" "); out.println(" "); out.println(" "); out.println(" T-Mobile Interface "); out.println(" "); out.println(" "); out.println(" dbOK=" + dbOK + " "); out.println(" "); out.println(" "); } finally { out.close(); } } // /** * Handles the HTTP * GET method. * * @param request servlet request * @para…
tagged with: java
tagged with: servlets
type: Question
answer count: 2

http://stackoverflow.com/comment/31243455
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20829088
type: AnswerComment
has text: I've updated the examples. Basically there is update method which can append new values into the document, but I'm not sure if it adds much more, as you could simply read the document, update the list and then write it back again, but hay, at least now you have options. Beware, I've updated the `Students` container ;)

http://stackoverflow.com/q/20721689
has body: My program is not compiling and showing me this error: System.out.println("Error: "+ e.getMessage()); Scanner scanner = new Scanner(System.in); try { int num = scanner.nextInt(); if (num != 0) { throw new Exception("Not zero"); } System.out.println("I'm happy with the input."); } catch (InputMismatchException e) //InputMismatchException is never thrown in body of corresponding try statement { System.out.println("Invalid Entry"); } catch (Exception e) { System.out.println("Error: "+ e.getMessage()); }
accepted answer: http://stackoverflow.com/a/20721719
answer count: 1
has comment: http://stackoverflow.com/comment/31042912
has comment: http://stackoverflow.com/comment/31042925
has title: Throwing exception error
has comment: http://stackoverflow.com/comment/31042936
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31042849
has comment: http://stackoverflow.com/comment/31042843
type: Question
has comment: http://stackoverflow.com/comment/31042937
score: 0
has comment: http://stackoverflow.com/comment/31042881
has answer: http://stackoverflow.com/a/20721719

http://stackoverflow.com/q/20802990
tagged with: taskservice
upvote count: 1
has answer: http://stackoverflow.com/a/20809480
score: 1
tagged with: java
type: Question
has title: Any example for Restlet TaskService?
has body: I am a Restlet program which will be executed in a Linux Server as a background process, since it is going to pull many data from several websites, I will make it to execute this task as a second thread for every 5 minutes; in Restlet I know there is a TaskService class which helps me to achieve this task; however I googled several results and also searched the stackoverflow posts but did not find any standalone example for using Restlet TaskService. It is NOT common so that no one use this class compared with Activiti, Spring? Any help is appreciated, thanks.
tagged with: restlet
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/31234561
type: Comment
has text: You can check running the script $('#varDestinatario').focus() on the chrome console and check if there is an error, here is a blog entry about the prime faces focus http://cagataycivici.wordpress.com/2010/07/29/focus-management-with-primefaces/
comment on: http://stackoverflow.com/a/20826365
score: 0
type: AnswerComment

http://stackoverflow.com/q/20795190
tagged with: android
has title: Why Final is used in method parameters
linked to: http://stackoverflow.com/q/18150548
favorite count: 0
duplicate of: http://stackoverflow.com/q/500508
possible better answer: http://stackoverflow.com/a/20795201
type: AnsweredQuestion
has body: When am coding android I came across the following thing @Override public View getView(final int position, View convertView, ViewGroup parent) { convertView = _inflater.inflate(R.layout.abstract_list_row_item, null); move.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // if btn is clcked then data is changed an we need to refresh framents MainAppDataController.getInstance().setIsDataChanged(true); callWhiteListDB = new CallWhiteListDB(_context); callWhiteListDB.openToWrite(); callWhiteListDB.insert(allContacts.get(position).name, allContacts.get(position).number); callWhiteListDB.close(); callBlackListDB = new CallBlackListDB(_context); callBlackListDB.openToWrite(); callBlackListDB.deleteSingleItem(allContacts.get(position).dbId); callBlackListDB.close(); populateList(position); notifyListView(view); } }); return convertView; In the above example getView() method has parameters like int position, View convertView, ViewGroup parent.My Observation was as soon as I start using position variable inside onclick(), Eclipse throws compilation error and asks make position as final. Why should I make it as final? AFAIK final is used for constants.
tagged with: java
has answer: http://stackoverflow.com/a/20795225
accepted answer: http://stackoverflow.com/a/20795203
has answer: http://stackoverflow.com/a/20795238
has answer: http://stackoverflow.com/a/20795226
type: Question
upvote count: 4
downvote count: 4
has answer: http://stackoverflow.com/a/20795214
duplicate of: http://stackoverflow.com/q/4732544
answer count: 6
has answer: http://stackoverflow.com/a/20795203
has answer: http://stackoverflow.com/a/20795201
score: 0

http://stackoverflow.com/q/20705135
has title: Button doesnt work java android
score: 0
has answer: http://stackoverflow.com/a/20705208
has answer: http://stackoverflow.com/a/20705309
has answer: http://stackoverflow.com/a/20705215
linked to: http://stackoverflow.com/q/3733858
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20705193
has comment: http://stackoverflow.com/comment/31012314
tagged with: java
has answer: http://stackoverflow.com/a/20705229
has comment: http://stackoverflow.com/comment/31012303
type: Question
has answer: http://stackoverflow.com/a/20705210
answer count: 6
has body: android/java/eclipse - i have this java file:(Eight.java) /** * */ package com.apptemplate; 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 com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.hoerhager.christmas.R; /** * */ public class Eight extends Activity { private AdView adView; private Button btn81; private Intent intent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.one); adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } private void initialiseUI() { btn81 = (Button)findViewById(R.id.button81); btn81.setOnClickListener((OnClickListener) this); } @Override public void onPause() { adView.pause(); super.onPause(); } @Override public void onResume() { super.onResume(); adView.resume(); } @Override public void onDestroy() { adView.destroy(); super.onDestroy(); } public void onClick(View v) { if(v==btn81) { intent = new Intent(this,Eighta.class); } startActivity(intent); } } and this xml File: (eight.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:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/eight" /&gt; &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adSize="SMART_BANNER" ads:adUnitId="@string/ads_unit_id" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wr…

http://stackoverflow.com/a/20785090
accepted answer of: http://stackoverflow.com/q/20784674
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31160131
answers question: http://stackoverflow.com/q/20784674
has body: For colMatrix, for every index [i, j], you have to fill it up with m[i][j] + colMatrix[i][j - 1]. Where m is the original matrix, and colMatrix is the new one, which you are filling up. Now, you have to consider the case when j == 0 separately, in which case, you woul dhave colMatrix[i][j] = m[i][j] Similarly for rowMatrix, for every index [i, j], the value will be m[i][j] + rowMatrix[i - 1][j]. And for i == 0, you would have rowMatrix[i][j] = m[i][j]. Here's the code: int[][] m = {{1, 2, 3, 4}, {3, 4, 5, 1}, {1, 2, 0, 1}}; int[][] rowMatrix = new int[m.length][m[0].length]; int[][] colMatrix = new int[m.length][m[0].length]; for (int i = 0; i &lt; m.length; i++) { for (int j = 0; j &lt; m[0].length; j++) { if (j == 0) rowMatrix[i][j] = m[i][j]; else rowMatrix[i][j] = m[i][j] + rowMatrix[i][j - 1]; if (i == 0) colMatrix[i][j] = m[i][j]; else colMatrix[i][j] = m[i][j] + colMatrix[i - 1][j]; } }

http://stackoverflow.com/q/20844191
accepted answer: http://stackoverflow.com/a/20844227
score: 10
downvote count: 0
has body: boolean a = true; boolean b = true; boolean c = false; System.out.println(a || b &amp;&amp; c); // true System.out.println(b &amp;&amp; c || a); // true I just recently discovered what I thought was a bit of an oddity here. Why is it that &amp;&amp; and || are at different precedence levels? I would have assumed that they were at the same level. The above demonstrates it. both statements are true even though a left to right evaluation would give false for the first and true for the second. Does anyone know the reasoning behind this? (BTW, I would have just used a load of parentheses here, but it was old code which brought up the question)
has answer: http://stackoverflow.com/a/20844237
answer count: 3
tagged with: operator-precedence
possible better answer: http://stackoverflow.com/a/20844237
favorite count: 0
has answer: http://stackoverflow.com/a/20844227
has comment: http://stackoverflow.com/comment/31264790
type: AnsweredQuestion
tagged with: java
has title: Why is && at a higher precedence than || (Java)
has comment: http://stackoverflow.com/comment/31264816
upvote count: 10
has answer: http://stackoverflow.com/a/20844221
type: Question

http://stackoverflow.com/a/20723527
type: Answer
has comment: http://stackoverflow.com/comment/31046432
score: 2
has comment: http://stackoverflow.com/comment/31046573
downvote count: 0
answers question: http://stackoverflow.com/q/20723476
upvote count: 2
has body: In UserUI(User user) call this() UserUI(User user) { this(); this.user = user; setUser(user); }
has comment: http://stackoverflow.com/comment/31046455

http://stackoverflow.com/a/20797691
has comment: http://stackoverflow.com/comment/31179443
score: 1
answers question: http://stackoverflow.com/q/20796961
upvote count: 1
downvote count: 0
type: Answer
has body: If BigDecimal is not an option, this is a good way to compare double values: https://stackoverflow.com/a/8081911/3115739

http://stackoverflow.com/a/20733893
has comment: http://stackoverflow.com/comment/124756363
has comment: http://stackoverflow.com/comment/31083781
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31081388
has comment: http://stackoverflow.com/comment/31076773
has comment: http://stackoverflow.com/comment/31080287
has comment: http://stackoverflow.com/comment/31082953
has body: You can use Tomcat's JMX Remote Lifecycle Listener which allows fixing the ports used by the JMX/RMI Server. The JMX Remote Lifecycle Listener allows configuring the following ports: rmiRegistryPortPlatform - The port to be used by the JMX/RMI registry for the Platform MBeans. This one should be used instead of the com.sun.management.jmxremote.port system property rmiServerPortPlatform - The port to be used by the Platform JMX/RMI server. In addtions you can configure the useLocalPorts attribute - Should any clients using these ports be forced to use local ports to connect to the the JMX/RMI server. Notice that this listener requires catalina-jmx-remote.jar to be placed in $CATALINA_HOME/lib. This jar may be found in the extras directory of the binary download area.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31077990
accepted answer of: http://stackoverflow.com/q/20699068
answers question: http://stackoverflow.com/q/20699068
has comment: http://stackoverflow.com/comment/31131180
has comment: http://stackoverflow.com/comment/31077870
has comment: http://stackoverflow.com/comment/31074932

http://stackoverflow.com/a/20690729
accepted answer of: http://stackoverflow.com/q/20690345
has body: You're reading and discarding a whole lot of stuff in the file, when you write if ( itwo == starstwo[coutwo]){ btwo[itwo] = secondtwo.next(); btwo[itwo] = "*"; Then, later when you write btwo[itwo] = secondtwo.next(); System.out.printf("%s", btwo[itwo] + "\t"); there's nothing left to read. But I still don't understand how that causes your text file to get erased and replaced, like you said it does. There is NO CODE IN YOUR SAMPLE that will erase or write to your text file.
type: Answer
answers question: http://stackoverflow.com/q/20690345
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20830040
tagged with: network-programming
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: sockets
has body: I am in the early stages of making a two player game using sockets and serversockets and etc. I have written the game and client and have gotten no compilation errors, but the problem is when they are run. They will connect as I get the message in the console saying connection successful. However, they are suppose to bounce a message back and forth once just to test the connection but it does not. Could someone take a look at it? I do get exceptions when I end one or the other from running as I should. Here is the code: Server: public class Server { private ServerSocket listener; public Server() { try { listener = new ServerSocket(25565); } catch (IOException e) { System.err.println("Uknown IOException when creating the server socket; " + e.getMessage()); } } public void startServer() { try { Game game = new Game(); while (true) { Socket socket = listener.accept(); System.out.println("Connection " + socket.getLocalSocketAddress() + " was accepted!"); Player player = new Player(socket); new Thread(player).start(); if (game.one == null) game.one = player; else if (game.two == null) game.two = player; else player.rejectConnection(); } } catch (IOException e) { System.err.println("Uknown IOException when starting server; " + e.getMessage()); } } public static void main(String[] args) { new Server().startServer(); } class Player implements Runnable { private BufferedReader in; private PrintWriter out; public Player(Socket socket) { try { in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream()); } catch (IOException e) { System.err.println("Uknown IOException when creating instance of player; " + e.getMessage()); } } public void send(String message) { out.println(message); } public void rejectConnection() { out.println("REFUSECON"); } public void run() { try { String line; while ((line = in.readLine()) != null) { System.out.println(line); out.println("RECIVED"); } } catch (IOException e) { System.err.println(…
has title: Simple socket client pair does not respond
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20830074

openal
type: Tag
tags question: http://stackoverflow.com/q/20690011
tag name: openal

http://stackoverflow.com/a/20710541
has body: Put some interface in main project like this. public interface NfcCommunicator { public void initialize(); public void sendData(Object data); public void setReceiveCallback(NfcReceiveCallback callback); public void checkForReceivedData(); } And, public class NfcReceiveCallback { public void execute(Object receivedData) { // Do whatever you want to do with the received data. } } Now put implementation of above interface in android project. public class AndroidNfcCommunicator implements NfcCommunicator { private NfcReceiveCallback myCallback; private Activity myActivity; public AndroidNfcCommunicator(Activity activity) { this.myActivity = activity; } public void initialize() { // NFC initialization code if any. } public void sendData(Object data) { // Send data (you have access to android sdk here) } public void setReceiveCallback(NfcReceiveCallback callback) { this.myCallback = callback; } public void checkForReceivedData() { if (/* Data has been received (Use Activity object here. Since data comes from intent.)*/) { this.myCallback.execute(/* Pass data here. */); } } } Create object of above class in android project and pass it to the ApplicationListener's constructor. Repeatedly call checkForReceivedData method in render method. Good luck.
has comment: http://stackoverflow.com/comment/31027142
accepted answer of: http://stackoverflow.com/q/20699383
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20699383
type: Answer
has comment: http://stackoverflow.com/comment/31024530
score: 2
upvote count: 2

http://stackoverflow.com/a/20694593
has comment: http://stackoverflow.com/comment/30994369
score: 3
accepted answer of: http://stackoverflow.com/q/20694549
type: Answer
has body: There is a modulus operation so that the queue can be represented by an array, where the contents of the queue "wrap around" the end of the array to the beginning. Example with a size of 10: [6th] [tail] [empty] [empty] [empty] [head] [2nd] [3rd] [4th] [5th] Here, head = 5, and tail = 1, because a total of 12 items have been added and 5 removed. Even if there isn't enough room at the end of the array, there is room at the beginning of the array to store more data up until the capacity of the array. The modulus operations allow the head and tail to wrap around on a deq and enq operation, respectively, so that 9 becomes 0 instead of 10, which would have caused an ArrayIndexOutOfBoundsException.
upvote count: 3
has comment: http://stackoverflow.com/comment/30994388
has comment: http://stackoverflow.com/comment/30994410
has comment: http://stackoverflow.com/comment/30994310
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20694549

http://stackoverflow.com/comment/31196593
type: AnswerComment
has text: This seems to work! Took me some time to understand it, but this is working like a charm! Thanks!
type: Comment
comment on: http://stackoverflow.com/a/20806911
score: 0

http://stackoverflow.com/comment/31082834
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20743340
has text: Sorry, emacs put a new line character there because the window was too small, I fixed it.
score: 0

http://stackoverflow.com/q/20704628
has body: I have two classes. I want to print arrays of objects. These objects have attributes (some of them are Strings), but when the program reads it as (nextLine), it will not print it. Here is what I mean: public static void main(String[] args){ String auther,Title,genre; int ISBN,publicationYear,ISBN2; if (Book.getBookNo()&lt; archive_size){ System.out.println("ISBN: "); ISBN=scan.nextInt(); System.out.println("Auther: "); auther=scan.nextLine(); //here is the problem if I choose next it's ok but no nextLine scan.nextLine(); System.out.println("Published Year"); publicationYear=scan.nextInt(); System.out.println("Title: "); Title=scan.nextLine(); scan.nextLine(); System.out.println("Genre: "); genre=scan.next(); libraryBooks[Book.getBookNo()] = new Book(ISBN,auther,publicationYear,Title,genre); } public static void printAll(){ int i=0; for ( i=0 ; i&lt;Book.getBookNo(); i++) System.out.println("Book "+(i+1)+"\nISBN: "+libraryBooks[i].getISBN()+ "\nAuthor: "+libraryBooks[i].getAuther()+ "\npublishedyear: "+libraryBooks[i].getPublication()+"\nTitle: "+libraryBooks[i].getTitle()+ "\nGenre: "+libraryBooks[i].getGenre()+"\n"); }
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20704877
linked to: http://stackoverflow.com/q/13102045
has answer: http://stackoverflow.com/a/20705050
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/13102045
possible better answer: http://stackoverflow.com/a/20705050
has answer: http://stackoverflow.com/a/20704877
has title: why does my program not print the nextLine?
type: Question
answer count: 2

http://stackoverflow.com/comment/31016451
type: Comment
type: QuestionComment
has text: Please show `ressources.jsp`.
comment on: http://stackoverflow.com/q/20707373
score: 0

http://stackoverflow.com/comment/31010676
has text: i am opening in all methods,in all methods i am calling that createConnection method..
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20696955

http://stackoverflow.com/comment/31135705
type: QuestionComment
has text: @Ben alright, but how would i pick one of the ten entries?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20773214

http://stackoverflow.com/a/20823979
score: 0
has body: The array only stores references to the MediaPlayer objects. It (the array) probably takes about 20 bytes.
type: Answer
answers question: http://stackoverflow.com/q/20769802

http://stackoverflow.com/a/20840738
has comment: http://stackoverflow.com/comment/31258918
has body: Because you use Maven, you must place resource files into the src/main/resources folder. If you don't have that folder, you can create it. If your image's path is for example src/main/java/com/example/email.png put it into a corresponding package in resources: src/main/resources/com/example/email.png.
type: Answer
has comment: http://stackoverflow.com/comment/31258857
downvote count: 0
answers question: http://stackoverflow.com/q/20826177
score: 1
has comment: http://stackoverflow.com/comment/31258560
has comment: http://stackoverflow.com/comment/31293205
has comment: http://stackoverflow.com/comment/31259098
has comment: http://stackoverflow.com/comment/31258656
has comment: http://stackoverflow.com/comment/31258536
upvote count: 1
has comment: http://stackoverflow.com/comment/31258798

http://stackoverflow.com/comment/31115932
comment on: http://stackoverflow.com/a/20754377
has text: Yeah 2 java files. Your original one and a new AudioPlayer file. This is a much cleaner and more effective way of playing sounds and I would recommend using it. However, I posted another answer that is more along the lines of what you are looking for
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31146194
type: AnswerComment
comment on: http://stackoverflow.com/a/20778966
score: 0
type: Comment
has text: This is spot on, I didn't test it but by looking at it looks correct

http://stackoverflow.com/a/20801575
has comment: http://stackoverflow.com/comment/31195272
has body: Your generic parameter is bounded by the raw type Comparable, which is not comparable to itself (ie T). Instead, change the type from &lt;T extends Comparable&gt; to &lt;T extends Comparable&lt;T&gt;&gt;. The following code compiles: public static final &lt;T&gt; T doStuff(List&lt;T&gt; list, int k, Comparator&lt;T&gt; comparator) { T element = null; // some stuff done return element; } public static final &lt;T extends Comparable&lt;T&gt;&gt; T doStuff(List&lt;T&gt; list, int k) { Comparator&lt;T&gt; comparator = new Comparator&lt;T&gt;() { public int compare(T o1, T o2) { return o1.compareTo(o2); } }; return doStuff(list, k, comparator); }
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31186263
has comment: http://stackoverflow.com/comment/31186643
has comment: http://stackoverflow.com/comment/31186892
downvote count: 0
answers question: http://stackoverflow.com/q/20801267

http://stackoverflow.com/comment/31105067
has text: yeah you should use thread for back ground operations if anything related to foreground then u can use AsyncTask and from asynctask you can start another thread that can be handler or Thread. try this , hope this works for you
type: Comment
comment on: http://stackoverflow.com/q/20755557
score: 0
type: QuestionComment

installanywhere
type: Tag
tag name: installanywhere
tags question: http://stackoverflow.com/q/20701524

http://stackoverflow.com/a/20767203
has body: Try moving all code that references your GoogleMap to onStart() or onResume(). The map in a map fragment isn't instantiated until after the fragment has gone through onCreateView (link). So, move the following to onStart(): mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); if(mMap != null) { mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097); Marker ciu = mMap.addMarker(new MarkerOptions().position(CIU).title( "My Office")); } Also, the null check is necessary because the map will be null if google play services aren't installed, or the map isn't available for some other reason.
score: 0
answers question: http://stackoverflow.com/q/20766956
type: Answer

http://stackoverflow.com/q/20680042
accepted answer: http://stackoverflow.com/a/20680098
has answer: http://stackoverflow.com/a/20680200
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/20680141
has title: Required boolean, found int?
tagged with: ternary-operator
has comment: http://stackoverflow.com/comment/30967685
has comment: http://stackoverflow.com/comment/30967994
has comment: http://stackoverflow.com/comment/30967911
score: 1
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/30967710
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/30968127
has comment: http://stackoverflow.com/comment/30967468
has comment: http://stackoverflow.com/comment/30967785
answer count: 3
possible better answer: http://stackoverflow.com/a/20680141
has comment: http://stackoverflow.com/comment/30967505
has body: I'm still learning Java.... My task is to write a program which divides two doubles, but before it displays result of dividing, it has to say if they are dividible or not (without a rest). I HAVE TO use ternary operator. code: public class exercise { public static void main(String[] args){ double x = 8.4; double y = 4.2; double z = (int)(x % y); String result = (z&gt;0) ? "not dividible" : "dividible"; System.out.println("This operation is: " + result); System.out.println("The result of dividing is: " + (x/y)); } } Compiler says for the line "String result = (z>0) ?....." that it requires boolean, and that it found int. Of course, compilation failed.
has answer: http://stackoverflow.com/a/20680098

http://stackoverflow.com/comment/65892204
has text: Duplicate: http://stackoverflow.com/questions/23990924/handling-a-biometric-fingerprint-attendance-device-by-using-socket-in-java?rq=1
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20732928

http://stackoverflow.com/q/20840800
has comment: http://stackoverflow.com/comment/53536620
tagged with: java-8
has title: Java 8 method references : validation of methods at compile time
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31261001
has comment: http://stackoverflow.com/comment/31262778
type: Question
accepted answer: http://stackoverflow.com/a/20845441
has answer: http://stackoverflow.com/a/20844311
has comment: http://stackoverflow.com/comment/31262325
has comment: http://stackoverflow.com/comment/31259735
score: 15
has answer: http://stackoverflow.com/a/22872414
answer count: 3
has answer: http://stackoverflow.com/a/20845441
has body: I'd like to use the new method references of Java 8 to provide more validation of some code at compile time. Let's say I have a validateMethod method which requires one parameter : a "method" to be validated. For example : validateMethod(foo, "methodA"); Here, the method would validate that foo#methodA() exists, at runtime. Using method references, I'd like to be able to do : validateMethod(foo::methodA); So the existence of the method would be validated at compile time. The problem is that it seems method references have to be assigned to a functional interface. For example, this : Object dummy = foo::methodA; Generates the error : "The target type of this expression must be a functional interface". If I create a functional interface that has a compatible signature with the methodA method, it works : @FunctionalInterface public interface MyFunctionalInterface { public String run(); } MyFunctionalInterface dummy = foo::methodA; Now the existence of foo#methodA() is validated at compile time, which is what I want! But... Let's say validateMethod doesn't know the signature of the method it has to validate. Is it still possible to implement it then? Let's pretend we don't care about ambiguity and overloaded methods. Is it possible in Java 8 to implement some kind of method which would trigger the validation of any method reference? For example : public class Foo { public String methodA() { return "methodA"; } public String methodB(String str) { return "methodB"; } public String methodC(String str, int nbr) { return "methodC"; } } Foo foo = new Foo(); validateMethod(foo::methodA); // Compile validateMethod(foo::methodB); // Compile validateMethod(foo::methodC); // Compile validateMethod(foo::methodD); // Error! Would it be possible to implement validateMethod in such a way that any method reference would be accepted, so the existence of the method would be validated at compile time? I tried : public void validateMethod(Object obj){} But it doesn't work : "The target typ…
upvote count: 15
favorite count: 0
possible better answer: http://stackoverflow.com/a/22872414

http://stackoverflow.com/comment/31122913
has text: There's no detectable change with that change implemented. I put the two `uses-permission` elements inside `manifest`, but before (and outside) `application`. Is all that correct?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20765961

http://stackoverflow.com/a/20766117
type: Answer
has body: move the calls to new.get inside the loop.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20766090
has comment: http://stackoverflow.com/comment/31123239
upvote count: 1

http://stackoverflow.com/a/40707912
type: Answer
has body: I had a similar problem and I believe it was Maven-related. What I did is I changed jstl dependency from jstl:jstl:1.2 to javax.servlet:jstl:1.2 . I do not believe that this was the reason but after Maven updated its dependencies - it started working. Then it made no difference which one I used. I think it had to do with libs being not in the right place...
answers question: http://stackoverflow.com/q/20742749
score: 0

http://stackoverflow.com/q/20695554
has comment: http://stackoverflow.com/comment/31008773
type: UnansweredQuestion
tagged with: parameter-passing
tagged with: spring-mvc
has title: How to pass several parameters from one view to another (Spring MVC)
has answer: http://stackoverflow.com/a/20697776
has body: What is the best way to pass these parameters from one jsp page to another? First handler method: @RequestMapping(value="/search", method = RequestMethod.POST) public String postSearchStudent( @RequestParam(value = "program.programId") String programId, @RequestParam(value = "rollNumber") String rollNumber, @RequestParam(value = "rollYear") String rollYear, @RequestParam(value = "indexNumber") String indexNumber, Model model) { // do something ??? // Call StudentService to do the searching Student student = studentService.search(indexNumber); // if student isn't in the db load addStudent.jsp, else load student.jsp if (student == null) return "addStudent"; else return "student"; } searchStudent.jsp: &lt;c:url var="searchUrl" value="/essays/main/student/search" /&gt; &lt;form:form modelAttribute="student" method="POST" action="${searchUrl}"&gt; Second handler method: @RequestMapping(value="/add", method = RequestMethod.GET) public String getAddStudent( @RequestParam(value = "program.programId") String programId, @RequestParam(value = "rollNumber") String rollNumber, @RequestParam(value = "rollYear") String rollYear, @RequestParam(value = "indexNumber") String indexNumber, Model model) { Student student = new Student(); student.setRollNumber(rollNumber); student.setRollYear(rollYear); student.setIndexNumber(indexNumber); Program program = programService.get(programId); student.setProgram(program); model.addAttribute("student", student); return "addStudent"; } addStudent.jsp: &lt;c:url var="saveUrl" value="/essays/main/student/add" /&gt; &lt;form:form commandName="student" method="POST" action="${saveUrl}"&gt; Can anyone tell me how to pass these 4 params (programId, rollNumber, rollYear, indexNumber) from searchStudent.jsp to addStudent.jsp?
tagged with: java
type: Question
tagged with: jsp
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20701577
has answer: http://stackoverflow.com/a/20695925

http://stackoverflow.com/comment/31009973
score: 1
type: AnswerComment
has text: The problem is that in this approach there never will be two (nor more) separate "branches" of exceptions - which should be the case for an exception occuring when trying to recover from another exception.
type: Comment
comment on: http://stackoverflow.com/a/20703791

http://stackoverflow.com/comment/31273131
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20831786
has text: @eis, I only included the Dynamic Binding part of the article.
type: AnswerComment

http://stackoverflow.com/comment/31072803
type: AnswerComment
comment on: http://stackoverflow.com/a/20706244
type: Comment
has text: Well, this is how this SQLEXEC class works, which is slightly different from SQL Developer in terms of defining the statements' boundaries (SQL Developer is also Java based). So, if you need to use it, you have to adapt to its model. i.e. it needs you clearly define for it how to distinguish one statement from another. Is this achieved through changing all your scripts? probably! unless you are ready to do some form of pre-processing on the files' contents before feeding them into this class.
score: 0

http://stackoverflow.com/q/20734913
tagged with: java
has body: I have a java web application I'm trying to re-factor to work with the elastic beanstalk way of doing things. The application will be load balanced and have (for the moment) 2 hosts without taking any advantage of auto-scaling. The issue is that there are slight configuration differences between the nodes, in particular authenticating to certain web-services is done with different credentials to effectively double throughput as there are per account throttling restrictions. Currently my application treats configuration separately from the archive so its relatively simple on fixed hosts where the configuration remains in a relatively static file path and deployment of the war files is all that is required. Going down the elastic beanstalk path I think I'll have to include all the configuration options inside the deployable artifact and some how get the application to load up the relevant host specific configuration. The problem I have is deciding which configuration to load inside the application. I could use a physical aspect about the host, i.e. an IP address or Instance ID that would effectively load the relevant config; /config-&lt;InstanceID-1&gt;.properties /config-&lt;InstanceID-2&gt;.properties This approach is totally flawed given that if I create an entirely new environment in beanstalk, it would require me to update all the configuration files in the project to reflect the new Instance-id's created. Has anyone come up with a good way of doing this in beanstalk?
has answer: http://stackoverflow.com/a/20736597
type: Question
has title: Elastic Beanstalk host specific application configuration
tagged with: amazon-web-services
answer count: 1
accepted answer: http://stackoverflow.com/a/20736597
tagged with: amazon-elastic-beanstalk
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/20832270
has comment: http://stackoverflow.com/comment/31243644
accepted answer of: http://stackoverflow.com/q/20832242
answers question: http://stackoverflow.com/q/20832242
type: Answer
has comment: http://stackoverflow.com/comment/31244087
has comment: http://stackoverflow.com/comment/31243677
score: 1
has body: That's just not how interrupts work. The javadoc says If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the join(), join(long), join(long, int), sleep(long), or sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException. So while your Thread is blocked in the sleep() and receives an interrupt(), an InterruptedException will occur. In your code, that will be caught in your PrimeGenerator#run() catch statement. After that, calling interrupt on the same Thread will do what the javadoc says If none of the previous conditions hold then this thread's interrupt status will be set. So no new InterruptedException will occur and your Thread's code will continue to execute normally.
has comment: http://stackoverflow.com/comment/31244046
upvote count: 1
has comment: http://stackoverflow.com/comment/31243668
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31114830
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20761499
type: Comment
has text: Where do you update `result` value?

http://stackoverflow.com/q/20755184
has answer: http://stackoverflow.com/a/20755338
tagged with: java
tagged with: decompiling
downvote count: 0
score: 1
favorite count: 0
answer count: 3
type: UnansweredQuestion
tagged with: reverse-engineering
has answer: http://stackoverflow.com/a/20755294
has answer: http://stackoverflow.com/a/20755383
linked to: http://stackoverflow.com/q/272535
upvote count: 1
has body: I've a standalone compiled java application. I don't have source files for this application and I am facing an issue. I need to fix this issue and need to log some information. I have only .class files at my disposal. Is it possible to modify these files to enable logging of some information?
type: Question
has title: Implement logging in a compiled Java application?

http://stackoverflow.com/q/20836979
linked to: http://stackoverflow.com/q/4928267
has answer: http://stackoverflow.com/a/23040178
has comment: http://stackoverflow.com/comment/34503667
tagged with: java
has comment: http://stackoverflow.com/comment/41137591
tagged with: numberpicker
has title: NPE in ChangeCurrentByOneFromLongPressCommand (on Samsung devices w/ Android 4.3)
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/34610575
upvote count: 54
favorite count: 0
has comment: http://stackoverflow.com/comment/31277773
has comment: http://stackoverflow.com/comment/31351342
has body: Using a couple android.widget.NumberPicker in my Android App view and I get the following message when I hold down on one of the numbers arrows:- FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.NumberPicker$ChangeCurrentByOneFromLongPressCommand.run(NumberPicker.java:2245) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5419) Anyone got any ideas on how I can stop this problem? UPDATE: From the comments so far, it seems that this exception only happened on Samsung devices with Android 4.3.
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23272596
score: 52
has comment: http://stackoverflow.com/comment/31858655
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31583085
has comment: http://stackoverflow.com/comment/32412511
has comment: http://stackoverflow.com/comment/32624452
has comment: http://stackoverflow.com/comment/33155420
has comment: http://stackoverflow.com/comment/31598590
has answer: http://stackoverflow.com/a/62529465
has comment: http://stackoverflow.com/comment/64715721
has comment: http://stackoverflow.com/comment/31251828

http://stackoverflow.com/a/20698588
answers question: http://stackoverflow.com/q/20698571
has comment: http://stackoverflow.com/comment/31001136
has comment: http://stackoverflow.com/comment/31001033
has comment: http://stackoverflow.com/comment/31001024
type: Answer
accepted answer of: http://stackoverflow.com/q/20698571
has comment: http://stackoverflow.com/comment/31001060
has comment: http://stackoverflow.com/comment/31001168
has comment: http://stackoverflow.com/comment/31001270
has comment: http://stackoverflow.com/comment/31000966
has comment: http://stackoverflow.com/comment/31001241
has comment: http://stackoverflow.com/comment/31001204
score: 0
has comment: http://stackoverflow.com/comment/31001009
has body: How about Select * FROM login_details WHERE name ='"+name1+"' order by intime desc LIMIT 1,1 this should retrieve the second oldest record Also as mentioned due to subsequent findings, as your DB is incorrectly storing your Date data as Varchar, your can use the below query until your fix your DB. Select * FROM login_details WHERE name ='"+name1+"' order by id desc LIMIT 1,1
upvote count: 1
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/comment/31148513
has text: thanks for your reply and your help! I won't have a chance to play with this until next week, but I appreciate your suggestions to update the individual cells one-by-one rather than using `setRow` and also the `foldRow` approach to doing the row sum. I did implement my option #3 above (keep track of the uniform rows instead of actually modifying them, and then hack the matrix multiplication accordingly) which did save a ton of time. I'm edit my Q above so I can show you that code and you can make any suggestions to improve it. (I'll accept your reply once I try it.)
comment on: http://stackoverflow.com/a/20779800
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31272351
comment on: http://stackoverflow.com/q/20847910
score: 0
has text: I mean I get logged into my app which is not possible if the `auth` is false.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20808789
downvote count: 0
has comment: http://stackoverflow.com/comment/31436573
score: 9
accepted answer of: http://stackoverflow.com/q/20808782
answers question: http://stackoverflow.com/q/20808782
type: AcceptedAnswer
upvote count: 9
type: Answer
has body: It is a three-dimensional array. Each set of brackets corresponds to an axis. Retrieving a value within the three-dimensional space looks something like this: int value = blah[x][y][z]; Further Reading Multi-Dimensional Arrays in Java

http://stackoverflow.com/comment/31153682
comment on: http://stackoverflow.com/q/20782958
has text: Have you tried updating only your `<h:outputText>` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20827532
has comment: http://stackoverflow.com/comment/31234187
has answer: http://stackoverflow.com/a/20828507
has comment: http://stackoverflow.com/comment/31238161
type: UnansweredQuestion
tagged with: string
has comment: http://stackoverflow.com/comment/31234194
tagged with: combinatorics
type: Question
linked to: http://stackoverflow.com/q/41107
has title: Java a specific string generator
has body: I am trying to build some sort of string generator in Java, but haven’t got much luck so far to get it working the way I need it to work. This is also why I would like to ask someone with more experience to give me a hand with this task. I am new in to java and programing in general, but I hope I should be able to understood tips from those of you who are more advanced on the subject. What I want to do: I want to use let’s say 10 characters i.e. char[] volumeArray = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'}; And generate 5 letter long strings including almost all possible variations based on volumeArray, only condition I need to get across is that single character can only be used maximum twice within a generated 5 character string i.e. aaaab – not acceptable aabbc or abbac – such combination is ok, letters can repeat themselves maximum twice in a single string but variations have to include all possible combinations including all the letters from volumeArray I wanted to use codes from here: How to generate a random alpha-numeric string? but I didn’t succeed to modify these to my needs. I also used crunch in Linux but there is no parameter that would allow me to specify single character to be used only twice within generated string, also using 26 letters in this manner will generate enormous file. Guys would you be able to help me create piece if code that would meet above requirements and write output to a file? I appreciate any help and please accept my apologies if this is to simple task to be answer in here. Kind Regards Mariusz
favorite count: 0
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/31234243
answer count: 1
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/116371920
score: 3
comment on: http://stackoverflow.com/a/33440295
has text: Wow I wish I read your answer 3 hours ago! Thanks. That's another real gotcha that the Gradle people threw in for us devs.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31329440
has text: I guess you should use pessimistic locking: create a column on job that indicates how many tasks are still pending. Update and retrieve that column after task completes (in same transaction)
type: QuestionComment
comment on: http://stackoverflow.com/q/20836882
score: 0
type: Comment

http://stackoverflow.com/q/20824464
type: UnansweredQuestion
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/20840563
type: Question
has title: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver. two program in one project ,one can work but the other can not
score: 0
has body: I know that there have been so many questions on this theme, but I feel the situation I am facing is really different. The question: I have created an RCP project, in which I need to connect to my Mysql database. Before I wrote my program, I wrote a test program to test the configuration needed, and I connected to my Mysql database successfully. The test program can be found in Appendix 1. Then I began to write my program in the same project, but when I called the function in it, the exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver happened. It really disturbed me. The program can be seen in Appendix 2. Appendix 1 Sql.java import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Sql { private static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver"; private static final String URL ="jdbc:mysql://localhost/manager?useUnicode=true&amp;characterEncoding=utf8"; private static final String USERNAME = "root"; private static final String PASSWORD = "yhl0821"; public static void main(String[] args) { Connection con = null; Statement sm = null; ResultSet rs=null; try { Class.forName(MYSQL_DRIVER); con =DriverManager.getConnection(URL, USERNAME, PASSWORD); System.out.println("Successed to connect the mysql!"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } } Appendix 2 EventEntity.java import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class EventEntity { private static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver"; private static final String URL = "jdbc:mysql://localhost/manager?useUnicode=true&amp;characterEncoding=utf8"; private static final String USERNAME = "root"; private static final String PASSWORD = "yhl0821"; public static List&lt;Obj…
answer count: 2
tagged with: classnotfoundexception
has comment: http://stackoverflow.com/comment/31231739
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/20824602
tagged with: jdbc
linked to: http://stackoverflow.com/q/5956936

http://stackoverflow.com/a/20827997
downvote count: 0
score: 7
has body: Create a custom renderer for the list and add a Border to the item that is selected. Read the section from the Swing tutorial on How to Use Lists for more information and examples.
upvote count: 7
answers question: http://stackoverflow.com/q/20827906
type: Answer

http://stackoverflow.com/comment/31016877
has text: There are 1001 simple memory caching libraries available for Java. There is a simple and effective one [built into Guava](http://code.google.com/p/guava-libraries/wiki/CachesExplained). Best not to reinvent the wheel.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20707545

http://stackoverflow.com/comment/31133744
score: 0
comment on: http://stackoverflow.com/q/20772114
has text: Show us your attempts?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20716947
has answer: http://stackoverflow.com/a/20717337
tagged with: inheritance
answer count: 2
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20717171
has title: Instantiating generic class and implementing generic interface
tagged with: generics
favorite count: 0
possible better answer: http://stackoverflow.com/a/20717171
accepted answer: http://stackoverflow.com/a/20717337
has comment: http://stackoverflow.com/comment/31034952
linked to: http://stackoverflow.com/q/4282437
has body: I have this class: public DrawItem { protected String getSeperator() { return ""; } ....... // some other methods } I've another class which extends DrawItem. public DrawNumber extends DrawItem { @Override protected String getSeperator() { return "-"; } } Now, in a generic class CombinationGenerator&lt;E&gt;, I'm trying to instantiate objects of DrawItem/DrawNumber. As instantiating a generic type is not possible in java (like new E(...)), I've created a Factory interface according to this answer. public interface DrawItemFactory&lt;E&gt; { E create(...); } Then in the CombinationGenerator&lt;E&gt; class, public class CombinationGenerator&lt;E&gt; { DrawItemFactory&lt;E&gt; factory; public CombinationGenerator&lt;E&gt;(DrawItemFactory&lt;E&gt; factory) { this.factory = factory; } public List&lt;E&gt; generate() { ...... list.add(factory.create(...)); ...... } } And now the DrawNumber class implements DrawItemFactory&lt;DrawItem&gt; interface. public DrawItem implements DrawItemFactory&lt;DrawItem&gt; { protected String getSeperator() { return ""; } @Override public DrawItem create(...) { return new DrawItem(...); } ....... // some other methods } And I can create CombinationGenerator&lt;DrawItem&gt; class. DrawItem drawItem = new DrawItem(...); CombinationGenerator&lt;DrawItem&gt; generator = new CombinationGenerator&lt;DrawItem&gt;(drawItem); List&lt;DrawItem&gt; combinations = generator.generate(); So far, everything is fine. But when I try to create a DrawNumber class like this, public DrawNumber implements DrawItemFactory&lt;DrawNumber&gt; { .... } It gives me the following error: The interface DrawItemFactory cannot be implemented more than once with different arguments: DrawItemFactory&lt;DrawItem&gt; and DrawItemFactory&lt;DrawNumber&gt; I've tried this solution but I got the same error. Is there any other way to do this?
upvote count: 2
tagged with: java
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31034539
linked to: http://stackoverflow.com/q/75175

http://stackoverflow.com/comment/31112586
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20758872
type: Comment
has text: Thanks for you concern, but i have been trying for a while and i got confused. ScheduledExecutorService.scheduleAtFixedRate takes the first parameter as a Runnable. while Timer.scheduleAtFixedRate first parameter is callable, What are these? i checked the docs and i couldn't understand, do i have to create a new class and pass it there?

http://stackoverflow.com/a/20761946
score: 1
answers question: http://stackoverflow.com/q/20761890
type: AcceptedAnswer
downvote count: 0
has body: filename.xml simply doesn't exist in this directory. Replace by the path of another XML file. The IOException tells you there was an error in the input. It's because Java can't find the file
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20761890

http://stackoverflow.com/comment/31200206
comment on: http://stackoverflow.com/a/20809225
type: AnswerComment
score: 0
type: Comment
has text: Almost - just in my case I have T : IConvertible and system complains dynamic doesn't extend from IConvertible.

http://stackoverflow.com/comment/31057331
has text: Thank you, that did help me a bit. But im still uncertain about returning the second token based on the given argument
comment on: http://stackoverflow.com/a/20729450
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31256078
has text: what you want to do with this value on server side or in action class ?
comment on: http://stackoverflow.com/q/20838121
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20699383
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/20702097
has body: I'm using LIBGDX and with some struggle I've been progressing. But I encountered something that I'm having some difficulties. How, from LibGDX, in an android may I use the NFC? and secondly usb? other resort solutions: 2.1. If LibGDX doesn't allow it, is there a way to access the native call of Android SDK, than? 2.2. A third solution would be having a second app(hidden) coded in android sdk but is it possible to have owned intents/ app name call reason ? so the calls have only one app that would open with. My thanks for this great community
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/20710541
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20710541
favorite count: 0
tagged with: nfc
tagged with: android
has title: Libgdx and Android NFC
has answer: http://stackoverflow.com/a/20702097

http://stackoverflow.com/a/22896612
has comment: http://stackoverflow.com/comment/51065745
upvote count: 1
has body: I've embedded successfully the Pentaho Reporting Engine in my Java application. There is a tutorial with the necessary libraries and examples. The only thing you need to consider while starting is to use the same version of Pentaho SDK, Pentaho Reporting Engine and Pentaho Report Designer, to don't get datasource issues. If you don't want troubles about dependencies, you can download Pentaho Report Designer and drag and drop all the libraries into your web application (most of the issues come when you try to use pentaho charts, and they are solved in this way). Official Pentaho Docs: http://infocenter.pentaho.com/help/index.jsp?topic=%2Freporting_embedders_guide%2Ftopic_embedding_engine.html Pentaho Reporting Classic Engine Core (better try with this first): http://sourceforge.net/projects/jfreereport/files/01.%20Classic%20Engine/ Just import all the libraries in your IDE (I used Eclipse Helios), and use the example provided, it will work as a charm!. Then you can start to modify it depending on your needs. I suggest you to review how to handle the path for the reports.
has comment: http://stackoverflow.com/comment/51128594
type: Answer
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20840764

http://stackoverflow.com/a/20724403
type: Answer
answers question: http://stackoverflow.com/q/20724243
has body: You should get the return statement outside the second loop. The return statement immediately stops whatever the function is doing and returns a specific value specified after the keyword return, so in your case, it returns a value in the first loop, and the function never got the chance of executing the second and afterward looping. So what you should do is to get a record of the variable j and do return fileNameList.get(j) outside the second loop.
score: 0

http://stackoverflow.com/q/20819155
tagged with: configuration
tagged with: java
has title: Deploying WebContent folder from github as a WAR file
tagged with: servlets
downvote count: 0
has comment: http://stackoverflow.com/comment/31219357
has comment: http://stackoverflow.com/comment/31222498
tagged with: tomcat
favorite count: 0
has body: I downloaded the following project as a zip file from https://github.com/blueimp/jQuery-File-Upload I was hoping to use my IDE to build me a WAR file but gave up after encountering some netbeans related dependencies. After I managed to compile it in eclipse and obtained a classes directory which I placed within the WEB-INF folder of WebContent. The webContent folder looks like a an average WAR folder so I zipped up WebContent and renamed it to WebContent.war which I deployed into my tomcat 6 webapps directory. I am using the same JRE as I compiled it within to run tomcat. However it won't run. Content of the web.xml (located in WEB-INF is: <?xml version="1.0" encoding="UTF-8"?> fileupload UploadServlet /UploadServlet index.html index.htm index.jsp default.html default.htm default.jsp <description/> UploadServlet UploadServlet info.sudr.file.UploadServlet I can see the following message in my tomcat error log: 28-Dec-2013 20:20:27 org.apache.catalina.startup.ContextConfig applicationWebConfig SEVERE: Parse error in application web.xml file at jndi:/localhost/WebContent/WEB-INF/web.xml java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name UploadServlet If I then remove the following from web.xml (or move it to below the definition containing the servlet class): UploadServlet /UploadServlet I can see the bear bones html of the index.html located in WebContent but I can't access the servlet itself. Am I right to suspect the form action being called in the index.html may need some mapping in the web.xml file also as I do not see how upload can do anything: I have tried changing action to action="UploadServlet" and action="/UploadServlet" but to no avail. I have uploaded the WAR file here (Just click the smaller download button in the middle!)
tagged with: web.xml
has comment: http://stackoverflow.com/comment/31218688
has comment: http://stackoverflow.com/comment/31221267
score: 2
has comment: http://stackoverflow.com/comment/31219091
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/20765546
answers question: http://stackoverflow.com/q/20761127
type: Answer
has body: If the file path is already an absolute path and you already know whether the File is a directory: public static String toURI(File f, boolean isDirectory) { try { String sp = slashify(f.getPath(), isDirectory); if (sp.startsWith("//")) { sp = "//" + sp; } return new URI("file", null, sp, null); } catch (URISyntaxException x) { throw new Error(x); // Can't happen } } private static String slashify(String path, boolean isDirectory) { String p = path; if (File.separatorChar != '/') p = p.replace(File.separatorChar, '/'); if (!p.startsWith("/")) p = "/" + p; if (!p.endsWith("/") &amp;&amp; isDirectory) p = p + "/"; return p; }
score: 0

http://stackoverflow.com/comment/31071064
has text: I tried setting it up like you said but no luck :( I updated the code above.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20736163

http://stackoverflow.com/a/21721575
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20733282
has body: First to inspect all hard coded Strings values from all using Eclipse The core idea is that The Regular Expression of Java hard coded String value is "*" So We can do that Using search by this criteria For example Eclipse Search Inquiry Eclipse Search Result
answers question: http://stackoverflow.com/q/20733282
downvote count: 0
score: 7
upvote count: 7

http://stackoverflow.com/a/20782088
upvote count: 1
downvote count: 0
type: AcceptedAnswer
has body: WebElement elem = driver.findElement(By.id("dates")); new Select(elem).selectByVisibleText("01");
accepted answer of: http://stackoverflow.com/q/20782003
answers question: http://stackoverflow.com/q/20782003
type: Answer
score: 1

http://stackoverflow.com/a/20739596
answers question: http://stackoverflow.com/q/20739462
score: 0
type: Answer
has body: You can use URLDecoder class to decode your encoded String: System.out.println(URLDecoder.decode("%C5%82%C3%B3", "UTF-8"));

http://stackoverflow.com/a/20706489
has comment: http://stackoverflow.com/comment/31088140
has body: HighFreqTerms only gives you information about the index. If you want documents you have to use a query.
has comment: http://stackoverflow.com/comment/31086024
score: 0
answers question: http://stackoverflow.com/q/20686308
has comment: http://stackoverflow.com/comment/31164133
type: Answer

http://stackoverflow.com/comment/31565549
comment on: http://stackoverflow.com/a/20783858
score: 0
type: AnswerComment
type: Comment
has text: btw, I have switched over to using a SparseRowMatrix with a SparseIndexedVector for each row. I am just creating the rows using the top triangle data, and then going through and copying to the bottom triangle at the end, and that's performing fairly well.

http://stackoverflow.com/comment/31272039
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20847731
has text: You should paste in some of the error so we can see the StackTrace else we are just guessing.
score: 1

http://stackoverflow.com/q/20802875
has body: I have a sql delete query that requires two parameters in order to run. When I run the query I get a: com.web.command.exceptions.DatabaseException: The result of a scalar fullselect, SELECT INTO statement, or VALUES INTO statement is more than one row.. SQLCODE=-811, SQLSTATE=21000, DRIVER=4.14.111 My query is: delete from RESETPASSWORD where planner = (select planner from g_secure where planner = ucase(?) or lcase(email) = lcase(?)) The java I use to set up the delete is: public boolean deleteByPlannerAndEmail(String planner, String email) throws DatabaseException{ Connection conn = null; PreparedStatement ps = null; try { conn = dataAccess.grabConnection("system", "ResetPasswordDAO.deleteByPlanner(planner)"); ps = conn.prepareStatement(SQL_DELETE_BY_PLANNER); ps.setString(1, planner); ps.setString(2, email); ps.executeUpdate(); } catch (Exception e) { throw new DatabaseException(e.getMessage()); } finally { dataAccess.release(conn, ps,null); } return true; } How do I get the query to delete all rows with the same planner not just one row? Thanks for any advice.
score: 0
has title: Scaler fullselct error
tagged with: sql
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20802911
accepted answer: http://stackoverflow.com/a/20802911
type: Question
possible better answer: http://stackoverflow.com/a/20802930
answer count: 2
has answer: http://stackoverflow.com/a/20802930
tagged with: database
tagged with: db2

http://stackoverflow.com/comment/31217548
comment on: http://stackoverflow.com/a/20818534
type: AnswerComment
score: 0
type: Comment
has text: With regards to the 'BTW' remark: it may be the case in this specific example, but not in many others; As I mentioned, I need a general solution; And of course - I just need the URL of the landing-page and not the entire page contents; Thank you

http://stackoverflow.com/q/20839046
type: UnansweredQuestion
has title: Java: JPA / JSON / REST roundtrip workflow
tagged with: mapping
has answer: http://stackoverflow.com/a/20839520
tagged with: java
has comment: http://stackoverflow.com/comment/31255879
type: Question
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31256242
has body: I'm look for a java "workflow" which does the following: Fetch Object from database Serialize it to json Take it back Update the database This has to be "plain" Java. By which I mean no full stack frameworks like Spring or Seam or similar. Currently I'm using MySQL/JPA/Hibernate for ORM, Jackson for JSON mapping and AngularJS on the client-side. This is all fine and dandy for simple objects. But as the objects get more complex I find myself writing more and more mapping code. For example consider this (simplified) objects: class Website { long id; String name; List&lt;Domain&gt; domains; } class Domain { long id; String url; Set&lt;String&gt; countries; } which will map to the three tables: Website, Domain, Country Jackson does a fine job serializing this to somethink like (again simplified): { id: 1, name: "My Website" domains: [ { id: 1, url: "www.mysite.de", countries: [ "de" ] }, { id: 2, url: "www.mysite.com", countries: [ "uk", "us" ] } ] } which Angular can handle pretty well. But after working with it on the client I might get this in an POST request: { id: 1, name: "My Website" domains: [ { id: 1, url: "www.mysite.de", countries: [ "de", "at", "ch" ] }, { url: "www.mysite.co.uk", countries: [ "uk" ] }, { url: "www.mysite.us", countries: [ "us" ] } ] } This can be mapped to corresponding Java objects by Jackson but not stored in the database in this form. Now I have to start "analysing" the created java object and: fetch the correct old object copy the data of the new object into the old and take care of: delete sub-objects which aren't there anymore update those that have changed insert new ones then merge it back into the database which gets pretty messy as the objects get larger and contain more and deeper reference chains. So is there a better way of updating the database objects manually? Or are there any tools which provide help? Thanks in advance!
score: 0
has comment: http://stackoverflow.com/comment/31256275
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/31256143
tagged with: rest

http://stackoverflow.com/comment/31267840
has text: I tried your sugestion and When I run it I get this error - Uncompilable source code - Erroneous tree type: windows.DrawHandler
comment on: http://stackoverflow.com/a/20845699
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31105393
type: AnswerComment
has text: If i am using your above code it ask to create a class XElement. Please suggest us
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20755828

http://stackoverflow.com/comment/31171826
comment on: http://stackoverflow.com/a/20734237
has text: Still not 100% clear. node2 points to node3. Why doesn't the node2 present in the linkedlist not update itself?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/20767405
has comment: http://stackoverflow.com/comment/31127255
downvote count: 0
has body: I would say in Java we "pass references by value", except primitives of course. In case of primitives they are itself passed by value.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31125825
answers question: http://stackoverflow.com/q/20767374
has comment: http://stackoverflow.com/comment/31125883
upvote count: 1

jackson
tags question: http://stackoverflow.com/q/20698929
tags question: http://stackoverflow.com/q/20753095
tags question: http://stackoverflow.com/q/20793795
tags question: http://stackoverflow.com/q/20837856
tags question: http://stackoverflow.com/q/20718845
tags question: http://stackoverflow.com/q/20683114
tags question: http://stackoverflow.com/q/20811214
tags question: http://stackoverflow.com/q/20718555
type: Tag
tags question: http://stackoverflow.com/q/20768354
tags question: http://stackoverflow.com/q/20793590
tags question: http://stackoverflow.com/q/20701082
tags question: http://stackoverflow.com/q/20788122
tags question: http://stackoverflow.com/q/20791356
tags question: http://stackoverflow.com/q/20742213
tag name: jackson
tags question: http://stackoverflow.com/q/20710762
tags question: http://stackoverflow.com/q/20748079
tags question: http://stackoverflow.com/q/20764956
tags question: http://stackoverflow.com/q/20772023
tags question: http://stackoverflow.com/q/20847137
tags question: http://stackoverflow.com/q/20837705
tags question: http://stackoverflow.com/q/20787880
tags question: http://stackoverflow.com/q/20810101
tags question: http://stackoverflow.com/q/20809975
tags question: http://stackoverflow.com/q/20832804
tags question: http://stackoverflow.com/q/20686037
tags question: http://stackoverflow.com/q/20748792
tags question: http://stackoverflow.com/q/20683843
tags question: http://stackoverflow.com/q/20683086

http://stackoverflow.com/comment/31043022
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20721666
has text: eclipse doesn't but the terminal. I've edited it in my question

http://stackoverflow.com/a/20696096
has comment: http://stackoverflow.com/comment/30997082
answers question: http://stackoverflow.com/q/20696001
accepted answer of: http://stackoverflow.com/q/20696001
has comment: http://stackoverflow.com/comment/30997069
has comment: http://stackoverflow.com/comment/30996987
type: AcceptedAnswer
score: 0
has body: That is not a crash, that's an infinite loop. The program becomes unresponsive because you are probably executing this code inside an ActionListener attached to the JTextField or a JButton which is called by the EDT thread. A GUI java application is not like a console application, there are multiple threads involved and you should not block the event thread with a loop like in your example. You have some unused code: char input = scan.next().charAt(0); which was blocking in your console version for input. Now you don't need a loop anymore because it's the user itself which will repeat the action on the user interface and call the actionPerformed method multiple times. What do you want to do exactly? Verifying that the entered text is a permutation of the hidden word? Or just check the first character? In both situations you should remove the loop and store your variables outside the actionPerformed method: int wrongCounter = 0; int rightCounter = 0; public void actionPerformed(ActionEvent e) { char currentCharacter = textField.getText().charAt(0); if (set.contains(currentCharacter)) { ++rightCounter; // whatever } else { ++wrongCounter; } if (set.size() == 0 || wrongCounter == 8) hangMan(); // doesn't need parameter anymore, it's outside the method }
type: Answer
has comment: http://stackoverflow.com/comment/30997015

http://stackoverflow.com/q/20738960
linked to: http://stackoverflow.com/q/16029361
type: Question
linked to: http://stackoverflow.com/q/3734981
tagged with: android-datepicker
accepted answer: http://stackoverflow.com/a/20739100
linked to: http://stackoverflow.com/q/9494334
has title: How to update text-view with multiple datepickers
has comment: http://stackoverflow.com/comment/31074657
has answer: http://stackoverflow.com/a/20739119
tagged with: android
tagged with: datepicker
answer count: 4
has answer: http://stackoverflow.com/a/20739471
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20739100
has body: I am trying to update textview when datepicker is selected with some date. But first textview tahat is startDate is not updating it always update second Text-view. I am taking two Date Picker to update two different textview. Here is my code for updating the TextViews public class AndroidDatePicker extends Activity { private TextView mStartDate; private TextView mEndDate; private Button mStartBtn; private Button mEndBtn; int from_year, from_month, from_day, to_year, to_month, to_day; static final int START_DATE_DIALOG_ID = 0; static final int END_DATE_DIALOG_ID = 0; static final int DATE_PICKER_TO = 0; static final int DATE_PICKER_FROM = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.android_date_picker); mStartDate = (TextView) findViewById(R.id.textView1); mStartBtn = (Button) findViewById(R.id.button1); mStartBtn.setOnClickListener(new View.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(View v) { showDialog(START_DATE_DIALOG_ID); } }); mEndDate = (TextView) findViewById(R.id.textView2); mEndBtn = (Button) findViewById(R.id.button2); /* add a click listener to the button */ mEndBtn.setOnClickListener(new View.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(View v) { showDialog(END_DATE_DIALOG_ID); } }); /* get the current date */ final Calendar c = Calendar.getInstance(); from_year = c.get(Calendar.YEAR); from_month = c.get(Calendar.MONTH); from_day = c.get(Calendar.DAY_OF_MONTH); to_year = c.get(Calendar.YEAR); to_month = c.get(Calendar.MONTH); to_day = c.get(Calendar.DAY_OF_MONTH); updateEndDisplay(); updateStartDisplay(); } private void updateEndDisplay() { mEndDate.setText(new StringBuilder() // Month is 0 based so add 1 .append(to_month + 1).append("-").append(to_day).append("-") .append(to_year).append(" ")); } private void updateStartDisplay() { mStartDate.setText(new StringBuilder() // Month is 0 based so add 1 .append(from_mont…
tagged with: java
has answer: http://stackoverflow.com/a/44586221
score: 0
possible better answer: http://stackoverflow.com/a/20739471
linked to: http://stackoverflow.com/q/14144790

http://stackoverflow.com/comment/31125241
has text: JSF itself could be considered as action based, as different actions direct to different views. If you want to decide between JSF and spring MVC for example, I can't decide for you, as it depends on your experience and learning curve. Haven't myself never done spring MVC!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20761947

http://stackoverflow.com/comment/68010199
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28506208
has text: Good example, thanks. But if I want to combine multiple DAO/repository in a single transactional service call?

http://stackoverflow.com/a/20825332
downvote count: 0
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20800234
has body: You should use the new TraversalDescription-framework. The TraversalDescription-object is accessable via your GraphDatabaseService by calling traversalDescription() on it. Defining the traversal then is similar to the old methods.

http://stackoverflow.com/a/20836456
has body: You can use a MatteBorder for the JToolBar and just set the top edge JToolBar toolBar = new JToolBar("ToolBar"); MatteBorder matteBorder = new MatteBorder(1, 0, 0, 0, Color.BLACK); toolBar.setBorder(matteBorder); This will give you a line on top of the tool bar, one pixel color black Disregard the complete image. Its just some code I had handy with a menu bar in it. Notice the line at the top of the toolbar to give more distinction in separation. You can play around with the pixel thickness and color. If you want it a little more subtle, tou can use a color like light_gray or gray. Your choice See MatteBorder javadoc
has comment: http://stackoverflow.com/comment/31251418
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31250875
has comment: http://stackoverflow.com/comment/31251298
type: Answer
accepted answer of: http://stackoverflow.com/q/20836220
has comment: http://stackoverflow.com/comment/31250906
answers question: http://stackoverflow.com/q/20836220
upvote count: 1
has comment: http://stackoverflow.com/comment/31251206

http://stackoverflow.com/q/20844266
has body: I am new to memcached and getting to know an old friend, Java - am running on win x64 with java 1.7. Also running the couchbase memcache server on my local win 64 machine via a setup file couchbase-server-enterprise_2.2.0_x86_64. Everything generally works fine until I noticed a strange behavior when doing string comparisons with a key set in the telnet session and checking this key in java. From the telnet session set s1 1 0 4 abcd STORED set s2 32 0 4 abcd STORED From my main java test class: ... System.out.println("Get s1 from Cache:" +mcca.get("s1")); System.out.println("Get s1 from Cache:" +mcca.get("s1",1)); System.out.println("Get s1 from Cache:" +mcca.get("s1",32)); System.out.println("Get s1 from Cache:" +mcca.get("s1",77, true)); System.out.println("Get s2 a from Cache:" +mcca.get("s2")); System.out.println("Get s2 b from Cache:" +mcca.get("s2",1)); System.out.println("Get s2 c from Cache:" +mcca.get("s2",32)); System.out.println("Get s2 c from Cache:" +mcca.get("s2",77, true)); Outputs Get s1 from Cache:97 Get s1 from Cache:97 Get s1 from Cache:97 com.danga.MemCached.MemCachedClient Mon Dec 30 11:50:06 EST 2013 - ++++ retrieving object and stuffing into a string. Get s1 from Cache:abcd Get s2 a from Cache:abcd Get s2 b from Cache:abcd Get s2 c from Cache:abcd com.danga.MemCached.MemCachedClient Mon Dec 30 11:50:06 EST 2013 - ++++ retrieving object and stuffing into a string. Get s2 c from Cache:abcd I was looking here: http://www.geelou.com/javadocs/java_memcached-release_2.0.1/com/danga/MemCached/MemCachedClient.html but I didn't see any explanation about the hashCode and whether it corresponds to the same flag/metadata parameter in the memcached server. I think my question roughly boils down to: can the com.danga get command hashCode parameter value be changed from 32 so that I can get the full string when I set the s1 key with metadata/flag 1 as shown above without having to specify the asString flag or mcca.setPrimitiveAsString(true)? And related, why…
tagged with: memcached
has title: Memcached cross client compatability issue between telnet and Java (com.danga)
linked to: http://stackoverflow.com/q/2209864
downvote count: 0
has answer: http://stackoverflow.com/a/22789023
has comment: http://stackoverflow.com/comment/34556818
type: AnsweredQuestion
tagged with: windows
score: 1
has answer: http://stackoverflow.com/a/22789338
has comment: http://stackoverflow.com/comment/34563478
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22789023
answer count: 2
tagged with: couchbase
upvote count: 1
possible better answer: http://stackoverflow.com/a/22789338
tagged with: java

http://stackoverflow.com/comment/31058730
comment on: http://stackoverflow.com/a/20730218
has text: Why would you think the author would want a binary INTEGER as a result?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20725169
score: 5
has comment: http://stackoverflow.com/comment/31050212
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: First break apart the regex: ^(?:([^,]*)\.?){n} ^ is the start of a String (?:...){n} is a non-capturing group repeated n times ([^,]*) is a negated character class, it matches "not ," zero or more times \.? is an optional (literal) . So, how does this work? The non-capturing group is solely there for the numeric quantifier, i.e. it makes the entire pattern in the group repeat n times. The actual pattern being captured is in the capturing group ([^,]*). I'm not sure why the optional . is there and I don't see any inputs ending with a . in your sample data but I assume there are some. What happens is the the group is captured n times but only the last capture is stored and this is stored in the first group, i.e. group 1. This is the default in the regexp_extract. So when the pattern repeats once in the first case we capture the first element on the comma separated array. When the pattern repeats twice in the second example we capture the second element. When the pattern repeats nine times then the ninth element is captured. The pattern itself is actually pretty horrible as it allows for a zero length pattern to be repeated, this means that the regex engine can backtrack a lot if there is a non-matching pattern. I imagine this isn't an issue for you but it is generally bad practice. It would be best to either make the [^,]* possessive by adding a +: ^(?:([^,]*+)\.?){n} Or make the entire non-capturing group atomic: ^(?&gt;([^,]*)\.?){n}
has comment: http://stackoverflow.com/comment/31050153
upvote count: 5
accepted answer of: http://stackoverflow.com/q/20724960
answers question: http://stackoverflow.com/q/20724960

http://stackoverflow.com/q/20723340
type: AnsweredQuestion
tagged with: keyevent
score: 7
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/20723625
answer count: 1
downvote count: 0
favorite count: 0
tagged with: input
accepted answer: http://stackoverflow.com/a/20723625
tagged with: javafx-2
has title: JavaFX KeyEvent returns KeyCode.UNDEFINED
has body: I created a simple JavaFX application that receives input from the user in a TextField. I attached the KeyTyped event from SceneBuilder to the controller. My function looks like this: @FXML private void keyTyped(KeyEvent event) { System.out.println(event.getCode().equals(KeyCode.ENTER)); } This function always prints out UNDEFINED when I type the enter key. Any ideas on how to fix this? Other letters I type seem to have the same problem as well.
upvote count: 7

http://stackoverflow.com/q/20759428
has comment: http://stackoverflow.com/comment/31111425
has comment: http://stackoverflow.com/comment/31111615
tagged with: java
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/31111783
answer count: 1
tagged with: bc4j
has comment: http://stackoverflow.com/comment/31111369
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/31111254
has title: Handling RAISE_APPLICATION_ERROR on the Java side using BC4J
has comment: http://stackoverflow.com/comment/31111659
tagged with: oracle-adf
has comment: http://stackoverflow.com/comment/31111427
tagged with: error-handling
has comment: http://stackoverflow.com/comment/31111235
has answer: http://stackoverflow.com/a/20759516
has body: How can I handle the error thrown from the database side with RAISE_APPLICATION_ERROR at the Java side. I am using the BC4J framework and in that a ViewObject is used to pass data to the database, so the code from where I am setting data doesn't throw SqlException hence I can not put it in a try..catch. UPDATE How can we handle SQLException getting raised from somewhere else. We cant put try catch block for it as its a checked exception and will compile time error.
type: Question

http://stackoverflow.com/q/20734738
has body: With the following code I succeed in having a button in the correct cell in the JTable, but when I click on the button no action is performed. Any hnt? //Bottone salto cova JButton jump=new JButton(rCp.getGabbia().toString()); jump.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { jumpActionPerformed(evt); } private void jumpActionPerformed(ActionEvent evt) { System.out.println("Bottone gabbia " + hatchlistijTable.getSelectedRow() + " " + hatchlistijTable.getSelectedColumn()); } }); // Object [] rowData = {i+1, // progressivo rCp.getNumeroCoppia(), // numero coppia rCp.getAnno(), //rCp.getGabbia(), // fecondo jump, data}; ((javax.swing.table.DefaultTableModel) hatchlistijTable.getModel()).addRow(rowData); //} } TableCellRenderer buttonRenderer = new JTableButtonRenderer(); hatchlistijTable.getColumn(lingua_corrente.getString("jLabel8")).setCellRenderer(buttonRenderer);
has title: Action not performed on click
type: AnsweredQuestion
score: 0
tagged with: swing
accepted answer: http://stackoverflow.com/a/20734769
tagged with: jbutton
type: Question
tagged with: actionlistener
tagged with: java
possible better answer: http://stackoverflow.com/a/20734937
has answer: http://stackoverflow.com/a/20734937
tagged with: jtable
answer count: 2
has comment: http://stackoverflow.com/comment/31067176
has answer: http://stackoverflow.com/a/20734769

http://stackoverflow.com/comment/31069807
type: Comment
has text: No, because you can just use `method()` and it will do *exactly the same thing*.
comment on: http://stackoverflow.com/a/20735850
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31073553
comment on: http://stackoverflow.com/q/20738207
type: QuestionComment
has text: Why can't you just do `A[].class`? Do you want to do it at run time where you don't know what `A` is?
score: 0
type: Comment

http://stackoverflow.com/a/20921857
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31572085
has body: As far as I can see, the JUnit setup is not correct. To let Boot work correctly you have two choices: Use @SpringApplicationConfiguration instead of @ContextConfiguration Boot configures the ApplicationContext bootstrap process quite a bit, e.g. to enable the default configuration files being picked up. Using the custom annotation will automatically activate that stuff for the JUnit executions as well. Configure @ContextConfiguration with the appropriate listeners yourself In your case you at least need the ConfigFileApplicationContextInitializer in addition to all the default ones registered. As the second option is rather cumbersome, I highly recommend to go with option one and see where that leads you.
has comment: http://stackoverflow.com/comment/31556223
has comment: http://stackoverflow.com/comment/31572035
type: Answer
has comment: http://stackoverflow.com/comment/31564608
has comment: http://stackoverflow.com/comment/31563494
downvote count: 0
answers question: http://stackoverflow.com/q/20748658

http://stackoverflow.com/comment/31057698
has text: I want immutable object - priority queue. That's reason why I have implemented methods push and pop. This methods are typical for priority queue. How I can add single element to sorted immutable collection? What is the best way? Method pop removed first (with hightest priority) element from priority queue.
score: 0
comment on: http://stackoverflow.com/q/20729597
type: Comment
type: QuestionComment

maven
tags question: http://stackoverflow.com/q/20774288
tags question: http://stackoverflow.com/q/20734698
tags question: http://stackoverflow.com/q/20810957
tags question: http://stackoverflow.com/q/20750774
type: Tag
tags question: http://stackoverflow.com/q/20743029
tags question: http://stackoverflow.com/q/20807126
tags question: http://stackoverflow.com/q/20760039
tags question: http://stackoverflow.com/q/20791936
tags question: http://stackoverflow.com/q/20758207
tags question: http://stackoverflow.com/q/20753282
tags question: http://stackoverflow.com/q/20735122
tags question: http://stackoverflow.com/q/20721561
tags question: http://stackoverflow.com/q/20743901
tags question: http://stackoverflow.com/q/20751617
tags question: http://stackoverflow.com/q/20753997
tags question: http://stackoverflow.com/q/20839586
tags question: http://stackoverflow.com/q/20680913
tags question: http://stackoverflow.com/q/20782983
tags question: http://stackoverflow.com/q/20706076
tags question: http://stackoverflow.com/q/20692346
tags question: http://stackoverflow.com/q/20680076
tags question: http://stackoverflow.com/q/20755264
tags question: http://stackoverflow.com/q/20697144
tags question: http://stackoverflow.com/q/20767649
tags question: http://stackoverflow.com/q/20756276
tags question: http://stackoverflow.com/q/20708271
tags question: http://stackoverflow.com/q/20686750
tags question: http://stackoverflow.com/q/20735093
tags question: http://stackoverflow.com/q/20848214
tags question: http://stackoverflow.com/q/20782123
tags question: http://stackoverflow.com/q/20699519
tags question: http://stackoverflow.com/q/20801149
tags question: http://stackoverflow.com/q/20764085
tags question: http://stackoverflow.com/q/20754555
tags question: http://stackoverflow.com/q/20843269
tags question: http://stackoverflow.com/q/20753886
tags question: http://stackoverflow.com/q/20705914
tags question: http://stackoverflow.com/q/20840860
tags question: http://stackoverflow.com/q/20739790
tags question: http://stackoverflow.com/q/20801874
tags question: http://stackoverflow.com/q/20831570
tags question: http://stackoverflow.com/q/20733913
tags question: http://stackoverflow.com/q/20740078
tags question: http://stackoverflow.com/q/20757975
tags question: http://stackoverflow.com/q/20736366
tags question: http://stackoverflow.com/q/20685476
tags question: http://stackoverflow.com/q/20744260
tags question: http://stackoverflow.com/q/20786661
tags question: http://stackoverflow.com/q/20719056
tags question: http://stackoverflow.com/q/20803289
tags question: http://stackoverflow.com/q/20719077
tags question: http://stackoverflow.com/q/20689497
tags question: http://stackoverflow.com/q/20816279
tags question: http://stackoverflow.com/q/20707457
tags question: http://stackoverflow.com/q/20744456
tags question: http://stackoverflow.com/q/20794072
tags question: http://stackoverflow.com/q/20683428
tags question: http://stackoverflow.com/q/20796003
tags question: http://stackoverflow.com/q/20739266
tags question: http://stackoverflow.com/q/20786375
tags question: http://stackoverflow.com/q/20785556
tags question: http://stackoverflow.com/q/20745688
tags question: http://stackoverflow.com/q/20740703
tags question: http://stackoverflow.com/q/20723983
tags question: http://stackoverflow.com/q/20698348
tags question: http://stackoverflow.com/q/20827238
tags question: http://stackoverflow.com/q/20766084
tags question: http://stackoverflow.com/q/20799961
tags question: http://stackoverflow.com/q/20762356
tags question: http://stackoverflow.com/q/20768786
tags question: http://stackoverflow.com/q/20718566
tags question: http://stackoverflow.com/q/20706530
tags question: http://stackoverflow.com/q/20779869
tags question: http://stackoverflow.com/q/20839918
tags question: http://stackoverflow.com/q/20683843
tags question: http://stackoverflow.com/q/20711056
tags question: http://stackoverflow.com/q/20695059
tags question: http://stackoverflow.com/q/20734088
tags question: http://stackoverflow.com/q/20846641

http://stackoverflow.com/comment/31153173
has text: Yes I want to remove this from the console output: `0 [FelixStartLevel] INFO org.test.ts.impl.LogMessages - test____scs `. This generated from the code: `log = Logger.getLogger(LogMessages.class.getName());` Is there any way to disable this code?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20781711
type: Comment

http://stackoverflow.com/a/20724876
has comment: http://stackoverflow.com/comment/31049200
upvote count: 2
has body: In this way all the components are shown in a line horizontally. And this means the worst possible layout. But that's exactly what FlowLayout is supposed to do and is exactly what it does. Why not simply use a BoxLayout oriented to BoxLayout.PAGE_AXIS
answers question: http://stackoverflow.com/q/20724849
has comment: http://stackoverflow.com/comment/31049219
type: Answer
has comment: http://stackoverflow.com/comment/31049255
score: 2
downvote count: 0

http://stackoverflow.com/a/20740216
type: Answer
has comment: http://stackoverflow.com/comment/31076561
has comment: http://stackoverflow.com/comment/31076588
has body: lines is perhaps an iterable collection of Double objects. The code that you've posted accesses the next element in sequence and converts it to an integer. If you can post the surrounding code as well, we could get more context on the same.
has comment: http://stackoverflow.com/comment/31076555
score: 0
answers question: http://stackoverflow.com/q/20740122
has comment: http://stackoverflow.com/comment/31076678

http://stackoverflow.com/q/20789835
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31167936
type: Question
tagged with: java
tagged with: eclipse
has body: I am making an android app in eclipse my problem is that every time I run it on my emulator it closes after 5 seconds and gives me a message “Unfortunately, ‘app name’ has stopped working”. I think this is due to the thread that brings up a picture I put in the drawable-hdpi folder because the thread is meant to bring up the picture for 5 seconds then start the program. Any help is greatly appreciated. package com.thenewboston.travis; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class Splash extends Activity{ @Override protected void onCreate(Bundle t) { // TODO Auto-generated method stub super.onCreate(t); setContentView(R.layout.splash); new Thread(){ public void run(){ try{ sleep(5000); }catch(Exception e){ e.printStackTrace(); }finally{ Intent openStartingPoint= new Intent("com.thenewboston.travis.STARTINGPOINT"); startActivity(openStartingPoint); } } }.start(); }} The Android Manifest Code <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> And this is my splash file <?xml version="1.0" encoding="utf-8"?>
answer count: 2
has title: Android development thread issue
has answer: http://stackoverflow.com/a/20789879
has comment: http://stackoverflow.com/comment/31164999
tagged with: android
has answer: http://stackoverflow.com/a/20789876
score: 0

http://stackoverflow.com/a/20974645
has body: I posted these suggestions to the Antlr4 GitHub Issue list and received the below reply. I believe that the ANTLRErrorListener.syntaxError method contains redundant / confusing parameters and requires a lot of API knowledge to use properly, but I understand the decision. Here is the link to the issue and a copy of the text response: From: https://github.com/antlr/antlr4/issues/396 Regarding your suggestions: Populating the RecognitionException e argument to syntaxError: As mentioned in the documentation: The RecognitionException is non-null for all syntax errors except when we discover mismatched token errors that we can recover from in-line, without returning from the surrounding rule (via the single token insertion and deletion mechanism). Adding a constructor to RecognitionException with the offending token: This is not really relevant to this issue, and would be addressed separately (if at all). Removing parameters from syntaxError: This would not only introduce breaking changes for users who have implemented this method in previous releases of ANTLR 4, but it would eliminate the ability to report the available information for errors which occurred inline (i.e. errors where no RecognitionException is available). Convenience methods in RecognitionException: This is not really relevant to this issue, and would be addressed separately (if at all). (Further note: It's hard enough as-is to document the API. This just adds more ways to do things that are already readily accessible, so I oppose this change.) Cloning the recognizer when calling syntaxError: This is a performance-critical method, so new objects are only created when absolutely necessary. "If cloning the recognizer": The recognizer will never be cloned before calling syntaxError. This information can be stored in an associative map in your implementation of ANTLRErrorListener and/or ANTLRErrorStrategy if necessary for your application. I'm closing this issue for now since I don't see any action items requ…
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20828864

http://stackoverflow.com/a/20750128
downvote count: 0
has body: Start by taking a look at How to use scroll panes How to use lists Basically, a scroll pane controls a single component which acts as the view. The scroll pane acts like a window, allowing you to see a position of the view if it is larger then the scroll panes viewable size... JList iist = new JList(); List.setModel(...); JScrollPane sp = new JScrollPane(list); // add sp to something ...
has comment: http://stackoverflow.com/comment/31095181
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20750049
upvote count: 2
has comment: http://stackoverflow.com/comment/31094711
accepted answer of: http://stackoverflow.com/q/20750049
type: AcceptedAnswer

http://stackoverflow.com/q/20771777
linked to: http://stackoverflow.com/q/11461650
has body: Hi I am writing a test using UIAutomator API , however in my java project I want to import the com.android.camera package. However I am always getting an error that this import cannot be resolved. I have added the android.jar in my build path and rest of the things work fine. However I am not able to import this package.
answer count: 4
has answer: http://stackoverflow.com/a/20771831
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/20771855
has answer: http://stackoverflow.com/a/20772054
accepted answer: http://stackoverflow.com/a/20771831
has title: how to import com.android.camera package in a java project
has answer: http://stackoverflow.com/a/20771855
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/20771863

http://stackoverflow.com/comment/31243782
type: QuestionComment
score: 0
has text: shouldn't your else clause be `n = n.next` ? If you have a tail, then you should always know where the loop ends/begins
comment on: http://stackoverflow.com/q/20832322
type: Comment

gmail
type: Tag
tags question: http://stackoverflow.com/q/20758032
tag name: gmail
tags question: http://stackoverflow.com/q/20778284

http://stackoverflow.com/q/20753282
has comment: http://stackoverflow.com/comment/31102161
has body: I'm writting my application using Intellij IDEA, maven, Spring MVC. I've added maven dependencies in my pom.xml: javax.validation validation-api 1.1.0.Final org.hibernate hibernate-validator 5.0.1.Final But classes javax.validation and org.hibernate.validator cannot be found. I try File->Invalidate Caches / Restart... in IntelliJ but it not works. All other dependencies work correct.
type: Question
tagged with: maven
answer count: 1
has comment: http://stackoverflow.com/comment/31891532
tagged with: spring-mvc
score: 0
tagged with: java
tagged with: intellij-idea
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20786832
has comment: http://stackoverflow.com/comment/31102309
has comment: http://stackoverflow.com/comment/31106853
has comment: http://stackoverflow.com/comment/31102047
has title: Not work maven dependencies in Spring MVC

http://stackoverflow.com/q/20737775
favorite count: 0
has body: I have this desktop application that renders PDF into different images per page. But sometimes everything works fine, sometimes not. Using the same file. I don't know if this is due to some swing implementation or native code, or the jna wrapper. here is the log file # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x03a93d1e, pid=2576, tid=3228 # # JRE version: 7.0_04-b22 # Java VM: Java HotSpot(TM) Client VM (23.0-b21 mixed mode, sharing windows-x86 ) # Problematic frame: # C [DebenuPDFLibraryDLL1011.dll+0x93d1e] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x04505400): JavaThread "SwingWorker-pool-1-thread-8" daemon [_thread_in_native, id=3228, stack(0x04a30000,0x04a80000)] siginfo: ExceptionCode=0xc0000005, reading address 0x00000018 Registers: EAX=0x00000000, EBX=0x00000000, ECX=0x00000000, EDX=0x03c058d8 ESP=0x04a7eed4, EBP=0x03c058d8, ESI=0x00000000, EDI=0xffffffff EIP=0x03a93d1e, EFLAGS=0x00010286 Top of Stack: (sp=0x04a7eed4) 0x04a7eed4: 00000000 00000000 034bcd30 00000000 0x04a7eee4: 03a93d42 00000000 00000000 03c055b6 0x04a7eef4: 03c058d8 04a7ef28 03c058d8 034bcd30 0x04a7ef04: 00000000 03c05664 0000000b 03511380 0x04a7ef14: 00000000 04a7f064 0351fd00 0000000b 0x04a7ef24: 04a7f044 04a7f064 03c05a21 04a7f034 0x04a7ef34: 04a7f03c 04a7f02c 0000000b 03511380 0x04a7ef44: 00000005 03a69e22 00000000 00000000 Instructions: (pc=0x03a93d1e) 0x03a93cfe: ff 33 db eb 17 8b 46 18 8b 04 d8 8b 40 18 8b d5 0x03a93d0e: e8 79 38 f7 ff 75 04 8b fb eb 01 43 85 ff 7d 0c 0x03a93d1e: 8b 46 18 e8 42 51 f7 ff 3b d8 7c d9 8b c7 5d 5f 0x03a93d2e: 5e 5b c3 8d 40 00 53 51 88 0c 24…
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: swing
has title: Java Swingworker Fatal Error Crash
score: 1
tagged with: java
type: Question
tagged with: jvm-crash
upvote count: 1

http://stackoverflow.com/comment/31143463
comment on: http://stackoverflow.com/q/20777511
type: QuestionComment
score: 0
has text: I have already tried to compile this and it didn't work, which is why I am asking here.
type: Comment

http://stackoverflow.com/comment/31228699
type: QuestionComment
comment on: http://stackoverflow.com/q/20824254
has text: there is no issue with & i used following post as a reference [link] (http://stackoverflow.com/questions/20585877/how-to-call-a-third-party-webservice-using-apache-camel-using-cxf-componnet).
score: 0
type: Comment

http://stackoverflow.com/comment/31199179
score: 0
has text: That might just be an implementation detail of a specific classloader. The OSGi classloader really only needs the bytes from inside the JAR, that can be done without a persistent lock.
type: Comment
comment on: http://stackoverflow.com/a/20776275
type: AnswerComment

http://stackoverflow.com/comment/31102984
type: QuestionComment
has text: Thats the error I get (argument mismatch; char[][] cannot be converted to TableModel) constructor JTable.JTable(int,int) is not applicable (argument mismatch; char[][] cannot be converted to int) constructor JTable.JTable(Vector,Vector) is not applicable (argument mismatch; char[][] cannot be converted to Vector) constructor JTable.JTable(Object[][],Object[]) is not applicable (argument mismatch; char[][] cannot be converted to Object[][]) After using: JTable table = new JTable(w.getPuzzleSet(), "Puzzle");
type: Comment
comment on: http://stackoverflow.com/q/20754543
score: 0

http://stackoverflow.com/a/20822737
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20822590
score: 1
has body: All the answers posted thus far have given cookie-cutter solutions to turning a 2D array into a 1D array. As far as I can tell, storing a Pascal's triangle in a statically dimensioned 2D array is pretty inefficient since around half the entries are unused. The main issue is that the triangle is ... well, triangular, whereas a rectangular 2D matrix is relatively easy to unroll. However, a triangle is still quite simple to unroll. You just need to figure out where each offset is. Consider storing your pascal's triangle as follows in a 1-D array: 1,1,1,1,2,1,1,3,3,1 Consider the ith row in the Pascal's triangle. Its first entry is in the (1+2+...+i-1)th entry in the 1-dimensional array. This is a simple arithmetic progression sum which evaluates to (i-1)(i)/2. So, write some functions like: int getArrayOffset(int row, int offset) { // assert(row&gt;0); return (row*(row-1))/2 + offset - 1; } int calculateEntry(int row, int offset, int[] triangle) { triangle[getArrayOffset(row,offset)] = triangle[getArrayOffset(row-1,offset-1)]+triangle[getArrayOffset(row-1,offset)]; } void calculatePascal(int n) { int [] triangle = new int[getArrayOffset(n+1,1)]; for (int row=1; row &lt;=n; row++) { triangle[getArrayOffset(row,1)]=1; triangle[getArrayOffset(row,row)]=1; for (int offset=2; offset &lt; row; offset++) { calculateEntry(row,offset,triangle); } } }

http://stackoverflow.com/q/20743025
tagged with: java
has answer: http://stackoverflow.com/a/20743158
type: Question
has body: I want to read from txt file and send to TextView. My method works on Java Project I read and I see System.out.print but the same method doesnt work in MainActivity. How can I fixed.Thanks MainActivity public class MainActivity extends Activity { TextView txt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txt=(TextView)findViewById(R.id.textView1); Parsing p =new Parsing(); try { String gelen=p.readTxt(); txt.setText(gelen); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Parsing: public class Parsing { public String readTxt() throws FileNotFoundException { File file = new File("C:\\Users\\John\\Desktop\\try.txt"); StringBuilder fileContents = new StringBuilder((int)file.length()); Scanner scanner = new Scanner(file); String lineSeparator = System.getProperty("line.separator"); try { while(scanner.hasNextLine()) { fileContents.append(scanner.nextLine() + lineSeparator); } return fileContents.toString(); } finally { scanner.close(); } } } I'm working it but I see just TextView.
linked to: http://stackoverflow.com/q/14376807
score: 0
has answer: http://stackoverflow.com/a/20743190
has comment: http://stackoverflow.com/comment/31081661
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20743164
linked to: http://stackoverflow.com/q/9544737
favorite count: 0
has answer: http://stackoverflow.com/a/20743673
answer count: 5
has comment: http://stackoverflow.com/comment/31081535
type: UnansweredQuestion
has title: Read from file but I didn't see in android?
tagged with: android
has comment: http://stackoverflow.com/comment/31081634
has comment: http://stackoverflow.com/comment/31081582
linked to: http://stackoverflow.com/q/12421814
has answer: http://stackoverflow.com/a/20743122

http://stackoverflow.com/q/20702467
score: 0
tagged with: user-interface
type: UnansweredQuestion
tagged with: vaadin7
has title: create dynamic forms in java for web
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31040388
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31040293
tagged with: dynamic-forms
has body: I wanted to create dynamic form based on some restful service,I know java pretty well but I lag in javascript and related framework,so I wanted to know is their any framework that will ease my task as simple as Form form = new Form("form"); form.add(new TextField("fullName", true)); addControl(form); Checkbox married = new Checkbox("married", "Married?"); I found Apache click after googling,but it was last updated on 27 March 2011. Any other similar framework with latest stable release ?
has comment: http://stackoverflow.com/comment/31009268

http://stackoverflow.com/comment/31138008
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20774380
type: Comment
has text: Your dependencies seem to be correct, so I guess libs are already downloaded to your local repo. Repository management should be in tab 'services'.

http://stackoverflow.com/a/20800416
upvote count: 2
has body: Use this code protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data){ Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); }
has comment: http://stackoverflow.com/comment/31183889
has comment: http://stackoverflow.com/comment/106802023
accepted answer of: http://stackoverflow.com/q/20800360
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20800360
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31186425

http://stackoverflow.com/comment/31152988
comment on: http://stackoverflow.com/a/20782984
score: 0
type: AnswerComment
type: Comment
has text: yeh I just tried that, thats how it is now, still isn't working, also I know that that log statement prints out the right string from the textfield, I checked. So theres something wrong with the Intent sent back to onActivityResult

http://stackoverflow.com/comment/31268308
comment on: http://stackoverflow.com/q/20845622
has text: Where do you `flush()` the output stream before closing it?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31024055
comment on: http://stackoverflow.com/q/20711367
score: 0
type: Comment
type: QuestionComment
has text: What is the value of `inputValue`? (And just use a `double`; you're unnecessarily creating and discarding a wrapper object.)

http://stackoverflow.com/a/20720085
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20718555
upvote count: 1
has body: public class MyTreeWrapper { private MyTree treeprop; // getter, setter } ... ObjectMapper mapper = new ObjectMapper(); MyTreeWrapper wrapper = mapper.readValue(inputStream, MyTreeWrapper.class); MyTree tree = wrapper.getTreeprop(); Alternative: MyTree tree = mapper.reader(MyTree.class).readValue(rootNode.path("treeprop"));
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20718555

http://stackoverflow.com/comment/31029049
type: Comment
has text: I had nothing on Expression class, than I added `myString string = new myString();` to see if it would make any difference. And I'll update the question with myString class now.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20699995

http://stackoverflow.com/comment/31000495
comment on: http://stackoverflow.com/q/20698299
score: 0
has text: Please update your question, add your form or explain what all terms, like addELDate
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31086253
type: Comment
has text: yes. I managed to make it. Thanks again.
comment on: http://stackoverflow.com/a/20695488
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31237049
type: QuestionComment
type: Comment
has text: this is part of hurcdata.txt 1980 Aug 945 100 Allen 1983 Aug 962 100 Alicia 1984 Sep 949 100 Diana 1985 Jul 1002 65 Bob 1985 Aug 987 80 Danny 1985 Sep 959 100 Elena 1985 Sep 942 90 Gloria 1985 Oct 971 75 Juan 1985 Nov 967 85 Kate 1986 Jun 990 75 Bonnie 1986 Aug 990 65 Charley 1987 Oct 993 65 Floyd 1988 Sep 984 70 Florence 1989 Aug 986 70 Chantal 1989 Sep 934 120 Hugo 1989 Oct 983 75 Jerry 1991 Aug 962 90 Bob 1992 Aug 922 145 Andrew 1993 Aug 960 100 Emily 1995 Aug 973 85 Erin 1995 Oct 942 100 Opal
comment on: http://stackoverflow.com/q/20828786
score: 0

http://stackoverflow.com/comment/32987465
has text: If you want to produce xml [here](http://www.mkyong.com/webservices/jax-rs/download-xml-with-jersey-jaxb/) is a quick example how to do it with jersey. Concerning how Genson is getting wired with jersey you can read [this](http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html), this is the basic mechanism proposed by java to provide extension points
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20763003

http://stackoverflow.com/comment/31700592
has text: reproduce the problem and selenium team acknowledge firefox sees the element in div as invisible. "FirefoxDriver thinks that element div#contents is not visible." not sure if it require fix from firefox or selenium team...
type: AnswerComment
comment on: http://stackoverflow.com/a/20734893
type: Comment
score: 0

sockets
tags question: http://stackoverflow.com/q/20745355
tags question: http://stackoverflow.com/q/20777123
tags question: http://stackoverflow.com/q/20817414
tags question: http://stackoverflow.com/q/20716993
tags question: http://stackoverflow.com/q/20750920
tags question: http://stackoverflow.com/q/20743853
tags question: http://stackoverflow.com/q/20765850
tags question: http://stackoverflow.com/q/20701392
tags question: http://stackoverflow.com/q/20833746
tags question: http://stackoverflow.com/q/20734396
tags question: http://stackoverflow.com/q/20764923
tags question: http://stackoverflow.com/q/20832508
tags question: http://stackoverflow.com/q/20740631
tags question: http://stackoverflow.com/q/20749511
tags question: http://stackoverflow.com/q/20695216
tags question: http://stackoverflow.com/q/20752253
tags question: http://stackoverflow.com/q/20743872
tags question: http://stackoverflow.com/q/20831881
tags question: http://stackoverflow.com/q/20828412
tags question: http://stackoverflow.com/q/20705901
tags question: http://stackoverflow.com/q/20694581
tags question: http://stackoverflow.com/q/20684234
tags question: http://stackoverflow.com/q/20844798
tags question: http://stackoverflow.com/q/20738768
tags question: http://stackoverflow.com/q/20777385
tags question: http://stackoverflow.com/q/20751041
tags question: http://stackoverflow.com/q/20698947
tags question: http://stackoverflow.com/q/20795169
tags question: http://stackoverflow.com/q/20790112
tags question: http://stackoverflow.com/q/20744546
tags question: http://stackoverflow.com/q/20684412
tags question: http://stackoverflow.com/q/20775718
tags question: http://stackoverflow.com/q/20696547
tags question: http://stackoverflow.com/q/20734119
tags question: http://stackoverflow.com/q/20785243
tags question: http://stackoverflow.com/q/20748726
tags question: http://stackoverflow.com/q/20723082
type: Tag
tags question: http://stackoverflow.com/q/20776988
tags question: http://stackoverflow.com/q/20713016
tags question: http://stackoverflow.com/q/20767409
tags question: http://stackoverflow.com/q/20752756
tags question: http://stackoverflow.com/q/20731621
tags question: http://stackoverflow.com/q/20824022
tags question: http://stackoverflow.com/q/20845008
tags question: http://stackoverflow.com/q/20693039
tags question: http://stackoverflow.com/q/20820771
tags question: http://stackoverflow.com/q/20753971
tags question: http://stackoverflow.com/q/20732928
tags question: http://stackoverflow.com/q/20818487
tags question: http://stackoverflow.com/q/20798709
tags question: http://stackoverflow.com/q/20748391
tags question: http://stackoverflow.com/q/20732306
tags question: http://stackoverflow.com/q/20688069
tag name: sockets
tags question: http://stackoverflow.com/q/20781910
tags question: http://stackoverflow.com/q/20679427
tags question: http://stackoverflow.com/q/20830040
tags question: http://stackoverflow.com/q/20714679
tags question: http://stackoverflow.com/q/20764957
tags question: http://stackoverflow.com/q/20737753
tags question: http://stackoverflow.com/q/20820912

http://stackoverflow.com/a/20818682
accepted answer of: http://stackoverflow.com/q/20818637
answers question: http://stackoverflow.com/q/20818637
type: Answer
downvote count: 0
has body: replace if(checkNoAttndance.isChecked()==true){ for (Map.Entry&lt;Integer, Integer&gt; mapEntry : checkBoxState.entrySet()){ checkBoxState.remove(mapEntry.getKey()); } } with if(checkNoAttndance.isChecked()){ checkBoxState.clear(); }
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31066850
score: 0
type: QuestionComment
type: Comment
has text: @HotLicks: JavaScript doesn't have chars, and it's still possible to do it :-).
comment on: http://stackoverflow.com/q/20734504

http://stackoverflow.com/a/20833916
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/20833842
has body: You get ANR (Application Not Responding) because your application is not responsive. Do not run Thread.sleep() on the main thread as it's surely making your application not responsive, especially if you do it in a continous loop. You will need to redesign your code. If you need to do some sort of a timer, you should do it without blocking the main thread. There's plenty of resources on that topic. Check this answer, for example: Android - Run a thread repeatingly within a timer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31181061
type: QuestionComment
comment on: http://stackoverflow.com/q/20798594
score: 0
has text: yup, by its author ;) Deleting the original question works too in this case.
type: Comment

http://stackoverflow.com/comment/31110981
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20758956
score: 1
has text: okay, either try to add a print statement like `System.out.println(genericSplit.getClass())` or hang in a debugger. Are you submitting the job to a running cluster? If yes, then there must be some logs.

http://stackoverflow.com/comment/31129243
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20769007
type: Comment
has text: @user2310289, It's not that old -- the data in that article goes to 2011. I mention the browser only because it's the largest arena in which the Java SecurityManager has been exposed to malicious code. There are no other arenas where it has been exposed to malicious code on the same scale, so in the only contested arena where it was the chief security mechanism it has failed to inspire confidence.

http://stackoverflow.com/q/20715451
has comment: http://stackoverflow.com/comment/31031995
has answer: http://stackoverflow.com/a/20715825
tagged with: list
has comment: http://stackoverflow.com/comment/31032044
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20715572
has title: Remove objects from a list through an array of integers?
type: AnsweredQuestion
has body: Hi community I have a question, I happen to have an array of objects loaded on startup, through that generate array another array of integers that contains your code, it appears that array of integers'm removing their values, what I want is to compare the list of integer array currently have with the array of objects, and remove all code object that whole array mentioned is found. My code java: private List&lt;ValidColumnKey&gt; columnCustomer; private int[] selectedCustomer; public void init(){ this.setColumnCustomer(new ArrayList&lt;ValidColumnKey&gt;()); this.getColumnCustomer().add(new ValidColumnKey(1, "Codigo", "code")); this.getColumnCustomer().add(new ValidColumnKey(2, "Nombre", "name")); this.getColumnCustomer().add(new ValidColumnKey(3, "Nombre Comercial", "comercialName")); this.getColumnCustomer().add(new ValidColumnKey(4, "Estado", "isActive")); this.setSelectedCustomer(new int [this.getColumnCustomer().size()]); int i = 0; for(ValidColumnKey column : this.getColumnCustomer()){ this.getSelectedCustomer()[i] = column.getCodigo(); i++; } } I mean I would have my array of integers with codes removed, like this: selectedCustomer = [1, 2, 3]; What I wanted was to remove from the list of objects that do not have codes in the array of integers, but it is not my code: List&lt;ValidColumnKey&gt; auxRemoColumnKeys = new ArrayList&lt;ValidColumnKey&gt;(); for(ValidColumnKey column : this.getColumnCustomer()){ for(Integer codigo : this.getSelectedCustomer()){ if (column.getCodigo() != codigo) { auxRemoColumnKeys.add(column); break; } } } this.getColumnCustomer().remove(auxRemoColumnKeys); I could guide the solution.
tagged with: arrays
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20715572
possible better answer: http://stackoverflow.com/a/20715825

uniqueidentifier
tags question: http://stackoverflow.com/q/20794911
type: Tag
tag name: uniqueidentifier

http://stackoverflow.com/comment/31032235
score: 0
type: Comment
type: QuestionComment
has text: Not sure how that's relevant Jayan. I already have an app bundle packaged and it launches with one click. As I said in the OP, the problem is it doesn't give any real-time output, which is what I need.
comment on: http://stackoverflow.com/q/20714947

http://stackoverflow.com/comment/31179329
type: AnswerComment
comment on: http://stackoverflow.com/a/20788975
has text: Thanks a lot James, it works perfectly. I just need 1 more suggestion from your side regarding the use of the translate translation (with the logic you provided above) and using Timeline frames (with the logic of Shape intersection). Which approach will be efficient?
type: Comment
score: 0

http://stackoverflow.com/comment/31227356
has text: I am looking for column name which is empty and doesnt have any value and I want to drop it from table..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20823864

http://stackoverflow.com/comment/31134321
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20769788
has text: No, really it doesn't. If the state is modified in an atomic way, then there's nothing to synchronise.

http://stackoverflow.com/comment/31190830
score: 2
has text: Don't start from 1 because you don't like starting from 0. The language is written to start from 0, you'll get used to doing so quick enough, and just about every Java programmer you'd ever work with would prefer that.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20802509

http://stackoverflow.com/comment/31159026
type: Comment
comment on: http://stackoverflow.com/a/20786677
has text: +1 for actually answering correctly.
score: 0
type: AnswerComment

jruby
tags question: http://stackoverflow.com/q/20819258
tags question: http://stackoverflow.com/q/20689224
type: Tag
tags question: http://stackoverflow.com/q/20820877
tags question: http://stackoverflow.com/q/20747103
tags question: http://stackoverflow.com/q/20822111
tag name: jruby
tags question: http://stackoverflow.com/q/20736804
tags question: http://stackoverflow.com/q/20725726

http://stackoverflow.com/comment/31096618
type: QuestionComment
has text: can you provide the link to download (org.newdawn) ?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20751036

http://stackoverflow.com/q/20777821
has comment: http://stackoverflow.com/comment/31144423
has answer: http://stackoverflow.com/a/20784705
type: Question
score: 3
tagged with: hashmap
tagged with: hashcode
has comment: http://stackoverflow.com/comment/31152588
answer count: 6
has answer: http://stackoverflow.com/a/20777947
upvote count: 4
accepted answer: http://stackoverflow.com/a/20784705
tagged with: key
favorite count: 0
tagged with: equals
has answer: http://stackoverflow.com/a/20782899
has body: In all questions i saw about overridden equals and hashcode methods people always say if you override equals method you should override also hashcode method and vice versa in order to avoid problems while getting objects from Hash collections. Personally i don't see that the vice versa is right for that purpose, Let's consider that we use an object(with attributes) as keys in a HashMap and we don't need to test the equality between two instances of that object. If we override the hashcode method in an efficient manner(based on attributes &amp; other rules), so we can have unique keys, in this case for the HashMap we gonna have a unique value in each bucket, and the HashMap will not use the equals method to compare values in a bucket since we have one value in each bucket. the contract side: two instances of our object are equals(the Object.equals one) means they have the same reference, and based on our hashcode method the hashcode will be the same ==> OK different hashcodes leads to not equal objects ==> NOK (in our case it is possible to break this rule) but since we have good hashing keys(our scenario purpose) the contract doesn't really matter Am I wrong? Edit : (after search, below answers, and looking in the source code of HashMap) Why should we override equals method also? Initial conditions, unique hashcodes and no equals() overridden Retrieving values using get() method problem: Object.equals() perform a reference comparison, and this method is used in the methods put and get public V get(Object key) { if (key == null) return getForNullKey(); int hash = hash(key.hashCode()); for (Entry&lt;K,V&gt; e = table[indexFor(hash, table.length)]; e != null; e = e.next) { Object k; if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k))) return e.value; } return null; } If we don’t override equals we will not be able to retrieve values from the HashMap if we lose the reference of the keys, e.g. of keys references which are not visible to another code. The …
has answer: http://stackoverflow.com/a/20777872
type: AnsweredQuestion
has title: Overridden equals not mandatory for efficient hashing keys
possible better answer: http://stackoverflow.com/a/20777846
has answer: http://stackoverflow.com/a/20777846
tagged with: java
has comment: http://stackoverflow.com/comment/31144208
downvote count: 1
has answer: http://stackoverflow.com/a/20777879

http://stackoverflow.com/comment/31192468
score: 0
type: AnswerComment
type: Comment
has text: I added comments, you should also read `Calendar` javadoc.
comment on: http://stackoverflow.com/a/20805047

http://stackoverflow.com/comment/30973332
type: QuestionComment
has text: Thank you all for the answers, i upvoted all of them, because they were right. I chose @AnthonyGrist's answer because it was more clarifying. Thanks again!
score: 0
comment on: http://stackoverflow.com/q/20683148
type: Comment

http://stackoverflow.com/comment/31227990
score: 0
comment on: http://stackoverflow.com/q/20824273
type: Comment
type: QuestionComment
has text: you want responestring in activity?

http://stackoverflow.com/comment/30993938
type: AnswerComment
score: 0
type: Comment
has text: `I am running the RefreshMinimap() method in a thread now`, you are invoking the Thread from the paintComponent() method. It should not be done from there.
comment on: http://stackoverflow.com/a/20690730

http://stackoverflow.com/q/20792448
has comment: http://stackoverflow.com/comment/31170610
tagged with: pmd
linked to: http://stackoverflow.com/q/387008
tagged with: java
has answer: http://stackoverflow.com/a/20799612
has comment: http://stackoverflow.com/comment/31188333
has comment: http://stackoverflow.com/comment/31174784
downvote count: 0
tagged with: findbugs
score: 6
accepted answer: http://stackoverflow.com/a/20799612
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20794590
favorite count: 0
has answer: http://stackoverflow.com/a/20794590
tagged with: checkstyle
type: Question
has title: Is there any Checkstyle/PMD/Findbugs rule to force "else if" to be on the same line?
answer count: 2
has comment: http://stackoverflow.com/comment/31185362
has comment: http://stackoverflow.com/comment/31185231
upvote count: 6
has comment: http://stackoverflow.com/comment/31182573
has body: In our project for chained if/else/if we would like to have following formatting: if (flag1) { // Do something 1 } else if (flag2) { // Do something 2 } else if (flag3) { // Do something 3 } And forbid following one: if (flag1) { // Do something 1 } else { if (flag2) { // Do something 2 } else { if (flag3) { // Do something 3 } } } Is there some predefined rule in either of listed above static code analysis tools to force this code style? If no - I know there is an ability to write custom rules in all of those tools, which one would you suggest to implement such a rule (not really familiar with writing custom rules in either of them)?

http://stackoverflow.com/a/20712066
has body: Why do you wanna mock a file? Mocking java.io.File is a bad idea as it has loads of native stuff. I would advice you to ensure that a minimalist text file is available in classpath when the unit tests are run. You can convert this file to text and confirm the output.
has comment: http://stackoverflow.com/comment/31025467
answers question: http://stackoverflow.com/q/20711964
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31025525
upvote count: 3

http://stackoverflow.com/q/20843057
has answer: http://stackoverflow.com/a/20843132
type: UnansweredQuestion
tagged with: swing
type: Question
has title: Java drawing tiles with random color size?
tagged with: java
tagged with: arrays
answer count: 1
score: 0
has body: Well I've read some code and came across this: private int[] tiles = new int [64 * 64]; Thats the tiles array. And that sets a random colors to the tiles array. for (int i = 0; i &lt; 64 * 64; i++) { this.tiles[i] = rand.nextInt(0xffffff); } And now rendering public void render() { for (int i = 0; i &lt; this.height; i++) { for (int j = 0; j &lt; this.width; j++) { int index = (j / 50) * 64; pixels[j + i * this.width] = tiles[index]; } } } (Rendering outside of that class, but it doesnt matter). Output: but if I change j / 50 to j / 16, the tiles gets smaller and becomes this: Why does this happen? after all the variable index only gets the color from the array? why does it make it big? j changes everytime, shouldnt the colors be different everytime? Can someone explain this please? I am kinda confused. Thanks!

http://stackoverflow.com/comment/50238159
comment on: http://stackoverflow.com/a/31096816
type: AnswerComment
has text: Int case of Time Limited Error, I think yes. For example, if one command in a test case want to add 1 to all nodes, then, if you simply use a Segment Tree, it has time complexity n * O(log n) = O(n log n). However, for a Segment Tree with Lazy Propagation, it only cost O(log n).
score: 0
type: Comment

http://stackoverflow.com/comment/31146030
comment on: http://stackoverflow.com/a/20778585
has text: BUT...the `contentPane` is using a `null` layout manager, meaning that unless you supply position and size information for your components, they will not show up.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20786921
tagged with: java
tagged with: mysql
type: Question
tagged with: glassfish
has comment: http://stackoverflow.com/comment/43528024
has comment: http://stackoverflow.com/comment/31159612
has comment: http://stackoverflow.com/comment/31159520
upvote count: 2
has comment: http://stackoverflow.com/comment/43708606
has comment: http://stackoverflow.com/comment/31159430
has title: How to initiate stand alone Java app to use my sql connection pools?
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/43510169
favorite count: 0
has comment: http://stackoverflow.com/comment/43534566
type: UnansweredQuestion
has body: I inherited this code (which worked) for a stand alone Java application (Netbeans 7.3, openjdk7, glassfish-3.1.2.2, mysql5.5): fDriver = "com.mysql.jdbc.Driver"; fDatabase = "jdbc:mysql://localhost:3306/mydb"; Class.forName(fDriver); fCon =DriverManager.getConnection (fDatabase,"username","password"); I'm now trying to convert it to a connection pool which is defined in the glassfish web console. ctx = new InitialContext(); ds = (DataSource)ctx.lookup("jdbc/mydb/"); //this is the jndi name showing app in the web console of glassfish fCon2 = ds.getConnection("username","password"); I'm getting (for the ctx.lookup line): Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial What basic code am I missing?
score: 2
tagged with: connection-pooling
answer count: 0
downvote count: 0

http://stackoverflow.com/q/20832194
has answer: http://stackoverflow.com/a/20832698
accepted answer: http://stackoverflow.com/a/20832698
score: 0
has title: Adding last average value
answer count: 2
has body: I'm having trouble adding the last number of the loop that I have. I don't have any ideas how to include the last number and then add it to the double variable and then divide it to make the average. I would use my IDE to solve the problem but the input has to be approximately 1000 trials in order to be accurate. You can plainly see that 10 trials of 3.0 or higher does not equal approximately 2.8. I just need to have the missing trial added and then calculated into the average. Code: import java.util.*; public class CalculatePI2 { public static boolean ifitisInside (double xPosion, double yPosion) { double distance = Math.sqrt((xPosion * xPosion) + (yPosion * yPosion)); return (distance &lt; 1.0); } public static double calculatePI (int numThrows) { Random randomGen = new Random(); int hits = 0; double PI = 0; double Alpha=0; double average= 0; for( int m=0; m&lt;10; m++) { Alpha=+PI; average= m/Alpha; if(m&gt;=0) { hits=0; PI=0; for (int i = 0; i &lt;= numThrows; i++) { double xPosion = (randomGen.nextDouble()) * 2 - 1.0; double yPosion = (randomGen.nextDouble()) * 2 - 1.0; if (ifitisInside(xPosion, yPosion)) { hits++; double dthrows = numThrows; PI =+ (4.0 * (hits/dthrows)); } } System.out.println("Trial["+m+"]: ="+ PI); } } System.out.println("Estimate:"+average); return PI; } public static void main (String[] args) { Scanner pie = new Scanner (System.in); System.out.println("This program approximates PI using the Monte Carlo method. By simulating throwing darts at a dartboard. "); System.out.print("Please enter number of throws: "); int numThrows = pie.nextInt(); double PI = calculatePI(numThrows); } }
has comment: http://stackoverflow.com/comment/31243845
possible better answer: http://stackoverflow.com/a/20832316
has comment: http://stackoverflow.com/comment/31243539
has comment: http://stackoverflow.com/comment/31243571
has comment: http://stackoverflow.com/comment/31243632
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20832316
has comment: http://stackoverflow.com/comment/31243645

http://stackoverflow.com/q/20826712
answer count: 3
has answer: http://stackoverflow.com/a/20826859
linked to: http://stackoverflow.com/q/70689
score: 7
linked to: http://stackoverflow.com/q/9850525
favorite count: 0
has title: declaring instance keyword in java
has answer: http://stackoverflow.com/a/20826720
has answer: http://stackoverflow.com/a/20826819
type: UnansweredQuestion
upvote count: 7
has comment: http://stackoverflow.com/comment/31232560
has comment: http://stackoverflow.com/comment/31232553
tagged with: java
type: Question
has body: I see a "instance" keyword being declared in my java code declaration of a ENUM.Can someone explain how this keyword works? Java code:- public enum TodoDao { instance; private Map&lt;String, Todo&gt; contentProvider = new HashMap&lt;String, Todo&gt;(); private TodoDao() { Todo todo = new Todo("1", "Learn REST"); todo.setDescription("Read http://www.vogella.com/articles/REST/article.html"); contentProvider.put("1", todo); todo = new Todo("2", "Do something"); todo.setDescription("Read complete http://www.vogella.com"); contentProvider.put("2", todo); } public Map&lt;String, Todo&gt; getModel(){ return contentProvider; } }
downvote count: 0

http://stackoverflow.com/comment/31055655
type: Comment
comment on: http://stackoverflow.com/a/20727474
type: AnswerComment
has text: @peeskillet huh haaa... :D its true and his answer solved my problem
score: 0

http://stackoverflow.com/comment/31159183
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20786731
has text: 1) `if there's any way to print text without using JLable or JtextField.` Take a look at all components that extends `JTextComponent` 2)`Can a border in the TextField be removed?` Yes
score: 0

http://stackoverflow.com/comment/31051690
type: Comment
score: 0
type: QuestionComment
has text: Did some testing: Enter an integer: 5 The pentagonal numbers are: 1s5s12s22s35. No "s" after the last.
comment on: http://stackoverflow.com/q/20726118

http://stackoverflow.com/a/20777872
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31144507
score: 1
has body: It is possible to avoid implementing equals, or to avoid implementing hashcode. In both cases you open yourself to a world of potential pain. After all remember that the Hash is used to separate objects into buckets, and then the objects within the buckets need checking for equality still, you are relying on the collection objects you are using behaving in exactly the way you need. The guidelines are there to prevent a lot of problems and there is no good reason to avoid following them other than to try and be clever and by doing so open yourself up for a load of problems in the future.
has comment: http://stackoverflow.com/comment/31154802
answers question: http://stackoverflow.com/q/20777821

http://stackoverflow.com/q/20698807
has title: Playing .wav files in Java
has comment: http://stackoverflow.com/comment/31001253
downvote count: 0
accepted answer: http://stackoverflow.com/a/20699024
favorite count: 0
score: 2
upvote count: 2
has body: Hello guys I am trying to develop a sound player with java using clip . I followed tutorials at docs.oracle.com.But i didnot understand . Here is my code import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; public class SoundPlayer{ public static void main(String[] args) { try { Clip clp = AudioSystem.getClip(); AudioInputStream is = AudioSystem.getAudioInputStream(new File("1_welcome.wav")); clp.open(is); clp.start(); } catch (LineUnavailableException e) { e.printStackTrace(); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } What is my problem is when I run the application, nothing happens.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31001262
tagged with: java
possible better answer: http://stackoverflow.com/a/20698892
has answer: http://stackoverflow.com/a/20698892
has answer: http://stackoverflow.com/a/20699024
type: Question
answer count: 2

http://stackoverflow.com/q/20847997
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20848440
accepted answer: http://stackoverflow.com/a/20848440
upvote count: 1
downvote count: 1
type: Question
tagged with: arraylist
score: 0
has title: Convert JsonString to a custom java ArrayList
answer count: 1
has body: My qestion is, how I can convert an saved Json Sting back to an custom ArrayList. This is how I save my ArrayList: public void saveLocList(ArrayList&lt;LocItem&gt; locList) { SharedPreferences.Editor e = returnPref.edit(); Gson gson = new Gson(); String json = gson.toJson(locList); e.putString(LOCLIST, json); e.commit(); } And now, when I restore the ArrayList (Json String) it doesn't work with this code: public ArrayList&lt;LocItem&gt; getLocList() { String json = returnPref.getString(LOCLIST, ""); Type type = (Type) new TypeToken&lt;ArrayList&lt;LocItem&gt;&gt;() { }.getType(); ArrayList&lt;LocItem&gt; inpList = new Gson().fromJson(json, (java.lang.reflect.Type) type); return inpList; } This is my log: 12-30 22:19:19.395: E/AndroidRuntime(2254): FATAL EXCEPTION: main 12-30 22:19:19.395: E/AndroidRuntime(2254): java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackagename.MainActivity}: java.lang.ClassCastException: com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl cannot be cast to android.renderscript.Type 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339) 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389) 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.app.ActivityThread.access$600(ActivityThread.java:153) 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269) 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.os.Handler.dispatchMessage(Handler.java:99) 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.os.Looper.loop(Looper.java:137) 12-30 22:19:19.395: E/AndroidRuntime(2254): at android.app.ActivityThread.main(ActivityThread.java:5289) 12-30 22:19:19.395: E/AndroidRuntime(2254): at java.lang.reflect.Method.invokeNative(Native Method) 12-30 22:19:19.395: E/AndroidRuntime(2254): at java.lang.reflect.Method.invoke(Method.j…
has comment: http://stackoverflow.com/comment/31272618

http://stackoverflow.com/comment/31216670
comment on: http://stackoverflow.com/a/20817811
score: 0
has text: Thank you, I did what you suggested and made a few other minor improvements.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20841685
type: Answer
has body: There is of course the Java EE validation API. How suitable it is for you depends on your environment.
answers question: http://stackoverflow.com/q/20841593
score: 0

http://stackoverflow.com/comment/30994021
comment on: http://stackoverflow.com/a/20694293
type: AnswerComment
type: Comment
score: 1
has text: @lamahewa Well, *which type* provides the `executeQuery` function? Is this an interface (that vendors will supply an implementation to) or a class (of which there is already an implementation)? Also, it isn't very practical for a vendor-agnostic method (implementation) to return an instance of a vendor-specific class.

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/20772897
type: Tag
tags question: http://stackoverflow.com/q/20765850

http://stackoverflow.com/a/20777560
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20777511
downvote count: 0
has body: Strictly speaking, there's no such semantics in C++. If you want to pass an interface to a function, you take a pointer or reference to it as a parameter, and implement the interface in a separate class. You'll have one of the following member function (following your names) myClass::setInterface(MyInterface* ptr); //or myClass::setInterface(MyInterface&amp; ref); and then the implementation class MyInterfaceImpl : public MyInterface{ //Stuff } You can then pass a pointer to a MyInterfaceImpl to setInterface, but you can't define an implementation on-the-fly and pass it this way to the function. EDIT: If you want something close to this behavior, consider πάντα ῥεῖ answer, or implementing the class just before you create an instance and pass it to the function, though that's quite unusual in my experience, and clutters the code with local class definition)

http://stackoverflow.com/comment/31283234
comment on: http://stackoverflow.com/q/20845954
type: Comment
has text: An `svn update` should resolve this problem. If it doesn't, then it should give you an error. In that case please paste the error into your question.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/126557202
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20693131
has text: And just to add to the contusion, there are probably special cases where the two methods in the question will not give the same result.
type: Comment

http://stackoverflow.com/comment/101031306
has text: Facing same issue. Added "org.hibernate" % "hibernate-entitymanager" % "4.3.8.Final" and replaced with javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.1-api"), javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"), still having the same issue.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20800857

http://stackoverflow.com/comment/31122146
has text: How do you run your unit tests ? (From eclipse? Command line? Maven? Ant?...)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20764468
score: 0

http://stackoverflow.com/q/20787976
accepted answer: http://stackoverflow.com/a/20788017
has comment: http://stackoverflow.com/comment/31161831
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31161723
has answer: http://stackoverflow.com/a/20788036
has answer: http://stackoverflow.com/a/20788523
has comment: http://stackoverflow.com/comment/31161405
tagged with: java
has answer: http://stackoverflow.com/a/20788006
has comment: http://stackoverflow.com/comment/31161626
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/20788087
has comment: http://stackoverflow.com/comment/31161855
has comment: http://stackoverflow.com/comment/31161407
type: Question
has comment: http://stackoverflow.com/comment/31161797
possible better answer: http://stackoverflow.com/a/20788006
has title: Parameter passing to static method
answer count: 6
has comment: http://stackoverflow.com/comment/31161669
has comment: http://stackoverflow.com/comment/31161806
has comment: http://stackoverflow.com/comment/31161373
tagged with: static-methods
score: 0
has comment: http://stackoverflow.com/comment/31161743
has answer: http://stackoverflow.com/a/20788065
has comment: http://stackoverflow.com/comment/31161590
has comment: http://stackoverflow.com/comment/31161528
linked to: http://stackoverflow.com/q/1092099
has comment: http://stackoverflow.com/comment/31161422
has body: I this code, the out put is 6, But i think that it should be 4 Why output is 6?
has answer: http://stackoverflow.com/a/20788017

http://stackoverflow.com/comment/31176642
has text: No, that's it. You should learn how to work with your logging system. Both log4j and logback make it easy to change the log levels of loggers by just changing a config file in your top-level project.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20795882

http://stackoverflow.com/q/20808437
tagged with: maven
type: AnsweredQuestion
has body: I am trying to install GraniteDS sample project using maven 3.1.1 under windows 7 64 bit. I was following the tutorial published on : https://github.com/graniteds-tutorials/graniteds-tutorial-data Reproduced steps: Installed maven 3.1.1 (extracted binary zip and create M2_HOME, M2 variables and added "%M2_HOME%\bin" to PATH) Installed git 1.8.5.2 for windows Run git shell, and execute: cd c:\dev\ws_flex\fb4.7 git clone http://github.com/graniteds-tutorials/graniteds-tutorial-data.git cd graniteds-tutorial-data mvn clean install asciidoctor:process-asciidoc -Dserver=spring -Dclient=air And i'm geting Error: [ERROR] Failed to execute goal on project tutorial-data-server-model: Could not resolve dependencies for project org.graniteds.tutorials:tutorial-data-server-mo del:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.granite ds:granite-server:jar:3.0.0.SNAPSHOT, org.graniteds:granite-server-hibernate4:ja r:3.0.0.SNAPSHOT, org.graniteds:granite-server-eclipselink:jar:3.0.0.SNAPSHOT, o rg.graniteds:granite-server-openjpa:jar:3.0.0.SNAPSHOT: Could not find artifact org.graniteds:granite-server:jar:3.0.0.SNAPSHOT -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o n project tutorial-data-server-model: Could not resolve dependencies for project org.graniteds.tutorials:tutorial-data-server-model:jar:1.0-SNAPSHOT: The follow ing artifacts could not be resolved: org.graniteds:granite-server:jar:3.0.0.SNAP SHOT, org.graniteds:granite-server-hibernate4:jar:3.0.0.SNAPSHOT, org.graniteds: granite-server-eclipselink:jar:3.0.0.SNAPSHOT, org.graniteds:granite-server-open jpa:jar:3.0.0.SNAPSHOT: Could not find artifact org.graniteds:granite-server:jar :3.0.0.SNAPSHOT and more... and a few debug warnings [DEBUG] Could not find metadata org.graniteds:granite-server:3.0.0.SNAPSHOT/mave n-metadata.xml in local (C:\Users\devel\.m2\repository) [DEBUG] Could not find metadata org.graniteds:granite-server:3.0.0.SNAPSHOT/mave n-…
tagged with: java
tagged with: apache-flex
has answer: http://stackoverflow.com/a/20816659
type: Question
tagged with: air
accepted answer: http://stackoverflow.com/a/20816659
has title: GraniteDS 3.0 tutorial project maven install error
score: 0
answer count: 1
tagged with: graniteds

http://stackoverflow.com/q/20833438
has answer: http://stackoverflow.com/a/20834380
type: AnsweredQuestion
tagged with: java
has title: Query showing extra row
type: Question
has comment: http://stackoverflow.com/comment/31246760
accepted answer: http://stackoverflow.com/a/20834380
score: 0
tagged with: sql
answer count: 1
has body: &lt;% String qTotal = "SELECT MsThread.ID, MsThread.ThreadName, Count(MsThread.ThreadName) AS TotalPost, ThreadCategory FROM MsThread LEFT OUTER JOIN MsPosts ON MsThread.ThreadName = MsPosts.ThreadName GROUP BY MsThread.ID, MsThread.ThreadName, MsThread.ThreadCategory;"; ResultSet rs = stmt.executeQuery(qTotal); int size = 0; while(rs.next()) { out.print(size++);%&gt;&lt;br/&gt;&lt;% } rs.first(); out.println(rs.getString("id")); rs.next(); out.println(rs.getString("id")); rs.next(); out.println(rs.getString("id")); if(!rs.next()) { out.println("no data"); } else out.println(rs.getString("id")); %&gt; Guys, here's what happened, when i tried to run the query it shows 3 result (http://s29.postimg.org/6qiv9kc9j/ss_forum.png) but when i run the while(rs.next())size++; it returns 4, and when i try to show the data, it gives me invalid cursor state, so is there anything wrong with my query? thanks

http://stackoverflow.com/a/20783478
type: Answer
answers question: http://stackoverflow.com/q/20782009
has body: Your method movedata just returns what you give it as an argument. If you want to return the local variable you have to use this: public String movedata(String myinput){ return this.myinput; } But then again, why does the method have the myinput argument in the first place...? You should work on your question more.
score: 0

http://stackoverflow.com/a/20816003
has body: In the xml file, change the id of ListView to "@android:id/list". The program will work fine. Hope it helped. :)
accepted answer of: http://stackoverflow.com/q/20815582
type: Answer
answers question: http://stackoverflow.com/q/20815582
score: 0
has comment: http://stackoverflow.com/comment/31215934
has comment: http://stackoverflow.com/comment/31213566
type: AcceptedAnswer

http://stackoverflow.com/q/20707739
tagged with: classcastexception
has answer: http://stackoverflow.com/a/20707914
has comment: http://stackoverflow.com/comment/31017177
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31017301
score: 1
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31017321
has answer: http://stackoverflow.com/a/20709402
has body: Two classes: public class ClassA implements ClassC { private static final long serialVersionUID = 1111111111111111111L; public String varA; } public class ClassB extends ClassA implements ClassC { private static final long serialVersionUID = 4604935970051141456L; public String varB; } In my code I have this declaration: ClassB classB; and a method myMethod() that returns a ClassA object. If I write: classB = (ClassB) myMethod(); I thought that I will have: classB.varA = &lt;a value from myMethod()&gt; classB.varB = null but this is not so: I receive a ClassCastException. Why? And how can assign the myMethod() to ClassB in a fast way?
answer count: 3
has title: Downcast gives ClassCastException
downvote count: 1
accepted answer: http://stackoverflow.com/a/20707914
has answer: http://stackoverflow.com/a/20707787
favorite count: 0
possible better answer: http://stackoverflow.com/a/20709402
tagged with: extends

http://stackoverflow.com/q/20693227
has title: First attempt to SSO login to weblogic fails right after weblogic started. Same SSO request 2nd time (and after) succeeds
tagged with: java
has comment: http://stackoverflow.com/comment/31015628
linked to: http://stackoverflow.com/q/19666857
has answer: http://stackoverflow.com/a/20742702
type: Question
has comment: http://stackoverflow.com/comment/30992247
tagged with: weblogic
tagged with: session
has body: My question refers to a previously asked question on stackoverflow which was never answered: Why does weblogic's "not found" behavior change after the first attempt? In my case, I'm implementing a SAML solution to log in from the identity provider to the external service provider. The external service provider (ESP) is hosted on weblogic 9.2.3. On my first attempt after i startup weblogic to SSO-login to the ESP service provider, i can see in the logs that the app proceeds to build a redirect url normally. On the response.sendRedirect() call, I see that the ESP has received a new request to the "home login" page -- the page users would be directed to if they weren't logged in. It seems to not know it (the servlet) has already been initialized, and then acts as if there is no login session and forwards to the login form page (as if they've not been logged in). I've checked all the weblogic logs and our application logs, but there's no clue as to why this is happening. I've seen this on other weblogic sso projects before. It wasn't a problem with those because those other projects typically had a high volume of users logging in through the ESP form before the first SSO request was made. (It only takes one attempt.) Also, because of the volume on previous projects, i wasn't able to consistently reproduce the problem...until now. The previous stackoverflow post of this nature (which wasn't answered) is the only relevant search result google gives me. Big thank you to anyone who has some insight as to what the problem is.
has comment: http://stackoverflow.com/comment/31017770
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/31035104
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20717270
has text: Check out the hierarchy in my edit

http://stackoverflow.com/a/20723558
has comment: http://stackoverflow.com/comment/31046503
type: Answer
has body: All cells in GridLayout have equal size. You have to use GridBagLayout or SpringLayout or BoxLayout .
answers question: http://stackoverflow.com/q/20723448
has comment: http://stackoverflow.com/comment/31046657
has comment: http://stackoverflow.com/comment/31046754
has comment: http://stackoverflow.com/comment/31046877
has comment: http://stackoverflow.com/comment/31046963
score: 0
has comment: http://stackoverflow.com/comment/31046795
has comment: http://stackoverflow.com/comment/31046685

shell
tags question: http://stackoverflow.com/q/20784371
tags question: http://stackoverflow.com/q/20680913
tags question: http://stackoverflow.com/q/20683873
tag name: shell
tags question: http://stackoverflow.com/q/20714947
type: Tag
tags question: http://stackoverflow.com/q/20737082
tags question: http://stackoverflow.com/q/20789943
tags question: http://stackoverflow.com/q/20767490
tags question: http://stackoverflow.com/q/20704711

http://stackoverflow.com/a/20828367
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20828354
has body: try java -jar "C:\Dropbox\Java\Updater Test\Updater.jar"
upvote count: 5
score: 5

http://stackoverflow.com/a/20740984
has comment: http://stackoverflow.com/comment/31078298
has body: Google and Wikipedia are your friends. Instead of long-array I would use int-array. On Wikipedia following java code is published (together with detailed explanation of Luhn algorithm): public static boolean check(int[] digits) { int sum = 0; int length = digits.length; for (int i = 0; i &lt; length; i++) { // get digits in reverse order int digit = digits[length - i - 1]; // every 2nd number multiply with 2 if (i % 2 == 1) { digit *= 2; } sum += digit &gt; 9 ? digit - 9 : digit; } return sum % 10 == 0; } You should work on your input processing code. I suggest you to study following solution: public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean repeat; List&lt;Integer&gt; digits = new ArrayList&lt;Integer&gt;(); do { repeat = false; System.out.print("Enter your Credit Card Number : "); String input = in.next(); for (int i = 0; i &lt; input.length(); i++) { char c = input.charAt(i); if (c &lt; '0' || c &gt; '9') { repeat = true; digits.clear(); break; } else { digits.add(Integer.valueOf(c - '0')); } } } while (repeat); int[] array = new int[digits.size()]; for (int i = 0; i &lt; array.length; i++) { array[i] = Integer.valueOf(digits.get(i)); } boolean valid = check(array); System.out.println("Valid: " + valid); }
type: Answer
upvote count: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/31079389
answers question: http://stackoverflow.com/q/20740444
score: 9
has comment: http://stackoverflow.com/comment/62220875

http://stackoverflow.com/a/20838298
has comment: http://stackoverflow.com/comment/59063312
answers question: http://stackoverflow.com/q/20838244
has comment: http://stackoverflow.com/comment/59064047
has comment: http://stackoverflow.com/comment/31254175
has comment: http://stackoverflow.com/comment/31254705
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31254270
downvote count: 0
has comment: http://stackoverflow.com/comment/31254346
score: 16
has body: Well: FileReader is just a Reader which reads a file, using the platform-default encoding (urgh) BufferedReader is a wrapper around another Reader, adding buffering and the ability to read a line at a time Scanner reads from a variety of different sources, but is typically used for interactive input. Personally I find the API of Scanner to be pretty painful and obscure. To read a text file, I would suggest using a FileInputStream wrapped in an InputStreamReader (so you can specify the encoding) and then wrapped in a BufferedReader for buffering and the ability to read a line at a time. Alternatively, you could use a third-party library which makes it simpler, such as Guava: File file = new File("foo.txt"); List&lt;String&gt; lines = Files.readLines(file, Charsets.UTF_8); Or if you're using Java 7, it's already available for you in java.nio.file.Files: Path path = FileSystems.getDefault().getPath("foo.txt"); List&lt;String&gt; lines = Files.readAllLines(path, StandardCharsets.UTF_8);
accepted answer of: http://stackoverflow.com/q/20838244
has comment: http://stackoverflow.com/comment/31254510
upvote count: 16

http://stackoverflow.com/a/20775367
type: Answer
has body: How does this fit your needs? If you plan to add more content, then the root component can be ScrollView with the background. But with only one TextView, there should be no need for ScrollView unless the text is huge. <TextView android:id="@+id/two" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="testing ytestifnfndfijdfhffdkjdfkjfdjkj" android:textSize="25sp" />
answers question: http://stackoverflow.com/q/20775111
score: 0

http://stackoverflow.com/a/20686878
type: Answer
has comment: http://stackoverflow.com/comment/30984466
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20686527
answers question: http://stackoverflow.com/q/20686527
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30979613
has body: Java is very flexible in this case, plus there are many custom libraries enable you to do this(log4j). As you dont want to use any of them, but still allow you to do it flexibly with out recompiling the code, Define a properties file (say custom.properties) enabledebug=true Define a global property class Global { public static boolean DEBUGFLAG=false; } Define a method to read the property and the the flag value to global variable public void load() { Properties props = new Properties(); FileInputStream fis = new FileInputStream("....custom.properties") props.load(fis); Global.DEBUGFLAG= Boolean.valueOf(props.get("enabledebug")); } Invoke load method from main method use the flag when ever you need to print verbose if(Global.DEBUGFLAG) { //print some thing }

http://stackoverflow.com/q/20711056
score: 3
has answer: http://stackoverflow.com/a/41485827
downvote count: 0
tagged with: java
has body: I am completely new to Maven and Spring MVC. What I am looking to do is to set up a new Spring MVC project, using Maven (hopefully this sentence makes sense), and run my web app on Tomcat using Eclipse. I am following the tutorial at this link and I have a problem with the pom.xml file: Getting Started with Maven and Spring The tutorial asks to create the folder structure, and to create a pom.xml file. For starters they ask to put this line in pom.xml: xml 4.0.0org.springsource.greenbeans.mavenexample11.0-SNAPSHOTOur Simple Project But when I do that, my Eclipse throws an error: [INFO] Scanning for projects... [ERROR] The build could not read 1 project -&gt; [Help 1] [ERROR] [ERROR] The project (D:\projectName\pom.xml) has 1 error [ERROR] Non-parseable POM D:\projectName\pom.xml: only whitespace content allowed before start tag and not ` (position: START_DOCUMENT seen `... @1:1) @ line 1, column 1 -&gt; [Help 2] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException Any idea on what the right minimum pom.xml could be? I tried many things but it didn't work for me...
type: Question
tagged with: eclipse
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/20711177
has title: Minimum pom.xml file for new Maven / Spring MVC project
tagged with: pom.xml
has answer: http://stackoverflow.com/a/70323488
favorite count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: spring

http://stackoverflow.com/comment/31122900
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20765924
type: Comment
has text: `temp` should be eliminated as it is not used. However, even if it where not the stack allocation would be the same.

http://stackoverflow.com/a/20776432
has comment: http://stackoverflow.com/comment/31141504
has comment: http://stackoverflow.com/comment/31141425
has comment: http://stackoverflow.com/comment/31141494
answers question: http://stackoverflow.com/q/20776413
has body: If no modifier (e.g., public) is used then only the class and the package can run the method. This means that the outside world can't run the main method. That, in turn, is why you need to define the method with public.
has comment: http://stackoverflow.com/comment/31141901
has comment: http://stackoverflow.com/comment/31141591
has comment: http://stackoverflow.com/comment/31141458
score: 0
has comment: http://stackoverflow.com/comment/31141471
type: Answer

http://stackoverflow.com/q/20736791
has body: My app has a mainactivity ... public class MainActivity extends Activity { GameView gameView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gameView = new GameView(this); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(gameView); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // we dont know yet tho return true; } @Override protected void onPause() { super.onPause(); gameView.gameLoopThread.onPause(); } @Override protected void onResume() { super.onResume(); gameView.gameLoopThread.onResume(); } } and the gameLoopThread is public class GameLoopThread extends Thread { private GameView view; private boolean isRunning = false; static final long FPS = 32; private boolean mPaused = false; private Object mPauseLock; public GameLoopThread(GameView view) { this.view = view; mPauseLock = new Object(); } public void setIsRunning(boolean isRunning) { this.isRunning = isRunning; } @SuppressLint("WrongCall") @Override public void run() { long ticksPS = 1000 / FPS; long startTime; long sleepTime; while (isRunning) { Canvas c = null; startTime = System.currentTimeMillis(); try { c = view.getHolder().lockCanvas(); synchronized (view.getHolder()) { view.onDraw(c); } } finally { if (c != null) { view.getHolder().unlockCanvasAndPost(c); } } sleepTime = ticksPS - (System.currentTimeMillis() - startTime); try { if (sleepTime &gt; 0) sleep(sleepTime); else sleep(10); } catch (Exception e) { } synchronized (mPauseLock) { while (mPaused) { try { mPauseLock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } } public void onPause() { synchronized (mPauseLock) { mPaused = true; } } public void onResume() { synchronized (mPauseLock) { mPaused = false; mPauseLock.notifyAll(); } } } anyway the onResume() in the …
has comment: http://stackoverflow.com/comment/31071507
type: Question
upvote count: 2
has title: Android: onResume in MainActivity not called
has comment: http://stackoverflow.com/comment/31071380
answer count: 2
has comment: http://stackoverflow.com/comment/31071803
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/31071569
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/31071855
score: 2
has comment: http://stackoverflow.com/comment/31079407
has answer: http://stackoverflow.com/a/20737148
has answer: http://stackoverflow.com/a/20739709
downvote count: 0
tagged with: java

http://stackoverflow.com/q/20744459
has comment: http://stackoverflow.com/comment/31084280
has comment: http://stackoverflow.com/comment/31085276
has comment: http://stackoverflow.com/comment/31084178
has answer: http://stackoverflow.com/a/20745101
has comment: http://stackoverflow.com/comment/31084023
has comment: http://stackoverflow.com/comment/31085043
has comment: http://stackoverflow.com/comment/31084682
type: Question
has comment: http://stackoverflow.com/comment/31084317
has body: I need to convert ByteArrayOutputStream to String but I can't figure out the encoding. Please help ? I tried Using ICUJ library but It only works for input stream. A conversion from byte array to input stream is also fine. Here's a sample of what I'm getting using the default encoding. Clearly the new lines are not supposed be there. \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Dec 23, 2013, 7:11 PM \n \n \n \n \n \n \n The following items have errors:\n \n \n \n Chart (id = 12): \n
has comment: http://stackoverflow.com/comment/31084115
has title: How to determine encoding of an ByteArrayOutputStream?
has answer: http://stackoverflow.com/a/20744530
has comment: http://stackoverflow.com/comment/31091004
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31084856
has comment: http://stackoverflow.com/comment/31084064
has comment: http://stackoverflow.com/comment/31084147
has comment: http://stackoverflow.com/comment/31085459
has comment: http://stackoverflow.com/comment/31085129
has comment: http://stackoverflow.com/comment/31084477
tagged with: java
has comment: http://stackoverflow.com/comment/31084223
type: UnansweredQuestion

http://stackoverflow.com/comment/31238533
has text: you are right, but i don't say how to programming, i give an idea how to solve this problem
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/20829604
type: Comment

http://stackoverflow.com/comment/30976995
type: AnswerComment
comment on: http://stackoverflow.com/a/20685397
score: 0
type: Comment
has text: Not sure what I was thinking now that you mention it. Hmmm.. should I just have the Permutation(); and Combination(); methods inside there? I guess i gotta assign buttonListeners somewhere else

http://stackoverflow.com/q/20801219
tagged with: solr
upvote count: 1
type: Question
tagged with: lucene
has answer: http://stackoverflow.com/a/20813820
tagged with: apache
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Replication of solr Lucene index failing with following error message
score: 1
has body: I am getting below error when running solr replication 2013-12-27 05:03:32,391 [explicit-fetchindex-cmd] ERROR org.apache.solr.handler.ReplicationHandler- SnapPull failed :org.apache.solr.common.SolrException: Index fetch failed : at org.apache.solr.handler.SnapPuller.fetchLatestIndex(SnapPuller.java:485) at org.apache.solr.handler.ReplicationHandler.doFetch(ReplicationHandler.java:319) at org.apache.solr.handler.ReplicationHandler$1.run(ReplicationHandler.java:220) Caused by: java.io.EOFException: read past EOF: MMapIndexInput(path="/apps/search/data/customers/solr/solr/adidas-archive/data/index.20131227050332242/segments_a") at org.apache.lucene.store.ByteBufferIndexInput.readByte(ByteBufferIndexInput.java:78) at org.apache.lucene.store.ChecksumIndexInput.readByte(ChecksumIndexInput.java:41) at org.apache.lucene.store.DataInput.readInt(DataInput.java:84) at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:320) at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:380) at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:812) at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:663) at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:376) at org.apache.lucene.index.IndexWriter.&lt;init&gt;(IndexWriter.java:711) at org.apache.solr.update.SolrIndexWriter.&lt;init&gt;(SolrIndexWriter.java:77) at org.apache.solr.update.SolrIndexWriter.create(SolrIndexWriter.java:64) at org.apache.solr.update.DefaultSolrCoreState.createMainIndexWriter(DefaultSolrCoreState.java:267) at org.apache.solr.update.DefaultSolrCoreState.newIndexWriter(DefaultSolrCoreState.java:179) at org.apache.solr.update.DirectUpdateHandler2.newIndexWriter(DirectUpdateHandler2.java:632) at org.apache.solr.handler.SnapPuller.fetchLatestIndex(SnapPuller.java:469) ... 2 more My step-up is Master on 3.x and Slave on 4.x. This happened when I copied very large index 100 g+. What does this error means ? Does it means that index h…
tagged with: java

http://stackoverflow.com/comment/31036012
type: Comment
comment on: http://stackoverflow.com/a/20717814
has text: Haha, thank you! It's like a X-mas present and I'm just exploring the moderator tools. :)
type: AnswerComment
score: 0

http://stackoverflow.com/q/20716424
answer count: 2
tagged with: sql
accepted answer: http://stackoverflow.com/a/20720762
tagged with: awt
has body: I write the program to retrieve data from database to show on JTable. The program can run without the error but It doesn't show the column name. Here the code: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection dbcon = DriverManager.getConnection("" +"jdbc:sqlserver://localhost;databaseName=Store;user=sa;password=t81iS17Zxj"); Statement sqlstatement = dbcon.createStatement(); ResultSet dbresultset = sqlstatement.executeQuery("select * from Store.dbo.Product"); rsmetadata = dbresultset.getMetaData(); // Get metadata on them numcols = rsmetadata.getColumnCount(); // How many columns? // Get column names for (int i = 1; i &lt;= numcols; i++) { defaultmodel.addColumn( rsmetadata.getColumnName(i)); } // Get row data while (dbresultset.next()) { Vector&lt;Object&gt; row = new Vector&lt;Object&gt;(numcols); for (int i = 1; i &lt;= numcols; i++) { row.addElement( dbresultset.getObject(i) ); } defaultmodel.addRow(row ); } I try to print the value of rsmetadata.getColumnName(i) out and then Eclipse show me the column name but why in the above,it doesn't show.
type: AnsweredQuestion
has title: Not show column name from database on Jtable
possible better answer: http://stackoverflow.com/a/20716634
has comment: http://stackoverflow.com/comment/31033431
has answer: http://stackoverflow.com/a/20716634
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20720762
tagged with: java
tagged with: jtable
score: 0

http://stackoverflow.com/comment/31074636
comment on: http://stackoverflow.com/q/20738634
score: 0
has text: @EvgeniyDorofeev: Because user can subscribe and unsubscribe later and subscribe again even in one day.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/30969795
score: 0
type: Comment
has text: As per your JSON creation this is correct code. I am able to parse JSON Object.
comment on: http://stackoverflow.com/a/20680566
type: AnswerComment

http://stackoverflow.com/comment/31235302
type: QuestionComment
comment on: http://stackoverflow.com/q/20828057
has text: what is line 73 `SinglePlaceDetails.java`
score: 1
type: Comment

http://stackoverflow.com/comment/31167431
has text: `type var = val;` is a variable declaration with initializer, `var = val;` is an assignment according to the Java syntax.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20791064

http://stackoverflow.com/comment/31143550
score: 0
has text: @Jan yeah this is another bug. (I mentioned that there are several bugs) I plan to send the pull request to the author actually: after fixing all these bugs, I have tested this implementation with original C implementation, it works together now.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20776497

http://stackoverflow.com/comment/31151525
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20782301
has text: They probably didn't even thought about this.

http://stackoverflow.com/q/20758207
has title: Maven does not resolve org.apache.velocity lib
has body: What I have: I need to use org.apache.velocity in my project. So I add the next strings to pom.xml: org.apache.velocity velocity 1.7 Problem: But maven doesn't include that lib into External Libraries of the project. As result, I can't use those classes. I noticed that maven log contain strings: [INFO] --- maven-shade-plugin:2.1:shade (default) @ id---- [INFO] Including org.apache.velocity:velocity:jar:1.7 in the shaded jar. What I've trie:d Clear local maven repo (.m2) Rebuil project + all possible maven commands: clean install, clean compile.. etc. P.S. On all computer of my colleagues all works well. The use the same IDE, the same project version, all is the same! Question: What can I try to resolve my problem? EDIT 4.0.0 id id jar 1.0-SNAPSHOT NAME http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <jackson.version>2.1.1</jackson.version> <slf4j.version>1.6.4</slf4j.version> <testng.version>6.8.5</testng.version> <tumbler.version>0.4.1</tumbler.version> <jmockit.version>1.0</jmockit.version> <!--<sonar-maven-plugin.version>3.4.1</sonar-maven-plugin.version> --> <maven-surefire-plugin.version>2.8.1</maven-surefire-plugin.version> 2.3 <java.language.version>1.7</java.language.version> <groovy.version>2.1.5</groovy.version> central Maven Repository Switchboard default http://repo1.maven.org/maven2 false codehaus http://repository.codehaus.org/org/codehaus true true onejar-maven-plugin.googlecode.com http://onejar-maven-plugin.googlecode.com/svn/mavenrepo org.apache.velocity velocity 1.7 com.fasterxml.jackson.core jackson-databind ${jackson.version} com.fasterxml.jackson.core jackson-core ${jackson.version} com.fasterxml.jackson.core jackson-annotations ${jackson.version} org.testng testng ${testng.version} org.apache.commons commons-lang3 3.1 commons-codec commons-codec 1.8 org.slf4j slf4j-log4j12 ${slf4j.version} postgresql postgresql 9.1-901-1.jdbc4 com.googlecode.jmockit jmockit ${jmockit.version} org.springframework sprin…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31111524
accepted answer: http://stackoverflow.com/a/20758337
has comment: http://stackoverflow.com/comment/31109397
tagged with: velocity
tagged with: maven
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31111651
has answer: http://stackoverflow.com/a/20758337

http://stackoverflow.com/comment/31135653
type: Comment
comment on: http://stackoverflow.com/a/20761947
has text: @AhamedMustafaM Obviously it depends on what you consider to be 'action based'. JSF has a workflow based on user-executed actions. It could be compared with Struts, where a performed action also results in a forward. Having used both of them, JSF is for me in both 1.x and 2.x branches further much more simpler to use, specially latest versions.
type: AnswerComment
score: 0

http://stackoverflow.com/a/20709879
answers question: http://stackoverflow.com/q/20709447
has comment: http://stackoverflow.com/comment/31021398
downvote count: 0
has comment: http://stackoverflow.com/comment/31021293
has comment: http://stackoverflow.com/comment/31022413
has comment: http://stackoverflow.com/comment/31022079
type: Answer
has comment: http://stackoverflow.com/comment/31021312
has body: You have an off-by-one error: you create a CyclicBarrier for 100 threads, but execute 101 awaits, the one-off being in the main method. Due to the semantics of the cyclic barrier, and subject to nondeterministic conditions, your main thread will be the last to execute await, thereby being left alone waiting for another 99 threads to join in. After you fix this problem, you'll find out that the application keeps running even after all work is done. This is because you didn't call e.shutdown(), so all the threads in the pool stay alive after the main thread is done. BTW getNumberWaiting always shows 0 for me, which is the expected value after the barrier has been lowered due to 100 submitted threads reaching it. This is nondeterministic, however, and could change at any time.
score: 5
has comment: http://stackoverflow.com/comment/31021688
has comment: http://stackoverflow.com/comment/31021663
upvote count: 5
has comment: http://stackoverflow.com/comment/31021501

http://stackoverflow.com/q/20750479
has title: Knights tour backtracking Java
has comment: http://stackoverflow.com/comment/31095857
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20750661
answer count: 2
tagged with: knights-tour
downvote count: 0
has comment: http://stackoverflow.com/comment/31095792
has comment: http://stackoverflow.com/comment/31095743
has body: I am trying to solve the Knights tour problem on a 4x4 board with backtracking and recursion in java, and on the output I get this step sequence: 1&nbsp; 13 &nbsp; 16&nbsp; 15 10 &nbsp;7 &nbsp; 4 &nbsp; 14 5 &nbsp;&nbsp; 2 &nbsp; 11 &nbsp; 8 12 &nbsp;9 &nbsp; 6 &nbsp; 3 in the right upper corner, the 14, 15 and 16 neighbour with each other, which is impossible, because the knight moves on the chessboard into an L-shape. I would be thankful if someone could help me solve this. the code: public class KnightsTour { private static int board[][] = new int[4][4]; private static int stepCounter = 1; public Test() { initBoard(board); tour(0,0); printSol(board); } public static void printSol(int[][] a) { for (int i = 0; i &lt; a.length; i++) { for (int j = 0; j &lt; a[i].length; j++) { if(a[i][j]&gt;9){ System.out.print(a[i][j] + " "); }else{ System.out.print(a[i][j] + " "); } } System.out.println(); } System.out.println(); } public static void initBoard(int[][] a) { for (int i = 0; i &lt; a.length; i++) { for (int j = 0; j &lt; a[i].length; j++) { a[i][j] = -1; } } } public void tour(int x, int y) { if (((x &lt; 0) || (x &gt;= 4) || (y &lt; 0) || (y &gt;= 4)) || (board[x][y] != -1)) { return; }else{ board[x][y] = stepCounter++; tour(x+2, y+1); tour(x+1, y-2); tour(x+1, y+2); tour(x-1, y+2); tour(x-2, y-1); tour(x-2, y+1); tour(x-1, y-2); tour(x+2, y-1); } } public static void main(String[] args){ new KnightsTour(); } }
tagged with: backtracking
favorite count: 0
has answer: http://stackoverflow.com/a/20750610
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: recursion

http://stackoverflow.com/q/20688043
tagged with: postgresql
has title: Hibernate: PSQLException: Error: Column "column_name" does not exist
has body: I'm trying to get information out of an existing database. hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> jdbc:postgresql://localhost:5432/ecm_politik_mt ecm ecm org.postgresql.Driver org.hibernate.dialect.PostgreSQLDialect org.hibernate.cache.EhCacheProvider thread org.hibernate.transaction.JDBCTransactionFactory <mapping class="com.database.Survey_question" /> </hibernate-configuration> The entity I try to map: package com.database; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "survey_question") public class Survey_question implements Serializable { @Id @GeneratedValue @Column(name = "id") private Integer id; @Column(name = "freetext") private boolean freetext; @Column(name = "idx") private Integer idx; @Column(name = "mandatory") private boolean mandatory; @Column(name = "multiplechoice") private boolean multiplechoice; @Column(name = "title") private String title; @Column(name = "sheet_id") private Integer sheet_id; public Survey_question() { } public boolean getFreetext() { return freetext; } public void setFreetext(boolean freetext) { this.freetext = freetext; } public Integer getIdx() { return idx; } public void setIdx(Integer idx) { this.idx = idx; } public boolean getMandatory() { return mandatory; } public void setMandatory(boolean mandatory) { this.mandatory = mandatory; } public boolean getMultiplechoice() { return multiplechoice; } public void setMultiplechoice(boolean multiplechoice) { this.multiplechoice = multiplechoice; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Integer getSheet_id() { return sheet_id; } public void setSheet_id(Integer sheet_id) { this.sheet_id = sheet_id; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Override public …
type: AnsweredQuestion
score: 4
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/32508116
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/30985854
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/32508116
favorite count: 0

http://stackoverflow.com/comment/31176190
has text: I have added a comparator, please see above.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20795040

http://stackoverflow.com/comment/31011395
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20703822
has text: Show us where you use `MainAction` bean.

http://stackoverflow.com/comment/31130377
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20726489
type: AnswerComment
has text: @peeskillet actually already had the pirate hat :) I'm wearing it!

http://stackoverflow.com/q/20812974
has answer: http://stackoverflow.com/a/36567370
favorite count: 0
has comment: http://stackoverflow.com/comment/31207639
answer count: 3
tagged with: android
type: UnansweredQuestion
has title: Close navigation drawer programmatically from another class
score: 13
has body: I currently am using Fragments in my app. In my MainActivity I have a navigation drawer which is then subsequently populated by a Fragment, as well as the main area in the activity which is populated by another Fragment. The clicking of an item in the navigation drawer is dealt with by my first fragment, only, the navigation drawer is in my MainActivity class. I can't seem to be able to close the navigation drawer (I can swipe it closed but I want it to auto close after an item has been clicked) from my fragment after an item has been clicked, is there any way to do this? Heres my code: MainActivity: public class MainActivity extends Activity { LinearLayout mainContent; LinearLayout background; SharedPreferences prefs; DataBase db; SQLiteDatabase mDB; DrawerLayout mDrawerLayout; ActionBarDrawerToggle mDrawerToggle; TextView divider; Typeface[] fonts = new Typeface[4]; Boolean isPortrait = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefs = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); String theme = prefs.getString("PREF_THEME", "holoWhite"); if (theme.equals("holoWhite")) { setTheme(R.style.AppBaseTheme); } else { setTheme(R.style.AppBaseThemeDark); } if(getResources().getConfiguration().orientation == getResources().getConfiguration().ORIENTATION_LANDSCAPE){ isPortrait = false; } setContentView(R.layout.activity_main); initialiseVariables(); setTheme(); loadInitialContentFragment(); SQLiteDatabase dataB = db.getWritableDatabase(); dataB.execSQL("DELETE FROM " + "StackTable"); dataB.close(); loadFrag(new LeftFragment(), null, R.id.mainLeftView); fonts[0] = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf"); fonts[1] = Typeface.createFromAsset(getAssets(), "Roboto-LightItalic.ttf"); fonts[2] = Typeface.createFromAsset(getAssets(), "Roboto-Medium.ttf"); fonts[3] = Typeface.createFromAsset(getAssets(), "Roboto-MediumItalic.ttf"); } @Override public boolean onCreateOptionsMen…
has answer: http://stackoverflow.com/a/34304016
upvote count: 13
has comment: http://stackoverflow.com/comment/31207405
has comment: http://stackoverflow.com/comment/31207382
tagged with: java
has answer: http://stackoverflow.com/a/22357383
type: Question
downvote count: 0

http://stackoverflow.com/q/20729207
score: 1
has body: i'm trying to send image from android to C# server using Socket, but something goes wrong. package com.example.clientsocket; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.Socket; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.widget.TextView; public class MainActivity extends Activity { TextView serverMessage; Thread m_objThreadClient; Socket clientSocket; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); serverMessage=(TextView)findViewById(R.id.textView1); } public void Start(View view) { m_objThreadClient=new Thread(new Runnable() { public void run() { try { clientSocket= new Socket("192.168.88.113",2001); //ObjectOutputStream oos = new ObjectOutputStream(clientSocket.getOutputStream()); File myFile = new File("/storage/sdcard0/Pictures/CameraSample/*.jpg"); InputStream fis = new FileInputStream("/storage/sdcard0/Pictures/CameraSample/*.jpg"); byte [] buffer = new byte[(int)myFile.length()]; fis.read(buffer,0,buffer.length); OutputStream outputStream = clientSocket.getOutputStream(); outputStream.write(buffer.length); outputStream.write(buffer,0,buffer.length); outputStream.flush(); outputStream.close(); clientSocket.close(); //byte [] buffer = new byte[(int)myFile.length()]; // ... //fis.read(buffer,0,buffer.length); //OutputStream os = clientSocket.getOutputStream(); //oos.writeObject("37"); //oos.flush(); //oos.writeObject(buffer); //os.write(37); //os.write(buffer); // &lt;- This one. /* int temp = 0 ; while((temp = fis.read(buffer)) != -1) { outputStream.write(buffer, 0, temp); } */ /* Message serverMessage= Message.obtain(); ObjectInputStream ois =new ObjectInputStream(clientSocket.getInputStream()); String strMessage = (Stri…
answer count: 2
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/20729316
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34280015
favorite count: 0
type: Question
has title: send image from android java to c# server on pc
tagged with: android

http://stackoverflow.com/a/20680510
has comment: http://stackoverflow.com/comment/30968495
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/30968897
has comment: http://stackoverflow.com/comment/30969072
has body: try{ String JSON ; JSONObject jso3 = new JSONObject(JSON); JSONArray menuObject = new JSONArray(jObject.getString("array_inside_json")); for(int i=0;i&lt;menuObject.length;i++){ name=jObject.getString("inside")); } }catch(Exception e){ } refer this link for more info
has comment: http://stackoverflow.com/comment/30968339
downvote count: 0
answers question: http://stackoverflow.com/q/20680356
type: Answer

http://stackoverflow.com/q/20768366
tagged with: postgresql
score: 0
answer count: 1
has body: I have a very small program that is going to be used by two or more computers at the same time. It's a small program that can add string to the list and remove it from the list. I save all these strings in a remote postgres database. When I delete string from the list, it gets deleted from the database however if the program is running on other computer you still can see this string. Currently I have only one option in mind which is refreshing data in program every x time ? Are there better options ? Database is very small, only one column and shouldnt be more than 100 rows.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20768392
accepted answer: http://stackoverflow.com/a/20768392
tagged with: java
has title: How to synchronize data within programs using a database?
type: Question
has comment: http://stackoverflow.com/comment/31127619

http://stackoverflow.com/comment/31047975
score: 5
type: Comment
has text: Why? How would you access each group?
comment on: http://stackoverflow.com/q/20724324
type: QuestionComment

http://stackoverflow.com/a/20683338
score: 2
downvote count: 0
has body: "The current day and the next day values are not correctly printing." nextDay() has no print statement public void nextDay() { Day++; if (Day &lt;8) Day = 1; setDay(Day); } And you actually need to call setDay() before Days has a value; Day myDay = new Day(); myDay.setDay(1); myDay.printDay(); And the fact that you have a class Day, and int Day and String Days is totally confusing for anyone who is reading your code. I'm surprised you're even able to follow it. Consider Java naming convention: variable names start with lower case.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/30973585
answers question: http://stackoverflow.com/q/20683189

http://stackoverflow.com/a/20827024
has comment: http://stackoverflow.com/comment/31240899
type: Answer
answers question: http://stackoverflow.com/q/20826972
score: 2
has body: Move ArrayList &lt;Student&gt; studentList = new ArrayList &lt;Student&gt;(); from options method to class field. EDIT: As you can see, now studentList is not a local variable of public static void options() but of the class. Anyway i edited the args of some methods because you don't need to pass students as argument since now it's a field of the class. import java.util.ArrayList; import java.util.Scanner; public class test { static ArrayList&lt;Student&gt; studentList = new ArrayList&lt;Student&gt;(); public static void main(String[] args) { menu(); } public static void menu() { Scanner in = new Scanner(System.in); int choice = 0; System.out.print("****STUDENT RECORD SYSTEM****\n\n"); System.out.println("\t MENU "); System.out.println("[1]ADD STUDENT"); System.out.println("[2]DISPLAY ALL"); System.out.println("[3]DISPLAY SPECIFIC"); System.out.println("[4]UPDATE"); System.out.println("[5]AVERAGE"); System.out.println("[6]EXIT"); System.out.println("?"); choice = in.nextInt(); if (choice == 1) { options(); } else if (choice == 2) { displayAll(); } else if (choice == 3) { displaySpecific(student);// here you should ask to the user what studend he want to show - here it continues to give you error } } public static void options() { Scanner in = new Scanner(System.in); char ans; String temp; int total; do { System.out.println("TOTAL: "); total = in.nextInt(); Student[] student = new Student[total]; for (int index = 0; index &lt; student.length; index++) { student[index] = new Student(); System.out.print("*********STUDENT INFORMATION*********\n\n"); System.out.println("PRESS ENTER"); in.nextLine(); System.out.print("ID NUMBER: "); student[index].setIdNumber(in.nextLine()); System.out.print("FIRST NAME: "); student[index].setFirstName(in.nextLine()); System.out.print("MIDDLE NAME: "); student[index].setMiddleName(in.nextLine()); System.out.print("LAST NAME: "); student[index].setLastName(in.nextLine()); System.out.print("DEGREE: "); student[index].setDegree(in.nextLine()…
upvote count: 2
has comment: http://stackoverflow.com/comment/31245432
has comment: http://stackoverflow.com/comment/31259025
has comment: http://stackoverflow.com/comment/31234375
has comment: http://stackoverflow.com/comment/31238857
has comment: http://stackoverflow.com/comment/31234523
has comment: http://stackoverflow.com/comment/31238556
downvote count: 0

http://stackoverflow.com/q/20775166
has comment: http://stackoverflow.com/comment/31140236
has comment: http://stackoverflow.com/comment/31139092
type: Question
tagged with: android
has body: So I'm parsing a website using jsoup and then displaying the html in a text view. It has some broken links so I have to go in and replace them. Here is some of my code: new Thread(new Runnable() { public void run() { try { Elements links = doc.select("a"); for (Element i: links){ String relHref = i.attr("abs:href"); if (!relHref.startsWith("http://") &amp;&amp; !relHref.startsWith("https://")){ html = html.replace(relHref, "http://www.bths.edu"+ relHref); } } runOnUiThread(new Runnable() { public void run() { article.setText(Html.fromHtml(set)); article.setMovementMethod(LinkMovementMethod.getInstance()); } }); Unfortunately, I keep getting this error: java.lang.OutOfMemoryError at java.lang.AbstractStringBuilder.&lt;init&gt;(AbstractStringBuilder.java:82) at java.lang.StringBuilder.&lt;init&gt;(StringBuilder.java:67) at java.lang.String.replace(String.java:1374) at com.tod.android.bths.ArticleViewer$2.run(ArticleViewer.java:78) at java.lang.Thread.run(Thread.java:856) Line 78 is html = html.replace(relHref, "http://www.bths.edu"+ relHref); I do not get an error when i make this switch String relHref = i.attr("href"); It's not what I need though... Why is it that abs:href gives me problems??? @Harald //So I've done this and now, I don't get an error. But nothing gets replaced. Why? if (!relHref.startsWith("http://") &amp;&amp; !relHref.startsWith("https://")&amp;&amp; relHref!="" ){ html = html.replace(relHref, "http://www.bths.edu"+ relHref); }
score: 0
has comment: http://stackoverflow.com/comment/31140555
answer count: 1
has comment: http://stackoverflow.com/comment/31139010
has answer: http://stackoverflow.com/a/20775588
has comment: http://stackoverflow.com/comment/31140398
tagged with: java
accepted answer: http://stackoverflow.com/a/20775588
has title: Replacing values in html
tagged with: jsoup
type: AnsweredQuestion

http://stackoverflow.com/q/20743250
tagged with: arrays
linked to: http://stackoverflow.com/q/9392511
has answer: http://stackoverflow.com/a/20743466
tagged with: android
tagged with: checkbox
has title: Get the ID of checkbox from custom adapter in android?
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/20743413
has body: I have a Custom ArrayList as follows. public class sendivitesadapter extends ArrayAdapter&lt;Item&gt;{ private Context context; private ArrayList&lt;Item&gt; items; private qrusers qrusers; private LayoutInflater vi; public sendivitesadapter(Context context,ArrayList&lt;Item&gt; items) { super(context, 0,items); this.context= context; this.qrusers =(qrusers) context; this.items = items; vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { // TODO Auto-generated method stub return super.getCount(); } @Override public Item getItem(int position) { // TODO Auto-generated method stub return super.getItem(position); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; final Item i = items.get(position); if (i != null) { if(i.isSection()){ SectionItem si = (SectionItem)i; v = vi.inflate(R.layout.checkboxlist, null); v.setOnClickListener(null); v.setOnLongClickListener(null); v.setLongClickable(false); final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text); sectionView.setText(si.getTitle()); }else{ sendItem ei = (sendItem)i; v = vi.inflate(R.layout.checkboxlist, null); final TextView title = (TextView)v.findViewById(R.id.contactname); final TextView subtitle = (TextView)v.findViewById(R.id.companyname); final CheckBox checkBox=(CheckBox)v.findViewById(R.id.checboxlist); if (title != null) title.setText(ei.contactname); if(subtitle != null) subtitle.setText(ei.companyname); } } return v; } and it looks like following image. My java file is as follows. @Override protected void onPostExecute(String result) { JSONArray jarray; try { jarray= new JSONArray(result); name= new String[jarray.length()]; company=new String[jarray.length()]; for (int i=0;i&lt;jarray.length();i++){ JSONObject jobj = jarray.getJSONObject(i); name[i]= jobj.getString("Name"); company[i]=jobj.getString("Company"); items.add(new sendItem(name[i], company[i], checkB…
has answer: http://stackoverflow.com/a/20743629
tagged with: android-arrayadapter
tagged with: java
score: 0
answer count: 3

http://stackoverflow.com/comment/31179322
type: Comment
has text: @user3138900 try above updated code added in java file section
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20797739

http://stackoverflow.com/q/20743131
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20765497
tagged with: java
has body: I have an ilog jrules execution server 7.1 installed. and I want to deploy a ruleApp that contains xom based on java jars. I don't know where can I package my resources jar for the ilog server? when i deploy it from the rule designer it doesn't package the xom jars, and I get this exception when trying to retrieve the wsdl: "this ruleset cannot be parsed, It used Java XOM with complex types, which is not supported by the hosted transparent decision service"
tagged with: ilog
type: Question
score: 0
tagged with: xom
has answer: http://stackoverflow.com/a/20746186
answer count: 2
tagged with: wsdl
has title: how to deploy a ruleApp contains xom that based on java jars to ilog execution server
tagged with: jrules

http://stackoverflow.com/comment/31231562
type: Comment
comment on: http://stackoverflow.com/q/20826190
type: QuestionComment
has text: And you forgot to close the `inputData` brackets
score: 0

http://stackoverflow.com/comment/30972740
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20683053
has text: +1, maybe not so *elegant* like the Java 8 solution below, but easy to understand at first glance

http://stackoverflow.com/comment/31081632
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20742350
has text: What intent filters do you use in your manifest? Also, do you want the application to launch upon scanning a tag or do you just want to receive tag discovery events while your app is visible?

http://stackoverflow.com/q/20831040
score: 0
has comment: http://stackoverflow.com/comment/31270370
possible better answer: http://stackoverflow.com/a/20839076
has comment: http://stackoverflow.com/comment/31270472
has comment: http://stackoverflow.com/comment/31269422
has answer: http://stackoverflow.com/a/20839076
has comment: http://stackoverflow.com/comment/31241323
tagged with: spring
has title: 404 error on spring security
type: Question
has answer: http://stackoverflow.com/a/20848133
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31241162
tagged with: java
has body: Using spring security with hibernate, When the user comes at /login and enters his credentials, he is supposed to be forwarded to /users/home . but he is not for the very first time he logins in, he is show a 404 message The requested resource is not available (some times at /favicon.ico if its on a live domain and localhost/ if its on localhost). If he returns back to the login page and logins again with SAME credentials, he is correctly landed to /users/home. why is that? http://pastie.org/8586150 spring security xml: &lt;security:form-login login-page="/login" authentication-failure-url="/login?error=true" default-target-url="/users/home"/&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider user-service-ref="customUserDetailsService"&gt; &lt;/security:authentication-provider&gt; &lt;/security:authentication-manager&gt; -Controller-------- @RequestMapping(value = "/users/home" ) public String userHome(ModelMap model, HttpServletRequest request) { User springUser = (User)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); String loginId = springUser.getUsername(); //get logged in username result = userService.getUserByLoginId(loginId); Users user = (Users)result.getObject(); HttpSession session = request.getSession(true); session.setAttribute("userName", user.getName()); // model.addAttribute("username", user.getName()); return "/users/home"; } package web.service.common; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Repository; import web.dao.UsersDAO; import web.dao.impl.jpa.UsersDAOImpl; import web.entity.Users; @Service public class CustomUserDetailsService implements UserDetailsService{ //@…
accepted answer: http://stackoverflow.com/a/20848133
has answer: http://stackoverflow.com/a/20847967
answer count: 3
has comment: http://stackoverflow.com/comment/31246362
tagged with: spring-security

http://stackoverflow.com/comment/31209630
type: QuestionComment
comment on: http://stackoverflow.com/q/20812663
has text: Jon under default constructor i meant constructor that takes no arguments, that was bad explanation on my side. The constructor always takes Hardware address and id
score: 0
type: Comment

http://stackoverflow.com/comment/31214219
type: QuestionComment
has text: It's [ROT13](http://en.wikipedia.org/wiki/ROT13), and the string is also reversed.
score: 0
comment on: http://stackoverflow.com/q/20816217
type: Comment

http://stackoverflow.com/comment/31041702
type: Comment
score: 0
has text: @Octopus thanks for the hint. However, when StringRepresantation object is printed in console, it gives this: { "partId": "23", "carId": "34", "name": "chassis", "section": "frame" }
type: QuestionComment
comment on: http://stackoverflow.com/q/20720955

http://stackoverflow.com/comment/31189283
comment on: http://stackoverflow.com/a/20803448
has text: Now i have my column names and column values in the map, how can i get those values
score: 0
type: AnswerComment
type: Comment

calculator
tags question: http://stackoverflow.com/q/20813075
tags question: http://stackoverflow.com/q/20719255
tags question: http://stackoverflow.com/q/20725717
tags question: http://stackoverflow.com/q/20829733
tags question: http://stackoverflow.com/q/20799657
type: Tag
tag name: calculator
tags question: http://stackoverflow.com/q/20845243
tags question: http://stackoverflow.com/q/20831100
tags question: http://stackoverflow.com/q/20736442

http://stackoverflow.com/a/20702577
answers question: http://stackoverflow.com/q/20702339
downvote count: 0
type: Answer
has body: In order to save unsigned ints you need a long. Then you need to truncate last 32 bits. You can use following trick to do it. final long UNSIGNED_INT_BITS = 0xffffffffL; int a = -3; long b = UNSIGNED_INT_BITS &amp; a; System.out.println(a); System.out.println(b); System.out.println(Long.toHexString(UNSIGNED_INT_BITS)); Output: -3 4294967293 ffffffff
score: 1
upvote count: 1

http://stackoverflow.com/comment/31179111
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20797737
score: 0
has text: What sort of "better" are you looking for?

http://stackoverflow.com/q/20819060
downvote count: 0
tagged with: xerces
score: 11
type: Question
has comment: http://stackoverflow.com/comment/31218547
linked to: http://stackoverflow.com/q/2396903
has answer: http://stackoverflow.com/a/34707513
has title: XML validation against XSD 1.1 with Xerces in Java
tagged with: java
linked to: http://stackoverflow.com/q/20807066
upvote count: 11
tagged with: xsd-1.1
has comment: http://stackoverflow.com/comment/31218514
possible better answer: http://stackoverflow.com/a/35991250
tagged with: validation
favorite count: 0
accepted answer: http://stackoverflow.com/a/20819164
has answer: http://stackoverflow.com/a/70898990
has answer: http://stackoverflow.com/a/35991250
answer count: 4
linked to: http://stackoverflow.com/q/35941613
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I have installed Xerces through Maven: junit junit 4.11 test org.jdom jdom 2.0.2 xerces xercesImpl 2.11.0 I then tried the code given in this example from the Xerces FAQ to validate a XML file against a schema in version 1.1. This is my code: private static void validateFile(File xmlFile, File xsdFile) throws SAXException, IOException { // 1. Lookup a factory for the W3C XML Schema language SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1"); // 2. Compile the schema. File schemaLocation = xsdFile; Schema schema = factory.newSchema(schemaLocation); // 3. Get a validator from the schema. Validator validator = schema.newValidator(); // 4. Parse the document you want to check. Source source = new StreamSource(xmlFile); // 5. Check the document try { validator.validate(source); System.out.println(xmlFile.getName() + " is valid."); } catch (SAXException ex) { System.out.println(xmlFile.getName() + " is not valid because "); System.out.println(ex.getMessage()); } } The code only yields this exception: java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://www.w3.org/XML/XMLSchema/v1.1 could be loaded at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:204) at example.xml.XSDValidator.validateFile(XSDValidator.java:65) Seems like I failed to configure/install Xerces correctly. Please help me get this working, the XML files force me to use the schema in 1.1, I got a normal validator for 1.0 running but I have huge problems with this. I appreciate every hint!
has answer: http://stackoverflow.com/a/20819164

http://stackoverflow.com/a/20780167
score: 0
has body: As far as I know, it is possible to call external java package from report generated by BIRT tool, so, my thinking is you may write a java method to call google geocoding API(which could resolve the geo location name from longitude and latitude), then call the java method from report.
has comment: http://stackoverflow.com/comment/31149782
has comment: http://stackoverflow.com/comment/31149595
has comment: http://stackoverflow.com/comment/31149415
type: Answer
has comment: http://stackoverflow.com/comment/31150305
answers question: http://stackoverflow.com/q/20779971
has comment: http://stackoverflow.com/comment/31150333

http://stackoverflow.com/q/20738911
type: Question
tagged with: jodatime
answer count: 1
tagged with: jsp
score: 0
has title: Getting total number of intervals using joda time
accepted answer: http://stackoverflow.com/a/20739181
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20739181
tagged with: java
has body: I have this code <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.util.*"%> <%@page import="java.text.*,org.joda.time.*"%> Insert title here <% try { int freq=30; //30 minutes String d1=request.getParameter("date"); String d2=d1; String t1=request.getParameter("starttime"); String t2=request.getParameter("endtime"); String date1 = d1; String time1 = t1; String date2 = d2; String time2 = t2; String format = "dd/MM/yyyy hh:mm a"; SimpleDateFormat sdf = new SimpleDateFormat(format); Date dateObj1 = sdf.parse(date1 + " " + time1); Date dateObj2 = sdf.parse(date2 + " " + time2); DateTime dateObj12 = new DateTime(dateObj1); DateTime dateObj22 = new DateTime(dateObj2); long diff = dateObj2.getTime() - dateObj1.getTime(); double diffInHours = diff / ((double) 1000 * 60 * 60); //out.println(diffInHours+" hours"+ " "); final Period period = new Period(dateObj12, dateObj22); //out.print(period.getDays() + " days, "); out.print(period.getHours() + " hours, "); out.print(period.getMinutes() + " minutes, "); //out.print(period.getSeconds() + " seconds."); } catch (ParseException e) { e.printStackTrace(); } %> This gives me the hours difference. Next I want to get the number of intervals. As above you can see I have used freq=30; which is the interval I want. So between a certain time for example 11.30 am to 5.00 pm with interval period of 30 minutes I should get 11 intervals. How should I do this?
tagged with: date

http://stackoverflow.com/comment/30971273
type: QuestionComment
comment on: http://stackoverflow.com/q/20682229
has text: You didn't say how often you read / iterate your collection. Or just insert and remove? How do you know which element to remove when it's in the middle?
score: 0
type: Comment

http://stackoverflow.com/comment/31277555
type: AnswerComment
has text: Got Cleared ...http://stackoverflow.com/questions/20845369/how-to-troubleshoot-asynctask/
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20832659

http://stackoverflow.com/a/36183795
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20770048
score: 4
upvote count: 4
has body: I had similar error. It turned out that the method was called on different thread. Making the method executing in the same thread solved the problem.

http://stackoverflow.com/comment/31046438
score: 0
type: AnswerComment
type: Comment
has text: thanks buddy problem has been solved and one thing how I can set size of panel....?
comment on: http://stackoverflow.com/a/20723469

http://stackoverflow.com/a/20797020
answers question: http://stackoverflow.com/q/20796794
type: Answer
has body: 10.0.2.2:8082 would be the solution if you are trying to run your app on the emulator on the same machine where tomcat is installed! If you are running the app on the device make sure that your device is on the same network or you have the route to your server from your device's network. 10.x.x.x is a private network and isnt valid on the internet. Download terminal emulator app and see of you can ping your server!
score: 0

http://stackoverflow.com/comment/31008559
comment on: http://stackoverflow.com/a/20703018
score: 0
type: AnswerComment
type: Comment
has text: I know that using native feature to catch such event might be a solution, but i won't use it as it will only add a lot of mess in the code and will make it unmaintainable some day - I would rather keep it pure-java.

http://stackoverflow.com/q/20702695
tagged with: java
tagged with: mysql
has body: <% ResultSet rsta=st.executeQuery("SELECT DISTINCT user_type FROM details where user_type not like 'null'"); while(rsta.next()) { out.write(" " + rsta.getString("user_type") + " "); } %> Sct Select Sct <% ResultSet rsta1=st.executeQuery("SELECT DISTINCT sct,user_type FROM details where sct not like 'null'"); while(rsta1.next()) { out.write(" " + rsta1.getString("sct") + " "); } %> Standard: Select Standard <% ResultSet rsta2=st.executeQuery("Select DISTINCT standard from details where standard not like 'null'"); while(rsta2.next()) { out.write(" " + rsta2.getString("standard") + " "); } %> Division: Select Division <% ResultSet rsta3=st.executeQuery("Select DISTINCT division from details where division not like 'null'"); while(rsta3.next()) { out.write(" " + rsta3.getString("division") + " "); } %> These are 4 select fields.All the 4 get the list from the mysql database. But all the selects get all the possible values from the database depending on the column selected. I will give an example While entering into the database suppose I add for the 4 columns a,1,cat,milk 2nd row consists of b,2,dog,bone. Now in my above code I will get in the first select(a,b),second select(1,2) and so on. I want the search to narrow,if I select a in the first select only 1 should appear n the second and cat in the third.How should I do this. I am using JSP
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20708761
tagged with: jsp
score: 0
has answer: http://stackoverflow.com/a/20705492
type: UnansweredQuestion
has title: Narrow a dropdown search in JSP and using mysql db

http://stackoverflow.com/a/20777812
downvote count: 0
has comment: http://stackoverflow.com/comment/31144185
score: 3
has comment: http://stackoverflow.com/comment/31144209
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31153500
has body: When you start java, you tell it which class to execute. Java finds the main() method in the specified class and calls it. You need to tell java to execute DogTestDrive. Note that if you're executing this in an IDE it's as easy as right-clicking on DogTestDrive in your project and chiding "Run". The class java runs must be a "top level" class - that is one that is declared in its own file of the same name as the class, but with .java added (not a class declared in another class's file).
accepted answer of: http://stackoverflow.com/q/20777796
answers question: http://stackoverflow.com/q/20777796
upvote count: 3
type: Answer

http://stackoverflow.com/comment/31135966
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20721525
has text: this is exactly the case. Can't believe I missed that from the start! thank you for the correction.
type: AnswerComment

http://stackoverflow.com/a/20831112
type: Answer
has body: A while loop with a condition of your choice (such as checking a certain value isn't encountered), or a for loop with a certain number of iterations if you're content with doing the set of operations, say, 10 times for example. One solution is to wrap the entire block of code after Menu = menu_scanner.nextInt in a while loop such as while(Menu &lt; 5), and offer another option of 5 to exit the program. Essentially though, you need to learn about the control structures in Java from a guide e.g. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/flow.html
upvote count: 5
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/20831100

http://stackoverflow.com/a/20752114
answers question: http://stackoverflow.com/q/20750591
type: Answer
has comment: http://stackoverflow.com/comment/31098752
has comment: http://stackoverflow.com/comment/31098787
has comment: http://stackoverflow.com/comment/31098956
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31098658
has body: ChartPanel implements an event listener that prompts it to repaint() itself when needed; JPanel does not. See the implementation of ChartChangeListener in chartChanged(), for example. When debugging, look for one instance of ChartPanel that shadows another or an errant use of JPanel. Addednum Does the frame also need to be an ApplicationFrame or could it work in a JFrame? Either is acceptable, as shown in this JFrame example or this ApplicationFrame example; both update dynamically. Note that Swing GUI objects should be constructed and manipulated only on the event dispatch thread.

http://stackoverflow.com/comment/31273988
comment on: http://stackoverflow.com/q/20848674
type: QuestionComment
type: Comment
has text: where / how is matrix defined? Also does the exception have any more information?
score: 0

http://stackoverflow.com/a/20681247
has comment: http://stackoverflow.com/comment/30972228
type: Answer
score: 2
upvote count: 2
has body: No, this is impossible, because AspectJ must be started prior to any client classes. All client classes should be loaded through a special enhanced class loader, which will process annotations. The other thing is Spring's AOP. it weaves beans during application context start up and does not require special class loader. That would be the easiest way for client if he uses spring. Add maven dependency and then configure AOP in the application context. There are four types of weaving: Compile-time weaving is the simplest approach. When you have the source code for an application, ajc will compile from source and produce woven class files as output. The invocation of the weaver is integral to the ajc compilation process. The aspects themselves may be in source or binary form. If the aspects are required for the affected classes to compile, then you must weave at compile-time. Aspects are required, e.g., when they add members to a class and other classes being compiled reference the added members. Post-compile weaving (also sometimes called binary weaving) is used to weave existing class files and JAR files. As with compile-time weaving, the aspects used for weaving may be in source or binary form, and may themselves be woven by aspects. Load-time weaving (LTW) is simply binary weaving defered until the point that a class loader loads a class file and defines the class to the JVM. To support this, one or more "weaving class loaders", either provided explicitly by the run-time environment or enabled through a "weaving agent" are required. Run-time weaving, this is what actually Spring is doing. We define this as the weaving of classes that have already been defined. to the JVM
has comment: http://stackoverflow.com/comment/30982738
has comment: http://stackoverflow.com/comment/30973785
has comment: http://stackoverflow.com/comment/30970560
downvote count: 0
answers question: http://stackoverflow.com/q/20681062

http://stackoverflow.com/comment/31007603
type: QuestionComment
type: Comment
has text: I have refined the questions now regarding the commons optim toolbox, which I already have looked into - but failed to implement.
score: 0
comment on: http://stackoverflow.com/q/20702257

http://stackoverflow.com/q/20680983
tagged with: java
score: 0
has body: I have an abstract superservice that should perform some common logic. Several services implement this superservice. I chose the ServiceImpl based on a condition, and want to assign it to the abstract type, for later running the common logic. But I won't let me write typesafe code, so probably something in the design is wrong. How could I improve the following? //superservice abstract class AbstractService&lt;T extends BaseResponse&gt; { public void run() { //execute some common logic } } //implementations class FirstService extends AbstractService&lt;FirstResponse extends BaseResponse&gt; { } class SecondService extends AbstractService&lt;SecondResponse extends BaseResponse&gt; { } usage: //this works, but claims to have missing type argument, not being typesafe AbstractService myservice = condition ? new FirstService() : new SecondService(); myservice.run(); ---------------- //this will not compile with "type missmatch" hint AbstractService&lt;BaseResponse&gt; myservice = condition ? new FirstService() : new SecondService(); myservice.run();
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30969092
has answer: http://stackoverflow.com/a/20681100
type: Question
has title: How to group different services to execute base logic?
tagged with: design-patterns

http://stackoverflow.com/q/20693045
tagged with: jooq
tagged with: sql-view
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/32210656
type: Question
has body: I have an app going that is now implemented as a handful of views, and some jooq queries that depend on the views why not move the whole layer into jooq? that is, implement the views in jooq? what would the smart way to do this be? and what would the performance implications be?
has answer: http://stackoverflow.com/a/20727916
has title: what would the jooq equivalent of a DDL view be?
upvote count: 3
tagged with: sql
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31125556
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20766943
type: AnswerComment
has text: This too is solves my needs, but I can only choose one answer. So just upvoted. Thank you very much. Indeed this is the hard way, but couldn't be helped.

http://stackoverflow.com/tag/png
tags question: http://stackoverflow.com/q/20789906
tags question: http://stackoverflow.com/q/20755518
tag name: png
type: Tag

http://stackoverflow.com/comment/31155130
has text: Which of the many Java XML API's are you using or do you want to use?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20784499

http://stackoverflow.com/q/20693046
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/20693182
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/30992229
has comment: http://stackoverflow.com/comment/30991432
linked to: http://stackoverflow.com/q/20671551
upvote count: 0
answer count: 1
tagged with: awt
favorite count: 0
has title: Excluding areas while coloring in Java
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/30993863
score: -1
type: UnansweredQuestion
has body: I have a graphics object and I want to color all the area except some rectangles. For e.g. I want to color all area except these black areas. Can I do that? There can be many rectangles in the image.

http://stackoverflow.com/q/20696847
has title: Parsing text in parens using JParsec
score: 0
has body: I'm writing a parser for a DSL that uses the syntax (nodeHead: nodeBody). The problem is that nodeBody may contain parens, at some cases. The between operator of JParsec should have been a good solution, yet the following code fails: public void testSample() { Parser&lt;Pair&lt;String,String&gt;&gt; sut = Parsers.tuple(Scanners.IDENTIFIER.followedBy(Scanners.among(":")), Scanners.ANY_CHAR.many().source() ).between(Scanners.among("("), Scanners.among(")")); sut.parse("(hello:world)"); } It does not fail when I change ANY_CHAR to IDENTIFIER, so I assume the issue here is that the second parser in the tuple is too greedy. Alternatively, can I make JParsec apply the between parsers before it applies the body? Any ideas are very much appriciated.
tagged with: parsing
accepted answer: http://stackoverflow.com/a/20938788
tagged with: dsl
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20721081
has answer: http://stackoverflow.com/a/20938788
has answer: http://stackoverflow.com/a/20721081
tagged with: jparsec

http://stackoverflow.com/q/20735797
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: fxml
downvote count: 0
accepted answer: http://stackoverflow.com/a/20740607
tagged with: java
tagged with: javafx
type: Question
score: 3
has answer: http://stackoverflow.com/a/20740607
has title: JavaFX - How can i add a container in an anchor pane
has body: I have a simple project that has a fxml with a splitter. So the fxml is this: What i would want is to insert a vbox in the left anchor pane from the splitter using only java code. Can this be done? I am new to fxml so any help would be apreciated. Thank you in advance.
upvote count: 3

http://stackoverflow.com/a/20844137
upvote count: 1
answers question: http://stackoverflow.com/q/20841809
type: Answer
downvote count: 0
score: 1
has body: I solved in this way comboBoxModPag.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { MyBean oldValue = (MyBean) comboBoxModPag.getOldValue(); MyBean newValue = (MyBean) comboBoxModPag.getValue(); if( oldValue!=null &amp;&amp; newValue!=null &amp;&amp; !oldValue.equals(newValue) ){ insertMode = true; } else{ insertMode = false; } } } }); protected void saveOrUpdateModPagContrattoSito() { if(insertMode){ MyBean newMyBean = new MyBean(myBean); //Do somethings to restore myBean statuse //.... //.... tableContainer.addBean(newMyBean); } else{ tableContainer.addBean(myBean); } table.refreshRowCache(); } But I don't know if this is the correct way.

http://stackoverflow.com/comment/31240474
score: 0
type: Comment
has text: *When* does `readLine` return null? If not sure, [read the documentation](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html#readLine()).
type: QuestionComment
comment on: http://stackoverflow.com/q/20830637

http://stackoverflow.com/comment/31132632
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20771218
has text: app crashing and i dont know why

http://stackoverflow.com/a/65386693
upvote count: 2
type: Answer
has body: The above answer from @invariant is totally correct but for some people that do it that way, there may be performances issues, especially with GridPanes that contain many elements. And also when working with loops (iterating over all the elements of a GridPane). What I suggest you is to initialize a static array of all your element/nodes contained within the grid pane. Then use this array to get the nodes you need. i.e. 1. have a double dimensional array : private Node[][] gridPaneArray = null; 2. Call a method like so during the initialization of your view : private void initializeGridPaneArray() { this.gridPaneArray = new Node[/*nbLines*/][/*nbColumns*/]; for(Node node : this.mainPane.getChildren()) { this.gridPaneArray[GridPane.getRowIndex(node)][GridPane.getColumnIndex(node)] = node; } } 3. Get your node Node n = this.gridPaneArray[x][y]; // and cast it to any type you want/need
score: 2
answers question: http://stackoverflow.com/q/20825935
downvote count: 0

http://stackoverflow.com/q/20770294
has title: import org.springframework cannot be resolve even after adding dependencies
has body: I get errors that say The import org.springframework cannot be resolved for all the imports. My POM.XML is as follows: i am sure that i have included all the necessary dependencies. No clue, why this is happening. Help POM.XML 4.0.0 com.app.controller FirstController 1.0 jar webapp spring http://maven.apache.org <spring.version>4.0.0.RELEASE</spring.version> junit junit 3.8.1 test org.springframework spring-context ${spring.version} org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} FirstController maven-compiler-plugin 1.6 1.6 FirstController.java package my.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/hi") public class FirstController { @RequestMapping(method = RequestMethod.GET) public String printWelcome(ModelMap model) { model.addAttribute("message", "Spring 3 MVC Hello LA"); return "hello"; } }
downvote count: 0
answer count: 10
has comment: http://stackoverflow.com/comment/31131270
has answer: http://stackoverflow.com/a/48758686
favorite count: 0
has answer: http://stackoverflow.com/a/40799085
has comment: http://stackoverflow.com/comment/41327819
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/28792458
has comment: http://stackoverflow.com/comment/31141481
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/43290355
has comment: http://stackoverflow.com/comment/49204444
tagged with: java
has answer: http://stackoverflow.com/a/20770814
has answer: http://stackoverflow.com/a/23671894
has answer: http://stackoverflow.com/a/48238615
has answer: http://stackoverflow.com/a/39638560
type: Question
score: 5
has comment: http://stackoverflow.com/comment/31135102
has answer: http://stackoverflow.com/a/50207978
upvote count: 5
has answer: http://stackoverflow.com/a/31846762

http://stackoverflow.com/comment/31063271
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20731988
has text: Yep, that's right. The code works the first time though. When it comes back to the choice selection it just infinitely repeats "Enter \"1\", \"2\" or \"3\" ..Press 0 to quit"

http://stackoverflow.com/comment/31247235
comment on: http://stackoverflow.com/a/20834209
type: AnswerComment
score: 0
type: Comment
has text: name@IM-WS-U-35:~$ find -name javax.jar ./MyFIles/MyTest/javax.jar name@IM-WS-U-35:~$

http://stackoverflow.com/a/20698442
downvote count: 1
has body: Well first of all you've made it really hard for somebody to grasp what you want outta your question .Never the less what you can do is if i understood you correctly : Take a STATIC variable and define it globally , now inside your for loop/ listener (where ever you want to check if the radio button is clicked ) just make this boolean variable true or false and now impose that condition(boolean variable) outside your loop/listener (whatever it is) and display the page according if its true show second page else show the first page
answers question: http://stackoverflow.com/q/20698071
score: 0
has comment: http://stackoverflow.com/comment/31001945
has comment: http://stackoverflow.com/comment/31000707
has comment: http://stackoverflow.com/comment/31000826
has comment: http://stackoverflow.com/comment/31002859
type: Answer
has comment: http://stackoverflow.com/comment/31001801
upvote count: 1

http://stackoverflow.com/a/20793662
has body: As far as I can tell, you are simply missing an appropriately named getter for the field franchise_location. It should be public List&lt;Location&gt; getFranchise_location() { return franchise_location; } (and the setter) public void setFranchise_location(List&lt;Location&gt; franchise_location) { this.franchise_location = franchise_location; } Alternatively, you can annotate your current getter or field with @JsonProperty("franchise_location") private List&lt;Location&gt; franchiseLocation = ...; which helps to map JSON element names that don't really work with Java field name conventions. The following works for me public static void main(String[] args) throws Exception { String json = "{ \"Company\": { \"name\": \"cookieltd\", \"type\": \"food\", \"franchise_location\": [ { \"location_type\": \"town\", \"address_1\": \"5street\" }, { \"location_type\": \"village\", \"address_1\": \"2road\" } ] } }"; ObjectMapper mapper = new ObjectMapper(); ObjectReader reader = mapper.reader(Company.class).withRootName( "Company"); // read after the root name Company company = reader.readValue(json); System.out.println(company.getFranchise_location().get(0).getAddress_1()); } public static class Company { private String name; private String type; private List&lt;Location&gt; franchise_location = new ArrayList&lt;Location&gt;(); public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public List&lt;Location&gt; getFranchise_location() { return franchise_location; } public void setFranchise_location(List&lt;Location&gt; franchise_location) { this.franchise_location = franchise_location; } } public static class Location { private String location_type; private String address_1; public String getLocation_type() { return location_type; } public void setLocation_type(String location_type) { this.location_type = location_type; } public String getAddress…
accepted answer of: http://stackoverflow.com/q/20793590
type: Answer
has comment: http://stackoverflow.com/comment/31172147
has comment: http://stackoverflow.com/comment/31172532
score: 0
has comment: http://stackoverflow.com/comment/31172563
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31172170
answers question: http://stackoverflow.com/q/20793590

favicon
tags question: http://stackoverflow.com/q/20745688
tag name: favicon
type: Tag

http://stackoverflow.com/comment/31230205
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20825467
type: QuestionComment
has text: Do .equals checks the string is present in the string array?

http://stackoverflow.com/comment/66140004
type: Comment
comment on: http://stackoverflow.com/q/20700530
has text: Could someone please explain WHY would we want to intentionally lose the object over the network? Any examples?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31267402
comment on: http://stackoverflow.com/q/20845292
has text: Some kind of listener which can let me know if the file has been modified without adding any new library ??? Thats what i am trying to do
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31026317
type: Comment
has text: Rather then extending the JTable, you could create a custom cell renderer which provided the tooltip fir the individual cell
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20710501

http://stackoverflow.com/q/20848442
has comment: http://stackoverflow.com/comment/31273392
has title: LIBGDX speeding up a whole game (using box2d)
upvote count: 1
type: AnsweredQuestion
has body: I was wondering how i can speed up whole game done with libgdx (for example after clicking a button). The way i have in my game is modify a timestep variable used in world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS); but im now sure if it's a good idea. If there a any better way to archive that?
tagged with: libgdx
score: 1
tagged with: java
tagged with: box2d
type: Question
has answer: http://stackoverflow.com/a/20853628
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/20853628
favorite count: 0

http://stackoverflow.com/q/20814053
has title: twitter4j Stop working suddenly
type: UnansweredQuestion
has body: I have implemented fetching data from twitter using twitter4j (twitter4j.3.0.3.jar). The data suddenly stopped coming since 10 Dec, 2013 and I have made no changes in the code. When I debugged using logger it gives exception .I have used the following in catch block to print the exception: logger.info("twitter exception catched "+te); logger.info("Failed to search tweets: " + te.getMessage()); ===>>>The exception caught is something like this 13:32:25,042 INFO [TwitterIntegrationHelper] twitter exception catched api.twitter.com Relevant discussions can be found on the Internet at: http://www.google.co.jp/search?q=d35baff5 or http://www.google.co.jp/search?q=13208874 TwitterException{exceptionCode=[d35baff5-13208874 43208640-50f081d2], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.4-SNAPSHOT} 13:32:25,043 INFO [TwitterIntegrationHelper] Failed to search tweets: api.twitter.com ===>>> Along with this twitter has changed its certification which is effective from 10th December, 2013. How can I ensure if i have same certification in the JBOSS server. I also try to use to use twitter4j.3.0.5.jar which is also not working. I use twitter4j.properties method to authentication. Please help. Thanks in advance.
has answer: http://stackoverflow.com/a/20814208
has answer: http://stackoverflow.com/a/21499918
tagged with: java
tagged with: twitter
type: Question
tagged with: twitter4j
score: 0
answer count: 2

http://stackoverflow.com/q/20777093
score: 1
has answer: http://stackoverflow.com/a/20777141
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/20777141
upvote count: 1
answer count: 1
tagged with: social-networking
has title: bringing up different page when logged in
has body: let me start off by saying happy holidays to everyone! ok i really just need confirmation and correction if needed. what im trying to do: Im using google and facebook "Log-in" feature to sign in for my app to retrieve the data needed like name email etc. where i Need help: after signing in i want another activity to be the forefront everytime app opens unless the user signs out then of course, it takes them back to the original main page to sign back in. now im assuming this takes place in maybe the lifecycle right? somthing like: @override OnResume { //if user is signed in cast an Intent to automatically go to another activity? } am i on the right track on no? thanks in advance guys
tagged with: java
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/20700527
has body: What I am trying to accomplish is sharing Spring context between one jar and two war's. All of them are packed in ear. Here is beanRefContext.xml located in the jar: /META-INF/spring/main-applicationContext.xml main-applicationContext.xml contains beans I would like to share between two war's. Here is the web.xml in one war: <listener-class>org.springframework.web.context.ContextLoaderListener</listenerclass> locatorFactorySelector /META-INF/spring/beanRefContext.xml parentContextKey mainApplicationContext And similar in the other war. From Jboss logs I can clearly see that all beans from main-applicationContext.xml are instantiated: [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 265 bean definitions from location pattern [/META-INF/spring/main-applicationContext.xml] Moreover in one of the war's I have local spring context containing beans local to that particular war. Those beans are instantiated properly as well: [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 55 bean definitions from location pattern [/WEB-INF/applicationContext.xml] The beans are injected correctly into beans located in jar. However there are not injected into Struts actions and beans located in the mentioned earlier beans local for the web application (defined in /WEB-INF/applicationContext.xml). What I would expect that beanRefContext.xml is parent context for local web context. Where am I wrong? Thank you in advance for any help.
has title: Spring shared context in EAR
tagged with: java
tagged with: jboss
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31005635
has answer: http://stackoverflow.com/a/65438837
tagged with: spring
has comment: http://stackoverflow.com/comment/31004680
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16162877
has answer: http://stackoverflow.com/a/20703430
has comment: http://stackoverflow.com/comment/31005030

http://stackoverflow.com/a/20726684
has comment: http://stackoverflow.com/comment/31052615
upvote count: 5
has comment: http://stackoverflow.com/comment/31052666
has comment: http://stackoverflow.com/comment/31052640
accepted answer of: http://stackoverflow.com/q/20726652
type: Answer
has body: You cannot store types, but you can store the Class object for each class loaded by the JVM. When the JVM loads and initializes a class on the classpath, it creates a single Class object for that class. The Class class gives you access to a number of instance methods for performing reflection on your program. Also, how might one do this and how inadvisable is it (and why)? For example List&lt;Class&lt;?&gt;&gt; classes = new ArrayList&lt;&gt;(); classes.add(Example.class); Now you can go through the elements and call different methods depending on what you want to do. If you want to create a new instance (and your class has a no-arg constructor), you can do classes.get(0).newInstance(); If you don't have a no-argument constructor, you will need to get Constructor references from the Class object. If you need to invoke methods (whether static or not), you need to get a Method reference. Read through the javadoc. how inadvisable is it (and why)? There are some things you cannot do without reflection, but it is generally discouraged. What is reflection and why is it useful? Java Reflection Performance Why should I use reflection? Java Reflection: Why is it so slow? Why is Java's reflection package considered the dark side of the force? You should try to minimize using Reflection when you can very well use the Factory pattern to achieve your goals in this situation. User user2864740 suggests I would have a list of "factories that know how to create the appropriate object", if practical - really depends upon where this data comes from and what role it has.
has comment: http://stackoverflow.com/comment/31052590
answers question: http://stackoverflow.com/q/20726652
downvote count: 0
has comment: http://stackoverflow.com/comment/31052629
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/30972417
type: QuestionComment
comment on: http://stackoverflow.com/q/20682567
score: 0
type: Comment
has text: I have large amount of data, and I don't want it to be Spilt in multiple process.Also,Why Orphan-Removal is not working. What is the issue with that?

http://stackoverflow.com/a/20691274
score: 0
answers question: http://stackoverflow.com/q/20682522
type: Answer
has body: Did you check that redis is still up &amp; running ? If not, investigate why it died. try a redis-cli in a terminal if you can. "info" would give you more details.

http://stackoverflow.com/comment/31132226
has text: @GrlsHu MainActivity: [http://snipt.org/BFk6](http://snipt.org/BFk6)
comment on: http://stackoverflow.com/q/20771102
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31268607
has text: Possible duplicate of http://stackoverflow.com/questions/3996938/why-is-listview-getcheckeditempositions-not-returning-correct-values
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20845735

http://stackoverflow.com/q/20766837
has comment: http://stackoverflow.com/comment/31140642
tagged with: recursion
linked to: http://stackoverflow.com/q/12548312
score: 1
tagged with: java
tagged with: set
type: Question
has title: Finding subsets of size k for a given set of size n
answer count: 1
downvote count: 0
has body: I am trying to work out the solution to the above problem and I came up with this import java.util.ArrayList; import java.util.HashSet; import java.util.Set; public class Subset_K { public static void main(String[]args) { Set&lt;String&gt; x; int n=4; int k=2; int arr[]={1,2,3,4}; StringBuilder sb=new StringBuilder(); for(int i=1;i&lt;=(n-k);i++) sb.append("0"); for(int i=1;i&lt;=k;i++) sb.append("1"); String bin=sb.toString(); x=generatePerm(bin); Set&lt;ArrayList &lt;Integer&gt;&gt; outer=new HashSet&lt;ArrayList &lt;Integer&gt;&gt;(); for(String s:x){ int dec=Integer.parseInt(s,2); ArrayList&lt;Integer&gt; inner=new ArrayList&lt;Integer&gt;(); for(int j=0;j&lt;n;j++){ if((dec&amp;(1&lt;&lt;j))&gt;0) inner.add(arr[j]); } outer.add(inner); } for(ArrayList&lt;Integer&gt; z:outer){ System.out.println(z); } } public static Set&lt;String&gt; generatePerm(String input) { Set&lt;String&gt; set = new HashSet&lt;String&gt;(); if (input == "") return set; Character a = input.charAt(0); if (input.length() &gt; 1) { input = input.substring(1); Set&lt;String&gt; permSet = generatePerm(input); for (String x : permSet) { for (int i = 0; i &lt;= x.length(); i++) { set.add(x.substring(0, i) + a + x.substring(i)); } } } else { set.add(a + ""); } return set; } } I am working on a 4 element set for test purpose and using k=2. What I try to do is initially generate a binary string where k bits are set and n-k bits are not set. Now using this string I find all the possible permutations of this string. And then using these permutations I output the respective element in the set. Now i cant figure out the complexity of this code because I used the generatePerm method from someone else. Can someone help me with the time complexity of the generatePerm method and also the overall time complexity of my solution. I found other recursive implementation of this problem in here Find all subsets of length k in an array However I cant figure out the complexity of it either. So need some help there…
has comment: http://stackoverflow.com/comment/31125111
has answer: http://stackoverflow.com/a/20766898
tagged with: time-complexity
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/31124596
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/20743825
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/20743766
type: Answer
has comment: http://stackoverflow.com/comment/31082825
has body: Change to this for(int x = 0; x &lt; 8; x++){ for(int y = 0; y &lt; 8; y++){ UPDATE: if you would like wide cells when frame is increased use int cellWidth=getSize().width/8; int cellHeight=getSize().height/8; and g2d.fillRect(cellWidth*x, cellHeight*y, cellWidth, cellHeight);

http://stackoverflow.com/a/68203641
downvote count: 1
answers question: http://stackoverflow.com/q/20810210
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/120556976
has body: The originally picked answer by @Sotirios Delimanolis is wrong. @ZhongYu 's answer is correct. There is the visibility issue of the concern here. So if MyClass is published unsafely, anything could happen. Someone in the comment asked for evidence - one can check Listing 3.15 in the book Java Concurrency in Practice: public class Holder { private int n; // Initialize in thread A public Holder(int n) { this.n = n; } // Called in thread B public void assertSanity() { if (n != n) throw new AssertionError("This statement is false."); } } Someone comes up an example to verify this piece of code: coding a proof for potential concurrency issue As to the specific example of this post: public class MyClass{ private MyObject obj; // Initialize in thread A public MyClass(){ obj = new MyObject(); } // Called in thread B public void methodCalledByOtherThreads(){ obj.doStuff(); } } If MyClass is initialized in Thread A, there is no guarantee that thread B will see this initialization (because the change might stay in the cache of the CPU that Thread A runs on and has not propagated into main memory). Just as @ZhongYu has pointed out, because the write and read happens at 2 independent threads, so there is no happens-before(write, read) relation. To fix this, as the original author has mentioned, we can declare private MyObject obj as volatile, which will ensure that the reference itself will be visible to other threads in timely manner (https://www.logicbig.com/tutorials/core-java-tutorial/java-multi-threading/volatile-ref-object.html) .
upvote count: 1

deserialization
type: Tag
tags question: http://stackoverflow.com/q/20775826
tags question: http://stackoverflow.com/q/20762894
tags question: http://stackoverflow.com/q/20725508
tags question: http://stackoverflow.com/q/20742213
tag name: deserialization
tags question: http://stackoverflow.com/q/20686037
tags question: http://stackoverflow.com/q/20692586
tags question: http://stackoverflow.com/q/20698836
tags question: http://stackoverflow.com/q/20783426

http://stackoverflow.com/q/20806637
tagged with: java
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/31195335
has answer: http://stackoverflow.com/a/20807169
has answer: http://stackoverflow.com/a/20806837
accepted answer: http://stackoverflow.com/a/20806837
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has body: I want to code a java program which must be able to communicate with web browsers (the clients). Sending data / answering requests is not a problem but I also want to send new data to the clients (so that they see it in their browsers without reloading the page). What ways are there to accomplish that? Is there any way to listen for new data (with JavaScript)?
has comment: http://stackoverflow.com/comment/31195938
has title: Sending new data from Java program to web browsers
possible better answer: http://stackoverflow.com/a/20807169
type: AnsweredQuestion

http://stackoverflow.com/comment/31391193
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20820908
has text: Can you post how you initialize that *MyJDBCConnectionPool* object?
score: 0

http://stackoverflow.com/a/20785807
upvote count: 2
has body: Never work with Raw type Collection: declare your collection with proper Generic types of your case: List&lt;BigDecimal[]&gt; myObj is not likely a BigDecimal[] object, hence a ClassCastException can occur.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20785735

http://stackoverflow.com/q/20753792
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20753872
has title: Importing a text file in Android SDK
tagged with: import
type: Question
upvote count: 1
answer count: 1
tagged with: sdk
tagged with: android
favorite count: 0
tagged with: text-files
has body: I've been trying to read a file for the last few days and have tried following other answers but have not succeeded. This is the code I currently have to import the text file: public ArrayList&lt;String&gt; crteDict() { try { BufferedReader br = new BufferedReader (new FileReader("/program/res/raw/levels.txt")); String line; while ((line = br.readLine()) != null) { String[] linewrds = line.split(" "); words.add(linewrds[0].toLowerCase()); // process the line. } br.close(); } catch (FileNotFoundException fe){ fe.printStackTrace(); It is meant to read the text file and just create a long Array of words. It keeps ending up in the FileNotFoundException. Please let me know any answers. Thanks!
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/comment/30999677
has text: That would also trigger on "ornament", "tournament", and "enamel".
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20697690
type: AnswerComment

http://stackoverflow.com/comment/31231210
type: QuestionComment
comment on: http://stackoverflow.com/q/20826003
has text: @MarkoTopolnik that's what I said :)
score: 0
type: Comment

http://stackoverflow.com/a/20711612
score: 2
upvote count: 2
has body: Right now you are trying to set a new person using a get method. You cannot set an object to a function. You are on the right track with your code: register.AddStudent(controller.getDal().getStudentData().getPerson()); I do wonder however if in your code that a student and a person are the same thing. You did not provide enough code for me to test and to give you an guaranteed answer, but I would assumg that your code should be more like this: register.AddStudent(controller.getDal().getStudent()); This way you are getting the student and then adding the student. I'm not sure what you are trying to accomplish but you should really be looking into set methods such as something like: Person p = controller.getDal().getStudentData().getPerson(); p.setIdNumber = 0011559966 p.setAddress('123 C St'); Or even something along the lines of: register.AddStudent(new Student("Billy", "Crystal", "123 C st")); Anyway, if you had more code, I would be able to help you more, but that is the best I can think of without any real context
answers question: http://stackoverflow.com/q/20711454
has comment: http://stackoverflow.com/comment/31024742
has comment: http://stackoverflow.com/comment/31024872
has comment: http://stackoverflow.com/comment/31024547
downvote count: 0
type: Answer

http://stackoverflow.com/a/20798440
has comment: http://stackoverflow.com/comment/48172208
type: Answer
has comment: http://stackoverflow.com/comment/50966329
accepted answer of: http://stackoverflow.com/q/20798391
has body: Your condition should be i * i &lt;= num private static boolean isPrime(int num) { if (num == 2) return true; if (num &lt; 2 || num % 2 == 0) return false; for (int i = 3; i * i &lt;= num; i += 2) if (num % i == 0) return false; return true; } You didn't take number 9 in your consideration so 9&lt;9 will result false. But you need to check 9.
has comment: http://stackoverflow.com/comment/59392481
answers question: http://stackoverflow.com/q/20798391
upvote count: 36
type: AcceptedAnswer
downvote count: 0
score: 36

http://stackoverflow.com/comment/31183123
comment on: http://stackoverflow.com/q/20799814
has text: What I've done in the past is used `JXLayer`/`JLayer` wrapped it around the `JRootPane` and installed a "disabled" layer onto it. This has the nice effect of disabling the menus, the content pane and if I recall correctly, the glass pane as well. You can set this to the main frame as well as the internal frames as needed
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31111440
has text: If you are using an SQL statment, you can just format the util.Date that you have into the format you want and run the SQL. Date mDate = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); String SQL = "INSERT INTO MYTABLE (.... ,DATE,....)VALUES (....'"+sdf.format(mDate)+"'.....)";
type: Comment
comment on: http://stackoverflow.com/a/20752817
type: AnswerComment
score: 0

http://stackoverflow.com/q/20803436
has body: I make a java project that show question and answers with clicking Question and Answer buttons using netbeans.I put those images in "src" folder.also those image put after encrypted. After finished my project i made .jar file.when I run that .jar file it says "java.io.filenotfoundexception:"file_path"(the system can't find path specified)". how can I solve this problome. thank in advance. public static void main(String[]args){ String imageName[] ={"A01","A02","A03","B01","B02","B03"}; String imageNameEncrypy[] ={"A001","A002","A003","B001","B002","B003"}; for(int i=0;i&lt;imageName.length;i++){ try{ //FileInputStream file; FileInputStream file = new FileInputStream("src/image2/"+imageName[i]+".jpg"); FileOutputStream output = new FileOutputStream("src/image2/"+imageNameEncrypy[i]+".jpg"); byte j[]="NiTh5252".getBytes(); SecretKeySpec kye = new SecretKeySpec(j,"DES"); System.out.println(kye); Cipher enc = Cipher.getInstance("DES"); enc.init(Cipher.ENCRYPT_MODE,kye); CipherOutputStream cos = new CipherOutputStream(output, enc); byte[] buf = new byte[1024]; int read; while((read=file.read(buf))!=-1){ cos.write(buf,0,read); } file.close(); output.flush(); cos.close(); JOptionPane.showMessageDialog(null,"Suscess"); }catch(Exception e){ JOptionPane.showMessageDialog(null,e); } } } decrypt code int k=i; String questionImage[]={"","B001","B002","B003"}; String questionDecryptImageName=questionImage[k]; String afterDrcryptName[]={"A.jpg","B.jpg","C.jpg","D.jpg"}; try{ FileInputStream file = new FileInputStream("src/learning/dvd/Temp2/"+questionDecryptImageName+".jpg"); FileOutputStream output = new FileOutputStream("src/learning/dvd/Temp2/"+afterDrcryptName[k]); byte j[]="NiTh5252".getBytes(); SecretKeySpec kye = new SecretKeySpec(j,"DES"); System.out.println(kye); Cipher enc = Cipher.getInstance("DES"); enc.init(Cipher.DECRYPT_MODE,kye); CipherOutputStream cos = new CipherOutputStream(output, enc); byte[] buf = new byte[1024]; int read; while((read=file.read(buf))!=-1){ cos…
type: Question
has answer: http://stackoverflow.com/a/20912331
score: 0
has comment: http://stackoverflow.com/comment/31189469
answer count: 1
has comment: http://stackoverflow.com/comment/31189529
has comment: http://stackoverflow.com/comment/31189882
tagged with: java
accepted answer: http://stackoverflow.com/a/20912331
tagged with: image
has comment: http://stackoverflow.com/comment/31192319
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31192710
tagged with: jar
has comment: http://stackoverflow.com/comment/31248950
tagged with: netbeans-7
has title: Where I keep my image files in java project to make .jar

jcomponent
tags question: http://stackoverflow.com/q/20787800
tag name: jcomponent
tags question: http://stackoverflow.com/q/20715733
tags question: http://stackoverflow.com/q/20816349
type: Tag
tags question: http://stackoverflow.com/q/20828564

http://stackoverflow.com/comment/31207452
score: 0
comment on: http://stackoverflow.com/q/20813063
has text: you want to add the JAR's to your library ?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20813739
type: Answer
has body: You are parsing the file till length of file &lt;= instead you have to use &lt;. It will access the file till line.length - 1 Replace with this for(int j = 3; j &lt;line.length; j++) { returnList.add(line[j]); }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20813710
upvote count: 1

http://stackoverflow.com/comment/31063925
has text: @HatemAlimam what code line should I edit?
score: 0
comment on: http://stackoverflow.com/q/20732341
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20810600
type: Question
has title: Use new temp firefox profile each time with selenium server
score: 0
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/31203012
tagged with: firefox
type: UnansweredQuestion
has body: Im using the selenium server 2.35.0 which im starting using java -jar selenium-server-standalone-2.35.0 And then running my tests from a php script using the Testing_Selenium binding. It seems to be opening in the same Firefox profile each time, how can i change this ? I understand this is not the default, but it has been changed somewhere down the line and im not sure how to undo it.
answer count: 0
has comment: http://stackoverflow.com/comment/31202921

http://stackoverflow.com/q/20765484
has comment: http://stackoverflow.com/comment/31143703
type: UnansweredQuestion
tagged with: android
has body: I want to do a simple action in my game after one second. I have my GameScene class which extends Andengine's Scene. public class GameScene extends Scene{ //(...) Handler delayHandler; public GameScene(){ Looper.prepare(); delayHandler = new Handler(); } //(...) public void sphereTouched(){ //(...) delayHandler.postDelayed(new Runnable() { public void run(){ Log.d("DEB","postDelayed test"); } }, 1000); } } When sphereTouched function is called operation from postDelayed doesn't run. Others operations from that function work properly. Have I missed something?
has answer: http://stackoverflow.com/a/20765664
tagged with: postdelayed
has comment: http://stackoverflow.com/comment/31122648
has comment: http://stackoverflow.com/comment/31122440
type: Question
has title: Andengine - handler.postDelayed doesn't work
has comment: http://stackoverflow.com/comment/31121996
tagged with: java
has comment: http://stackoverflow.com/comment/31124223
tagged with: andengine
has comment: http://stackoverflow.com/comment/31122500
score: 0
tagged with: handler
has comment: http://stackoverflow.com/comment/31122014
answer count: 1

http://stackoverflow.com/a/20826898
score: 3
downvote count: 0
has body: Loop inversion is a performance optimization technique which improves performance as the processor can accomplish the same result with fewer instructions. This should mostly improve the performance in boundary conditions. This link provides another example for loop inversion. In few architectures where decrement and compare is implemented as a single instruction set, It makes sense to convert a for loop to a while with decrement and compare operation. Wikipedia has a very good example and I am explaining it here again. int i, a[100]; i = 0; while (i &lt; 100) { a[i] = 0; i++; } will be converted by the compiler to int i, a[100]; i = 0; if (i &lt; 100) { do { a[i] = 0; i++; } while (i &lt; 100); } How this translates to performance? When the value of i is 99, the processor need not perform a GOTO (which is required in the first case). This improves performance.
type: Answer
answers question: http://stackoverflow.com/q/20826718
upvote count: 3

http://stackoverflow.com/q/20806569
type: Question
has title: Draw lines between buttons in a gridlayout in Java
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/20806853
has body: I have JPanel: JPanel GameBoardPanel=new JPanel(new GridLayout(yAxis,xAxis,30,30)); The panel holds x*y amount of buttons and now I'm trying draw lines in the "spacing" between them but I can't figure out how to do it. This picture: https://i.sstatic.net/LDF06.png shows the gridpattern.
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
tagged with: java
tagged with: jpanel

lock-free
tag name: lock-free
type: Tag
tags question: http://stackoverflow.com/q/20701754
tags question: http://stackoverflow.com/q/20704797

http://stackoverflow.com/q/20748560
has comment: http://stackoverflow.com/comment/31091893
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: fullscreen
has answer: http://stackoverflow.com/a/20749242
has comment: http://stackoverflow.com/comment/31091752
possible better answer: http://stackoverflow.com/a/20749242
has body: The below picture shows that there are vertical "lines" running down the sides of each side of the screen. The background image seems to fill most of the screen but then there are these lines and the picture does not line up. See where I marked these lines with the black arrows. There seems to be no horizontal lines at the top and bottom of the screen. I cannot find any reason for this. Below is some relevant code that might be where the problem is residing. AndroidManifest.xml <activity android:label="@string/app_name" android:name=".MainMenu" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> Here is a section of my styles.xml that is referenced in my AndroidManifest.xml. EDIT Just to clarify, this problem occurs on all the layouts, not just the one below. mainmenu.xml <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:paddingTop="75dp" android:textSize="60sp" /> <TextView android:id="@+id/playBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="12dp" android:textSize="30sp" android:background="@color/transparent" android:textColor="@color/onclicktextviewhighlight" /> <TextView android:id="@+id/highscoresBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="12dp" android:textSize="30sp" android:background="@color/transparent" android:textColor="@color/onclicktextviewhighlight" /> <TextView android:id="@+id/optionsBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="30sp" android:background="@color/transparent" android:textColor="@color/onclicktextviewhighlight" />
score: 0
answer count: 2
has title: Background image does not seem to fill entire screen
has answer: http://stackoverflow.com/a/20748920
accepted answer: http://stackoverflow.com/a/20748920
has comment: http://stackoverflow.com/comment/31092143
tagged with: android
tagged with: android-manifest

http://stackoverflow.com/q/20763347
answer count: 7
accepted answer: http://stackoverflow.com/a/20763362
has answer: http://stackoverflow.com/a/20763387
score: 4
favorite count: 0
has body: This is my code: int[] primes = new int[25]; for (int i = 2; i &lt;= 100; i++) { for (int j = i; j &gt; 0; j--) { int prime = i%j; if (prime == 0) { if ((j == i) || (j == 1)) { isPrime = true; } else { isPrime = false; break; } } } if (isPrime == true){ primes[index] = i; index++; } } As you can see, I'm writing prime numbers into array. I counted all the prime numbers that are within range 2-100, so I set array size to 25. But let's say that I wouldn't know there are 25 prime numbers. Is there a way to create an array (any type of array) without defining the size? I tried this: int[] primes = new int[0]; But it crashed.
has title: Declaring int[] Array without defining size?
has answer: http://stackoverflow.com/a/20763433
has comment: http://stackoverflow.com/comment/31117952
has answer: http://stackoverflow.com/a/20763414
has comment: http://stackoverflow.com/comment/31117954
has answer: http://stackoverflow.com/a/20763362
type: Question
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/20763404
has answer: http://stackoverflow.com/a/20763404
has answer: http://stackoverflow.com/a/20763403
upvote count: 4
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/20763752

http://stackoverflow.com/comment/31135398
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20772897
has text: add xml name space to your relative layout: xmlns:map="http://schemas.android.com/apk/res-auto"

http://stackoverflow.com/q/20769778
has answer: http://stackoverflow.com/a/20772615
has comment: http://stackoverflow.com/comment/31130056
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/31130036
has comment: http://stackoverflow.com/comment/31131436
tagged with: java
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: post
has title: Writing Data using RESTful web services through Android
has body: i am developing android application.our java developer team write restfull web services for reading and writing data.i sucessfully read data and display into device.i used following android code to inserting data but it is not working. public class MainActivity extends Activity { ProgressDialog pd; List&lt;NameValuePair&gt;list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new Mytask().execute(); } @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 class Mytask extends AsyncTask&lt;String,String,String&gt; { @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); Toast.makeText(getBaseContext(), "Inser Record Succesfully", Toast.LENGTH_LONG).show(); pd.dismiss(); } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pd=new ProgressDialog(MainActivity.this); pd.setMessage("Please Wait"); pd.show(); } @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub pushdata(); return null; } } public void pushdata() { try { HttpClient client=new DefaultHttpClient(); HttpPost post=new HttpPost("http://192.168.1.239:8080/KesariRating/rating/add"); // add data to url list=new ArrayList&lt;NameValuePair&gt;(5); list.add(new BasicNameValuePair("exce","e")); list.add(new BasicNameValuePair("vgood","null")); list.add(new BasicNameValuePair("good","null")); list.add(new BasicNameValuePair("poor","null")); list.add(new BasicNameValuePair("fair","null")); post.setEntity(new UrlEncodedFormEntity(list)); HttpResponse response=client.execute(post); HttpEntity entity=response.getEntity(); } catch(Exception e) { Log.d("Error in Push","",e); } } } could you told me what i did wrong in that code.i think we …
has comment: http://stackoverflow.com/comment/31134655

http://stackoverflow.com/q/20688938
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/20688993
has title: call an instance of a previous class
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/30983728
tagged with: java
has answer: http://stackoverflow.com/a/20689618
type: Question
answer count: 2
has body: I am programming a Spreadsheet in java. Therefore I am using Swing, Jtable. It is working pretty good, but there is something I can't get figured out. This is how it is working right now: I have a Main class, this one creates a Sheet, Sheetholder etc. When a user inserts a value into a cell, the value is checked whether it points to another cell (e.g. '=B17') or whether it contains a formula ('=5*5'). Since I need the possibily of recursion (e.g. '=5*B17') the value is send to a class, called Parameter. The problem is that this class needs to access the Sheet: e.g. 'Sheet.getContent(1,16)'. How can I achieve this? I have tried multiple options, but since the Main is a constructor I can't simply call the Main.sheet. Thank you for reading!

http://stackoverflow.com/comment/30996471
comment on: http://stackoverflow.com/a/20695373
type: AnswerComment
score: 0
type: Comment
has text: I got the impression from the question that OP was having trouble reading the text fields - like maybe a scoping issue with `a1, b1, c1` or something. Although the two mathematics errors are obviously a problem. Until OP clarifies what the difficulty is, ("I'm having trouble with this line of code because my wife keeps distracting me when I try to type it") I don't see how any answer can really be deemed correct.

http://stackoverflow.com/a/20739445
score: 0
has body: Do like this. Hope this will help you. Map&lt;String,List&lt;Order&gt;&gt; map = new HashMap&lt;String,List&lt;Order&gt;&gt;(); Map&lt;String,List&lt;Order&gt;&gt; customerOrders = new HashMap&lt;String,List&lt;Order&gt;&gt;(); for (Map.Entry&lt;String,List&lt;Order&gt;&gt; entry:customerOrders.entrySet()){ if(entry.getKey().equals(customerId)){ customerOrders.put(entry.getKey(),entry.getValue()); } }
type: Answer
answers question: http://stackoverflow.com/q/20739283

http://stackoverflow.com/comment/31199500
score: 0
comment on: http://stackoverflow.com/a/20807155
type: AnswerComment
has text: I forgot about Proxy. It's an interesting idea, though all objects are subclasses of an abstract base class and so this won't work directly. I'll see if I can make this work and report back.
type: Comment

http://stackoverflow.com/comment/31074605
comment on: http://stackoverflow.com/q/20738888
score: 2
type: Comment
type: QuestionComment
has text: never to load image inside paintComponent (ii = new ImageIcon("redsquare.png");), create a local variable for this Object

http://stackoverflow.com/comment/31118383
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20763269
has text: @blackbelt I initialized it and it worked but the thing is the array has doubled it. I mean the same value is there twice

http://stackoverflow.com/a/20786862
downvote count: 0
has comment: http://stackoverflow.com/comment/31159554
type: Answer
has comment: http://stackoverflow.com/comment/31159475
answers question: http://stackoverflow.com/q/20786731
has body: "I'm wondering if there's any way to print text without using JLable or JtextField" You could always draw the text in a JPanel. Takes a lot more work, but you can do a lot more with your text. public class TextPanel extends JPanel{ protected void paintComponent(Graphics g){ super.paintComponent(g); g.drawString("Hello, Stackoverflow!", xLocation, yLocation); } } See Drawing Text with Graphics
has comment: http://stackoverflow.com/comment/31159491
upvote count: 1
has comment: http://stackoverflow.com/comment/31159642
accepted answer of: http://stackoverflow.com/q/20786731
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31101652
comment on: http://stackoverflow.com/a/20725516
score: 0
type: AnswerComment
type: Comment
has text: Actually, I am dumb and already solved it by `try` and `catch`

http://stackoverflow.com/q/20821966
has answer: http://stackoverflow.com/a/20822428
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/31223842
type: Question
has body: Freebase query example in python: I know that I'm dyslexic and I don't have a PhD but I always find Google APIs incomprehensible. I just need an example on the following: Get the '/music/genre' list and then get the subgenres ... could anyone explain difference between operators in this program int i=10;j=10; int n=i++%5; int k=++j%5; when i try this program iam getting n=0 ,k=1 and i=11,j=11 and ++a and a++ operator with other operators. thank you in advance.
favorite count: 0
tagged with: unary-operator
has title: can anyone explain difference between operators in this program int i=10;int n=i++%5;int k=++i%5;
answer count: 3
has answer: http://stackoverflow.com/a/20822012
upvote count: 0
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31223837
has answer: http://stackoverflow.com/a/20822000

http://stackoverflow.com/comment/31269150
score: 0
comment on: http://stackoverflow.com/q/20845223
type: Comment
type: QuestionComment
has text: NPE and further information has been added. By the way, any particular reason for the downvote?

http://stackoverflow.com/comment/31085293
comment on: http://stackoverflow.com/a/20744021
type: Comment
has text: It wasn't intended to be a solution. It was intended to help you debug by narrowing in on the problem, so *you* can solve it.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31191888
has text: I guess what's wrong. You can't use nested properties for the columnModel.property. #{car['something']} is a short for #car.something, ie "car.getSomething()" on bean side. That is invalid if property name contains dots. I don't see another syntax that would do, but you can create direct properties on your exam class. Example : `public String getRapportID() { return getExamen().getRapport().getID(); }` and so use rapportID as property name.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20791082
type: Comment

http://stackoverflow.com/q/20803664
favorite count: 0
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/20803788
accepted answer: http://stackoverflow.com/a/20803788
has answer: http://stackoverflow.com/a/20803721
has body: I have a program where I was able to successfully execute cmd commands from my code, but I want to be able to get the output from the cmd command. How can I do that? So far my code is: Second.java: public class Second { public static void main(String[] args) { System.out.println("Hello world from Second.java"); } } and Main.java public class Main { public static void main(String[] args) { String filename = args[1].substring(0, args[1].length() - 5); String cmd1 = "javac " + args[1]; String cmd2 = "java " + filename; Runtime r = Runtime.getRuntime(); Process p = r.exec(cmd1); // i can verify this by being able to see Second.class and running it successfully p = r.exec(cmd2); // i need to see this output to see if System.out.println("Done"); } } I can check the first command is working successfully by checking for Second.class, but what if this class generated some error, how will I be able to see that error?
type: AnsweredQuestion
tagged with: runtime.exec
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/20803748
answer count: 3
linked to: http://stackoverflow.com/q/6161604
has title: Get output of cmd command from java code
tagged with: windows
possible better answer: http://stackoverflow.com/a/20803748
tagged with: cmd
tagged with: exec

http://stackoverflow.com/q/20727456
has title: How can I get data to jtable from DB like this
favorite count: 0
has answer: http://stackoverflow.com/a/20727474
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31053812
has body: I want to get data from DB to jtable. I'm not ask the normal way. That meant I send some data to DB. think like this. By invoice i send so many data to Db.. the end of the day I want to search item sale.. think a sale item called 'apple' sold for 4 times. 0.item item code qty 1.apple 20 5 2.apple 20 20 3.apple 20 23 4.apple 20 7 They are in the Db.But I want only 0.item item code qty 1.apple 20 55 The summary of sale items of the day.
type: Question
accepted answer: http://stackoverflow.com/a/20727474
answer count: 1
tagged with: database
score: 0

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/20803817

http://stackoverflow.com/comment/34448032
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20732100
has text: Have you been able to find a solution to this? It's affecting other components as well: http://stackoverflow.com/questions/22620919/combobox-options-receive-margin-upon-making-the-stage-resizable

http://stackoverflow.com/comment/31203161
type: QuestionComment
has text: ... You're asking how to access a database?
comment on: http://stackoverflow.com/q/20810887
score: 0
type: Comment

http://stackoverflow.com/q/20703229
tagged with: mysql
score: 2
tagged with: sql
downvote count: 0
type: UnansweredQuestion
has title: Finding upcoming birthdays with jOOQ
tagged with: jooq
type: Question
has answer: http://stackoverflow.com/a/20728037
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20722757
answer count: 2
tagged with: date-arithmetic
has body: I'm trying to convert an existing query which looks for upcoming birthdays to use jOOQ. My original query - using MySQL, and a bit simplified - is SELECT COUNT(*) FROM people WHERE DATE_ADD(people_dob, INTERVAL YEAR(CURDATE()) - YEAR(people_dob) YEAR) BETWEEN CURDATE() and DATE_ADD( CURDATE(), INTERVAL 7 DAY) I tried to express it using jOOQ but failed. I got as close as context .selectCount() .from(PEOPLE) .where( PEOPLE_DOB.add(year(currentTimestamp()).minus(year(PEOPLE_DOB))) .between(currentTimestamp()).and(currentTimestamp().add(7))); Unfortunately, that translates to select count(*) from `people` where date_add(`people`.`people_dob`, interval (extract(year from current_timestamp()) - extract(year from `people`.`people_dob`)) day) between current_timestamp() and date_add(current_timestamp(), interval 7 day) What breaks the query here is the expr_unit argument for [DATE_ADD][date_add], which is my original query is YEAR, but in the one rendered by jOOQ is DAY. How can I translate this query into jOOQ? I don't care much about the current format, I just want to understand how to get the same result.
tagged with: java

image
tags question: http://stackoverflow.com/q/20826216
tags question: http://stackoverflow.com/q/20687056
tags question: http://stackoverflow.com/q/20846435
tags question: http://stackoverflow.com/q/20756006
tags question: http://stackoverflow.com/q/20806801
tags question: http://stackoverflow.com/q/20848906
tags question: http://stackoverflow.com/q/20724604
tags question: http://stackoverflow.com/q/20800140
tags question: http://stackoverflow.com/q/20776340
tags question: http://stackoverflow.com/q/20799030
tags question: http://stackoverflow.com/q/20803436
tags question: http://stackoverflow.com/q/20745580
tags question: http://stackoverflow.com/q/20746172
tags question: http://stackoverflow.com/q/20761413
tags question: http://stackoverflow.com/q/20712897
tags question: http://stackoverflow.com/q/20785044
tags question: http://stackoverflow.com/q/20727534
tags question: http://stackoverflow.com/q/20766572
tags question: http://stackoverflow.com/q/20744509
tags question: http://stackoverflow.com/q/20686316
tags question: http://stackoverflow.com/q/20738888
tags question: http://stackoverflow.com/q/20802649
tags question: http://stackoverflow.com/q/20831078
tags question: http://stackoverflow.com/q/20733818
tags question: http://stackoverflow.com/q/20789906
tags question: http://stackoverflow.com/q/20752666
tags question: http://stackoverflow.com/q/20777032
tags question: http://stackoverflow.com/q/20818230
tag name: image
tags question: http://stackoverflow.com/q/20829899
tags question: http://stackoverflow.com/q/20739029
tags question: http://stackoverflow.com/q/20770045
type: Tag
tags question: http://stackoverflow.com/q/20843873

http://stackoverflow.com/a/20680107
upvote count: 1
downvote count: 1
has body: You can do it using a nested class. public class ThreadsManager { private static String userName; private ThreadsManager() { } public static ThreadsManager getInstance(String user){ if (userName == null) userName = user; // the holder's instance is only initialised at this point, // after userName is set. return Holder.instance; } static class Holder { private final static ThreadsManager instance = new ThreadsManager(); } }
answers question: http://stackoverflow.com/q/20679974
has comment: http://stackoverflow.com/comment/30967802
has comment: http://stackoverflow.com/comment/30967847
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/30967689

http://stackoverflow.com/q/20787047
has body: First of all I want t say that I am aware of other easier and better loops for this kind of work, but I just want to practise a little with Iterator. So, I am looping through an ArrayList and I want to add and remove elements in it with iterator but when I run the program I get no output on screen. This is what I have: public class Orders { ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); Iterator it = list.iterator(); public void addOrder(String s) { while(it.hasNext()){ String st = (String) it.next(); if(s.equals(st)){ System.out.println("The order '"+s+"' already exists."); } else{ list.add(s); System.out.println("Order '"+s+"' was added."); } } } public void deleteOrder(String s) { while(it.hasNext()){ String st = (String) it.next(); if(s.equals(st)){ list.remove(s); System.out.println("The order '"+s+"' was deleted succesfully."); } else{ System.out.println("The order '"+s+"' was not found."); } } } public void showList(){ while(it.hasNext()){ String st = (String) it.next(); System.out.println("Order: '"+st+"'. \n"); } } } public class RemoveOrder { private Orders ord; public RemoveOrder( Orders o ) { ord = o; } public void remove() { ord.deleteOrder( "jk123" ); ord.deleteOrder( "jk125" ); ord.showList(); } } public class AddOrder { private Orders ord; public AddOrder( Orders o ) { ord = o; } public void add() { ord.addOrder( "jk123" ); ord.addOrder( "jk124" ); ord.addOrder( "jk125" ); ord.addOrder( "jk126" ); ord.showList(); } } public class IteratorRun implements Runnable { Orders ord = new Orders(); AddOrder ao = new AddOrder(ord); RemoveOrder ro = new RemoveOrder(ord); public void run() { try { ao.add(); ro.remove(); } catch (Exception e) { } } } And in main: Thread t1 = new Thread(new IteratorRun()); t1.start();
has title: Adding, removing and printing from ArrayList with Iterator
has comment: http://stackoverflow.com/comment/31159729
has comment: http://stackoverflow.com/comment/31159675
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20794551
tagged with: java
has answer: http://stackoverflow.com/a/20787885
type: Question
linked to: http://stackoverflow.com/q/7409740
linked to: http://stackoverflow.com/q/993025
tagged with: arraylist
score: 0
tagged with: iterator
answer count: 2
possible better answer: http://stackoverflow.com/a/20787885
accepted answer: http://stackoverflow.com/a/20794551
has comment: http://stackoverflow.com/comment/31159704

http://stackoverflow.com/a/36531999
has body: I think i got the answer: Ps=con.preparestatement("select * from tablename"); Resultset rs=ps.execute query(); if(rs.last()) { String aidv ="TAR" 1; } else { int id=RS.getRow(); id ; aidv="TAR" id; }
answers question: http://stackoverflow.com/q/20827149
type: Answer
has comment: http://stackoverflow.com/comment/60668210
score: 0

http://stackoverflow.com/comment/84365682
comment on: http://stackoverflow.com/q/20814607
has text: That’s specified in [JLS§12.6.1](https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6.1-400): “*Optimizing transformations of a program can be designed that reduce the number of objects that are reachable to be less than those which would naively be considered reachable.*”. You could simply sort your `unwrapped` list, followed by recreating the list of `WeakReference`s. That would not only fix the problem but simplify the code, as even the `unwrap` method doesn’t need to change the incoming list, etc.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31009708
type: Comment
has text: `final String s="abc"`; works fine. `s` is a variable again right?
comment on: http://stackoverflow.com/a/20703737
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31208341
has text: Unfortunately I have no change to know how long the String will be.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20813711
type: Comment

http://stackoverflow.com/a/20721734
has comment: http://stackoverflow.com/comment/31043089
answers question: http://stackoverflow.com/q/20721576
score: 0
has comment: http://stackoverflow.com/comment/31043221
type: Answer
has comment: http://stackoverflow.com/comment/31043154
has body: put your tag between pre tags out.print("&lt;pre&gt;"+yourXML+"&lt;/pre&gt;"); it worked for me

http://stackoverflow.com/q/20821450
has title: What are the alternatives to rotation methods in java
favorite count: 0
has comment: http://stackoverflow.com/comment/31222954
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31222955
has answer: http://stackoverflow.com/a/20821469
score: -5
tagged with: java
type: Question
tagged with: rotation
tagged with: polygon
has comment: http://stackoverflow.com/comment/31222983
upvote count: 0
has comment: http://stackoverflow.com/comment/31223175
has comment: http://stackoverflow.com/comment/31222993
downvote count: 5
has comment: http://stackoverflow.com/comment/31222945
has body: I am asked to create a program as following.. "create random polygons, the point when you press the mouse button is considered like a nail in the polygon. You can drag the polygon with the mouse and place it somewhere on the wall. When you release the mouse button, the polygon rotates around the nail in order to simulate the pulling of the gravity You are not allowed to use methods from java (like AffineTransform). " so far I managed to create random polygons, add a "nail", and drag the shapem but I can't seem to find a way to rotate it , can I -sort of- Transform it ?
answer count: 1

http://stackoverflow.com/a/20797431
answers question: http://stackoverflow.com/q/20796961
has body: You can compare while ignoring the last digits: boolean equals = Math.abs(myResult - msExcelResult) &lt; 1
score: 0
has comment: http://stackoverflow.com/comment/31179296
type: Answer

http://stackoverflow.com/a/20697940
score: 3
has body: What about: @Service public class DeactivationService { private static final Logger LOG = Logger.getLogger(DeactivationService.class); @Autowired @Qualifier("SkuAmerDao") private SkuDAO amerdao; //Dependency Injection Amer @Autowired @Qualifier("SkuEMEADao") private SkuDAO emeadao; //Dependency Injection EMEA // no constructor needed. } public abstract class BaseDao implements SkuDAO { private final JdbcTemplate jdbcTemplate; protected BaseDao() { this.jdbcTemplate = new JdbcTemplate(getDataSource()); } protected abstract DataSource getDataSource(); public List&lt;Sku&gt; find() { //some processing to find the sku, purposely left empty as it is a sample code } public void deactivate(List&lt;Sku&gt;) { //some processing to deactivate the sku, purposely left empty as it is a sample code } } @Repository("SkuAmerDao") public class SkuAmerDAOImpl extends BaseDao { @Autowired @Qualifier("AmericasDataSource") private DataSource datasource; //Dependency injection @Override protected DataSource getDatasource() { return dataSource; } } @Repository("SkuEMEADao") public class SkuEMEADAOImpl extends BaseDao { @Autowired @Qualifier("EMEADataSource") private DataSource datasource; //Dependency injection @Override protected DataSource getDatasource() { return dataSource; } } Always the same principle: class is made a bean by an annotation @Service, @Component, @Repository (those annotations can take the name of the bean as value) injection of dependency is made on fields with @Autowired and if there are more than one corresponding bean (in your case you have two DataSources), add a @Qualifier to specify which one. Full documentation here.
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20697183
accepted answer of: http://stackoverflow.com/q/20697183
type: Answer
downvote count: 0

http://stackoverflow.com/q/20842088
has answer: http://stackoverflow.com/a/20842197
accepted answer: http://stackoverflow.com/a/20842153
type: Question
possible better answer: http://stackoverflow.com/a/20842194
has body: I have got 2 runnables. What is the best wait to start one after another? For instance, Rrunnable r = new Runnable(this,initialize); r.execute(); unzipTask rT = new unzipTask(this); rT.execute();
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31262126
has answer: http://stackoverflow.com/a/20842153
has title: Start one Runnable after another
tagged with: android
has comment: http://stackoverflow.com/comment/31261271
has comment: http://stackoverflow.com/comment/31262747
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20842194
tagged with: java

http://stackoverflow.com/comment/31175721
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20795767
score: 1
has text: Have you looked at [visualvm](http://visualvm.java.net/)?

http://stackoverflow.com/q/20730394
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20731800
tagged with: jdbc
has title: How to use sum case query in netbeans
has comment: http://stackoverflow.com/comment/31061427
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20731800
has body: I am using the query below as: String qry1 = "SELECT SUM(*) FROM class_cse where Student_ID='" + StudentUserBean.getUserId() + "'"; try { ResultSet rs, rs1; rs = db2.stmt.executeQuery(qry1); while (rs.next()) { String count = rs.getString("SUM(*)"); jTextField6.setText(count); } } catch (SQLException ex) { Logger.getLogger(AdminInfo.class.getName()).log(Level.SEVERE, null, ex); } now I use this query String qry1=select sum(case when maths = 'ABSENT' then 1 else 0 end) + sum(case when ca = 'ABSENT' then 1 else 0 end) + sum(case when cn = 'ABSENT' then 1 else 0 end) from attendance_table; the sum of this query is set in jTextField5. Could you tell me how to use this query?
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: sql
answer count: 1

http://stackoverflow.com/q/20740634
tagged with: singly-linked-list
tagged with: recursion
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31077351
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/20741054
has title: Finding the kth to last element of a singly linked list
has comment: http://stackoverflow.com/comment/31078681
answer count: 3
has comment: http://stackoverflow.com/comment/31077557
tagged with: pass-by-value
has answer: http://stackoverflow.com/a/20741557
possible better answer: http://stackoverflow.com/a/20741936
has comment: http://stackoverflow.com/comment/31078316
favorite count: 0
has answer: http://stackoverflow.com/a/20741936
upvote count: 2
has body: I have two recursive solutions to the "kth to last element of a singly linked list" problem in Java: Solution 1: public static Node nthToLast(Node head, int k , int i){ if (head == null) return null; Node n = nthToLast(head.next, k, i); i = i + 1; if (i == k) return head; return n; } Solution 2: public class IntWrapper { public int value = 0; } public static Node nthToLast(Node head, int k, IntWrapper i){ if (head == null) return null; Node n = nthToLast(head.next, k, i); i.value = i.value + 1; if (i.value == k) return head; return n; } The first solution returns null, while the second solution works perfectly. The first solution passes k by value, while the second solution wraps the int value in a class and passes it. I have two questions: Why is the first solution not working in Java? Why is pass-by-value through the local variable i in each method call not working the same as the pass-by-reference version? The Integer class in Java wraps int, but replacing the int to Integer in the first solution does not work as well. Why?
accepted answer: http://stackoverflow.com/a/20741054
tagged with: pass-by-reference

http://stackoverflow.com/a/20739659
type: AcceptedAnswer
downvote count: 1
has body: you set image resource after setImageBitmap() the bitmap will never be drawn in this case, if you want to load both map and circle in imageview than alter your code to full fill your requirements: private void createBitMap() { Bitmap bitMap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); //creates bmp bitMap = bitMap.copy(bitMap.getConfig(), true); //lets bmp to be mutable Canvas canvas = new Canvas(bitMap); //draw a canvas in defined bmp Paint paint = new Paint(); //define paint and paint color paint.setColor(Color.RED); paint.setStyle(Style.FILL_AND_STROKE); //paint.setStrokeWidth(0.5f); paint.setAntiAlias(true); //smooth edges ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.setImageBitmap(bitMap); //changed set image resource to set image background resource imViewAndroid.setBackgroundResource(R.drawable.map); canvas.drawCircle(50, 50, 3, paint); //invalidate to update bitmap in imageview imageView.invalidate(); } now the circle will be drawn. cheers, Hamad
has comment: http://stackoverflow.com/comment/31452920
has comment: http://stackoverflow.com/comment/31076117
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31075912
answers question: http://stackoverflow.com/q/20739029
has comment: http://stackoverflow.com/comment/82088594
accepted answer of: http://stackoverflow.com/q/20739029
has comment: http://stackoverflow.com/comment/31076055
upvote count: 3

http://stackoverflow.com/comment/31024349
has text: @user2130360 `.` matches ANY character. `1` is a character. The character class that peter uses in his answer, matches any non-digit character. Alternative to `\\D*` you could use `.*?` which matches all characters until it matches the next thing in the regex
comment on: http://stackoverflow.com/a/20711458
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20733957
has comment: http://stackoverflow.com/comment/31065942
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/31067604
upvote count: 2
tagged with: twitter-bootstrap
tagged with: java
tagged with: selenium
has title: Selenium ElementNotVisibleException for Bootstrap Popover
has comment: http://stackoverflow.com/comment/31077308
accepted answer: http://stackoverflow.com/a/20761880
type: Question
has comment: http://stackoverflow.com/comment/31065814
tagged with: acceptance-testing
has comment: http://stackoverflow.com/comment/31065871
answer count: 2
downvote count: 0
has body: I am writing some tests for my Java/Spring/Boostrap based website using Selenium 2.37.1 and Chrome Driver 2.7 (with Chrome 31.0.1650.63 on Ubuntu 13.10). The test clicks on the Login text, and then attempts to enter the provided username and password into the form before clicking the submit button. I have broken apart the finding of the elements and calling sendKeys to determine where Selenium is following over (it's on username.sendKeys) public void login(final String user) { webDriver.findElement(By.id("login")).click(); final WebElement loginForm = webDriver.findElement(By.id("loginForm")); final WebElement username = loginForm.findElement(By.id("username")); username.sendKeys(user); final WebElement password = loginForm.findElement(By.id("password")); password.sendKeys(dslConstants.PASSWORD); loginForm.submit(); } Username is found successfully, but when I run username.isDisplayed() when it is actually being displayed. I am assuming this has something to do with Selenium not being able to handle Bootstrap popovers correctly, and wondering if anyone has any fixes for this? Thanks in advance. EDIT: loginForm.isDisplayed() also returns false when it is visible when debugging. I also tried adding a wait condition, which doesn't solve the situation either. final WebDriverWait wait = new WebDriverWait(webDriver, TIME_OUT_IN_SECONDS); wait.until(ExpectedConditions.visibilityOf(webDriver.findElement(By.id("username")))); Edit2: Here is the HTML/JSTL aspects of the page. &lt;div class="navbar"&gt; &lt;ul class="nav navbar-nav"&gt; &lt;li&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;sec:authorize ifAnyGranted="ROLE_ANONYMOUS"&gt; &lt;div class="hide" id="login-popover"&gt; &lt;form role="form" id="loginForm" method="post" action="j_spring_security_check"&gt; &lt;div class="control-group"&gt; &lt;label class="control-label" for="username"&gt;Username&lt;/label&gt; &lt;div class="controls"&gt; &lt;input type="text" id="username" class="form-control" name="j_username" …
possible better answer: http://stackoverflow.com/a/20740029
has comment: http://stackoverflow.com/comment/31065771
favorite count: 0
has answer: http://stackoverflow.com/a/20740029
has comment: http://stackoverflow.com/comment/31065720
has answer: http://stackoverflow.com/a/20761880
has comment: http://stackoverflow.com/comment/31065781
has comment: http://stackoverflow.com/comment/31066050
has comment: http://stackoverflow.com/comment/31079717

http://stackoverflow.com/comment/31259011
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20840791
score: 1
has text: Even an applet would be client side. The Client would have to download all the requisite code from your server to run it local in his applet-sandbox. I do not think that you really want to do this. ... Is there any reason to create a preview via jasperViewer? Why you do not create a pdf (or xls or whatever) and forward this to the client via servlet?

http://stackoverflow.com/q/20813012
tagged with: java
tagged with: hibernate
has title: hibernate configuration in applicationContext ... Document is invalid: no grammar found
type: Question
has comment: http://stackoverflow.com/comment/31320825
has comment: http://stackoverflow.com/comment/31223599
score: 0
has comment: http://stackoverflow.com/comment/31301655
has comment: http://stackoverflow.com/comment/31234086
has body: I am getting this error when I am trying to persist an object into the database Dec 28, 2013 7:24:04 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_45\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;M:\app\oracleuser\product\12.1.0\dbhome_1\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Common Files\Lenovo;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86)\Windows Live\Shared;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files\Java\jdk1.7.0_45\bin;M:\maven\apache-maven-3.1.1\bin;. Dec 28, 2013 7:24:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:DoctorAssist' did not find a matching property. Dec 28, 2013 7:24:04 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Dec 28, 2013 7:24:04 PM org.apache.coyote.AbstractProtocol init INFO: Initializing Prot…
answer count: 0
type: UnansweredQuestion
tagged with: annotations
has comment: http://stackoverflow.com/comment/31209690
tagged with: spring

http://stackoverflow.com/comment/31023435
comment on: http://stackoverflow.com/q/20710946
type: Comment
type: QuestionComment
score: 1
has text: @HotLicks: The exception only indicates that a fixed stack size was exceeded. It does not indicate there is an infinite recursion. In fact, there is not. The Collatz sequence is known to be finite for all the samples in this Project Euler problem.

http://stackoverflow.com/comment/31002072
type: AnswerComment
score: 0
type: Comment
has text: @Khay I guess you already know the answer and you're testing all of the people here.
comment on: http://stackoverflow.com/a/20699339

http://stackoverflow.com/comment/30983248
comment on: http://stackoverflow.com/q/20688705
type: Comment
has text: the for loop is somewhat turning me off i m looking for one-liner.... it works for other editors..like wordpad,etc,,but the notepad is skipping out the new line characters if i dont use "\r\n"
type: QuestionComment
score: 0

http://stackoverflow.com/q/20775111
has answer: http://stackoverflow.com/a/20775367
type: Question
has comment: http://stackoverflow.com/comment/31139139
has answer: http://stackoverflow.com/a/20775413
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31138870
type: UnansweredQuestion
tagged with: android
has body: I'm trying to create a new LinearLayout and now i have added a text and a background and now the background appears and still not full as it seems in the graphical they both show up in the graphical layout example here: https://www.dropbox.com/s/k58uznho9pu5qky/Untitled1.png and when i test it out in a emulator which is real device the background isn't showing probably with some white space down and the text doesn't even appear example here: https://www.dropbox.com/s/q9e45sunbsesrd1/uniteled3.png <TextView android:id="@+id/two" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:paddingTop="10sp" android:text="testing ytestifnfndfijdfhffdkjdfkjfdjkj" android:textSize="25sp" />
has title: LinearLayout and TextView doesn't show properly
tagged with: java

http://stackoverflow.com/q/20797775
type: Question
has comment: http://stackoverflow.com/comment/31932267
score: 2
answer count: 1
downvote count: 0
has title: Exception in thread "main" java.lang.NoClassDefFoundError: org/tmatesoft/sqljet/core/SqlJetException
has body: I was trying to get the SVN project to my local directory. But I am getting Exception. Exception in thread "main" java.lang.NoClassDefFoundError: org/tmatesoft/sqljet/core/SqlJetException at org.tmatesoft.svn.core.internal.wc17.SVNWCContext.&lt;init&gt;(SVNWCContext.java:278) at org.tmatesoft.svn.core.internal.wc17.SVNWCContext.&lt;init&gt;(SVNWCContext.java:274) at org.tmatesoft.svn.core.wc2.SvnOperationFactory.obtainWcContext(SvnOperationFactory.java:1269) at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1232) at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:291) at down.main(down.java:20) Caused by: java.lang.ClassNotFoundException: org.tmatesoft.sqljet.core.SqlJetException 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) ... 6 more Thank you
favorite count: 0
has answer: http://stackoverflow.com/a/20798020
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31179174
tagged with: java

http://stackoverflow.com/q/20796668
has comment: http://stackoverflow.com/comment/31177820
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20798047
score: -1
favorite count: 0
type: Question
downvote count: 2
upvote count: 1
tagged with: spring
answer count: 1
has body: I have an issue with saveOrUpdateAll() method of Spring BaseHibernateDAO. I am unable to insert the value. It always tries to fire the update query. How can I insert or update a Collection objects in a table using BaseHibernateDAO of Spring
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36639192
has answer: http://stackoverflow.com/a/20798047
has comment: http://stackoverflow.com/comment/31180065
has title: How can I insert or update a Collection objects in a table -- saveOrUpdateAll() method only tries to update not inserting any values

http://stackoverflow.com/q/20766514
has body: I did the following to add jar files to my Java project: https://stackoverflow.com/a/325545/2653179 It worked, but what do I do if I want to send my project to another computer? The project on another computer doesn't recognize the import when doing so.
linked to: http://stackoverflow.com/q/325524
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20766542
score: 1
tagged with: java
has title: JAR files in a Java Project
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31123950
has answer: http://stackoverflow.com/a/20766542
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31123936
favorite count: 0
downvote count: 0

http://stackoverflow.com/a/20758279
has body: You can use instanceof operator.Try this Iterator&lt;Number&gt; itr = collection.iterator(); while(itr.hasNext()) { Number number = itr.next(); if(number instanceof Integer) { Integer value = (Integer)number ; System.out.print("Integer is "+value ); } }
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20758080

build
tags question: http://stackoverflow.com/q/20739780
tags question: http://stackoverflow.com/q/20785556
tags question: http://stackoverflow.com/q/20683926
tag name: build
type: Tag
tags question: http://stackoverflow.com/q/20746071
tags question: http://stackoverflow.com/q/20707544

http://stackoverflow.com/q/20763064
type: UnansweredQuestion
score: 6
type: Question
tagged with: java
tagged with: android-recents
has body: Where does the OS saves the screenshots it takes of the recent apps? I have searched for the finding the directory location but couldn't find any info. I have also looked through Android source code and found that Google is calling toggleRecentApps() using handler but couldn't reverse engineer the code further. Does anybody knows the location/directory of the screenshots of Recent apps? Regards
downvote count: 0
favorite count: 0
tagged with: android
upvote count: 6
has title: Location of Recent apps screenshots in Android
answer count: 0

http://stackoverflow.com/comment/31204037
comment on: http://stackoverflow.com/a/20811074
has text: `static char[][] grid;` grid is an [array](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html) of primitive type [`char`](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20782403
has comment: http://stackoverflow.com/comment/31151825
has answer: http://stackoverflow.com/a/23312011
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31151778
tagged with: java
downvote count: 3
score: -3
type: Question
has comment: http://stackoverflow.com/comment/31156377
has answer: http://stackoverflow.com/a/20782450
has comment: http://stackoverflow.com/comment/31151692
upvote count: 0
has body: I am getting following error Kindly resolve this issue. Map approvers1 = new HashMap&lt;String, AdaptApproverObject&gt;(); List&lt;String&gt; approverObjectTids = new ArrayList&lt;String&gt;();
answer count: 3
has comment: http://stackoverflow.com/comment/31151752
has comment: http://stackoverflow.com/comment/31151710
has comment: http://stackoverflow.com/comment/31151666
has comment: http://stackoverflow.com/comment/31151845
has comment: http://stackoverflow.com/comment/31152021
has comment: http://stackoverflow.com/comment/31151877
has title: The type HashMap is not generic; it cannot be parameterized with arguments <String,
has answer: http://stackoverflow.com/a/20782433
favorite count: 0
has comment: http://stackoverflow.com/comment/31151635
has comment: http://stackoverflow.com/comment/31151791

http://stackoverflow.com/comment/31246308
type: Comment
type: QuestionComment
has text: try using map() to read the file from distributed cache and then use cacheReader.readLine() to read the contents of the file.
comment on: http://stackoverflow.com/q/20833426
score: 0

http://stackoverflow.com/comment/31211643
score: 0
has text: Check [this link](http://stackoverflow.com/questions/9027629/android-clipboard-code-that-works-on-all-api-levels)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20815502

http://stackoverflow.com/comment/31053079
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20726489
type: Comment
has text: @peeskillet thanks for noticing :) "Less code is good" is my motto (as long as it's readable). It's amazing how a little regex kung fu can drastically reduce the amount of code you need.

http://stackoverflow.com/comment/31047236
has text: Thank you... I think that is more clear than write my dirty code... Sorry... It works. Thank you and have a fantastic christmas.
score: 0
comment on: http://stackoverflow.com/a/20723827
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31009786
type: QuestionComment
comment on: http://stackoverflow.com/q/20684838
score: 1
has text: @MartinJames except that it's UDP and the sender will never know if its message truly arrived
type: Comment

http://stackoverflow.com/q/20776437
linked to: http://stackoverflow.com/q/513832
upvote count: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
type: UnansweredQuestion
has body: public Account findByInterest(String interest){ for(Map.Entry&lt;Long, Account&gt; e : accounts.entrySet()){ for(int i = 0; i &lt; e.getValue().getInterests().size(); i++) { if(e.getValue().getInterests().get(i) == interest){ return e.getValue(); } } } return null; } I'm trying to search in a HashTable of Objects to find an objected with a List of Strings, which has the same string as this method receives... What am I doing wrong?
has title: Search for String in List
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/20776466
downvote count: 1
type: Question
score: -1

http://stackoverflow.com/comment/31074050
has text: The Client is using Windows Server 2008 r2 (32 Bit Operating System).
type: Comment
comment on: http://stackoverflow.com/q/20737651
type: QuestionComment
score: 0

http://stackoverflow.com/q/20763027
tagged with: paintcomponent
upvote count: 6
possible better answer: http://stackoverflow.com/a/20763263
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20763381
accepted answer: http://stackoverflow.com/a/20763381
tagged with: java
score: 6
tagged with: swing
type: Question
tagged with: jpanel
tagged with: affinetransform
has answer: http://stackoverflow.com/a/20763263
answer count: 2
has title: AffineTransform seeming to ignore component bounds
downvote count: 0
favorite count: 0
has body: I have the following: public class ParametricEQView extends JPanel implements PluginView { private static final int BAND_WIDTH = 3; private static final int THROW_HEIGHT = 64; private static final int WIDTH = 128*BAND_WIDTH + 2*MARGIN; private static final int HEIGHT = 2*THROW_HEIGHT + 2*MARGIN; private static final int MID_HEIGHT = THROW_HEIGHT + MARGIN; private final ParametricEQ _peq; public ParametricEQView(ParametricEQ peq) { super(); _peq = peq; SwingUtils.freezeSize(this, WIDTH, HEIGHT); setToolTipText("Parametric Equalizer"); } @Override public void paint(Graphics g) { final Graphics2D g2d = (Graphics2D) g; final int max = findMax(); g.setColor(BACKGROUND); g.fillRect(0, 0, WIDTH, HEIGHT); g.setColor(DATA); final double scalingFactor = -((double) THROW_HEIGHT) / max; final double[] fineLevels = _peq.getFineLevels(); int x = MARGIN; int h; final int[] xPoints = new int[128]; final int[] yPoints = new int[128]; for (int i = 0; i &lt; 128; ++i) { h = (int) (fineLevels[i] * scalingFactor); xPoints[i] = x; yPoints[i] = MID_HEIGHT + h; x += BAND_WIDTH; } g.drawPolyline(xPoints, yPoints, 128); g.setColor(AXES); g.drawLine(MARGIN, MARGIN, MARGIN, HEIGHT-MARGIN); g.drawLine(MARGIN, MID_HEIGHT, WIDTH-MARGIN, MID_HEIGHT); g.setFont(AXIS_FONT); final FontMetrics metrics = g.getFontMetrics(); int width = (int) metrics.getStringBounds(AXIS_LABEL_INPUT_MIDINUM, g).getWidth(); g.drawString(AXIS_LABEL_INPUT_MIDINUM, WIDTH-MARGIN-width, HEIGHT-3); final AffineTransform atx = new AffineTransform(); atx.setToRotation(-Math.PI/2, 0, HEIGHT); g2d.setTransform(atx); final String topLabel = "+" + max; width = (int) metrics.getStringBounds(topLabel, g).getWidth(); g2d.drawString(topLabel, HEIGHT-MARGIN-width, HEIGHT+10); width = (int) metrics.getStringBounds(AXIS_LABEL_OUTPUT_VELOCITY, g).getWidth(); g2d.drawString(AXIS_LABEL_OUTPUT_VELOCITY, MID_HEIGHT-(width/2), HEIGHT+10); g2d.drawString("-" + max, MARGIN, HEIGHT+10); } private int findMax() { int max = 3; for (int i = 0; i &lt; …

http://stackoverflow.com/a/20807242
score: 1
answers question: http://stackoverflow.com/q/20806993
downvote count: 0
has body: Remove first .* from pattern: "^.*(?!(catch...", because it allow if and while! Compile your regular expression with the multiline flag. Working code: String functions = "^((?!(catch|if|while|try|return|finally|new|throw))).*$"; Pattern patternFunctions = Pattern.compile(functions, Pattern.MULTILINE); Matcher matcherFunctions = patternFunctions.matcher(test); More about java.util.regex.Pattern.Multiline In multiline mode the expressions ^ and $ match just after or just before, respectively, a line terminator or the end of the input sequence. By default these expressions only match at the beginning and the end of the entire input sequence.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/30975746
has text: ha ha ha, closed the previous open brace (hidden).. Now, removed it :)
type: Comment
comment on: http://stackoverflow.com/a/20681686
type: AnswerComment
score: 0

http://stackoverflow.com/a/20773463
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/34691684
has body: While building android apps, one requires to know the properties of the Android client. Such as screen size etc. One such method is by using android:attr which is android attributes. Here you have mentioned to return a specific attribute by mentioning the keyword after / symbol. Here the keyword is actionBarSize. The ? symbol is an operator which is used to access system configurations and properties in Android
answers question: http://stackoverflow.com/q/20773307
type: Answer

http://stackoverflow.com/comment/31182157
comment on: http://stackoverflow.com/a/20799356
score: 0
type: Comment
has text: +1: I have just commented about that though.. sorry didn't notice :) i do agree that he should change the design sense. In fact as he is checking with `Check button` whither `Add Button` is pressed: i don't see any reason for depending on the input controlling component, as peeskiller has pointed out
type: AnswerComment

http://stackoverflow.com/a/20681863
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20681601
downvote count: 0
type: Answer
has body: Hlo. Buddy first check the basic error. Try below code. public class V0206 { public static void main(String[] args) { int x = sc.nextInt(); int y = 400; int z = 100; int q = 4; int rest = (int) (x % y); int rest2 = (int) (x % z); int rest3 = (int) (x % q); boolean result = (rest3 == 0 &amp;&amp; rest2 != 0 || rest == 0 &amp;&amp; rest2 == 0) ? true : false; if (result == true) { System.out.println("Leap year"); } else { System.out.println("Not leap year"); } } } // one mistake like.. you have added extra semicolon. and checking the string variable like boolean variable.

http://stackoverflow.com/a/20781390
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31150269
has body: Without doing any kind of profiling, I would think that having no extra whitespace would be better for performance, if only marginally. It would save some bandwidth though.
answers question: http://stackoverflow.com/q/20781351
score: 1

http://stackoverflow.com/a/20688276
upvote count: 10
accepted answer of: http://stackoverflow.com/q/20685286
has body: With Gradle, whenever you add files or directories as dependencies, they are not treated as full-fledged artifacts (with group, name and version), but rather as simple files containing classes. It means that Gradle will not perform any conflicts resolutions on them, or pull transitive dependencies. For you, just to get started, I recommend just to add tomcat dependency. Make sure it is the same version as the one in Eclipse. apply plugin: 'war' repositories { mavenCentral() } dependencies { providedCompile 'org.apache.tomcat:tomcat-catalina:7.0.47' } Also, look into Eclipse Integration Gradle project as a long-term solution.
has comment: http://stackoverflow.com/comment/31003176
has comment: http://stackoverflow.com/comment/31542538
score: 10
has comment: http://stackoverflow.com/comment/31003395
has comment: http://stackoverflow.com/comment/31021617
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20685286

http://stackoverflow.com/q/20843730
type: AnsweredQuestion
score: 1
tagged with: java
has title: JTextField is blanking out my JPanels
possible better answer: http://stackoverflow.com/a/20843894
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/20843947
upvote count: 1
tagged with: jtextfield
has answer: http://stackoverflow.com/a/20843894
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31264333
has comment: http://stackoverflow.com/comment/31264216
favorite count: 0
has body: I am attempting to learn more about creating more dynamic GUI's. I am hoping to add different panels with different content and as you press buttons on one main panel, it changes the adjacent panels. I have added two panels and some buttons and when I test the program, it displays correctly. The problem is when I add a JTextField (or JTextArea) the panels are blank and there are no buttons. The strange thing is I haven't added the JTextField to either panel. I have only created a global variable. If I comment it out, the program runs correctly. Am I missing something very simple? Here is the gameWindow class that has the JTextField package rpgcreator; import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; class gameWindow extends JPanel { JPanel startWindowPanel; JPanel settingsPanel; JPanel characterPanel; JPanel scenarioPanel; JPanel mapPanel; JButton CharacterButton = new JButton("Create your character"); JButton StoryButton = new JButton("Choose your Story line"); JButton MapButton = new JButton("Choose your World"); //JTextField nameField = new JTextField(15); //comment or uncomment to see issue public gameWindow() { setLayout(new GridLayout(0,2,5,0)); startWindowPanel = new JPanel(new FlowLayout()); settingsPanel = new JPanel(new GridLayout(2,1)); startWindowPanel.setBackground(Color.blue); settingsPanel.setBackground(Color.black); startWindowPanel.add(MapButton); startWindowPanel.add(StoryButton); startWindowPanel.add(CharacterButton); add(startWindowPanel); add(settingsPanel); } } Here is main package rpgcreator; import javax.swing.JFrame; public class RPGCreator extends JFrame{ private static void mainWindow(){ RPGCreator mainwindow = new RPGCreator(); mainwindow.setSize(1200, 800); mainwindow.setResizable(false); mainwindow.setLocationRelativeTo(null); mainwindow.setTitle("RPG Creator"); mainwindow.setVisible(true); ma…
has comment: http://stackoverflow.com/comment/31264363
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/20843947

http://stackoverflow.com/comment/31197084
has text: So what should I do in case of 1xx? Doesn't that indicate that the connection is "not yet complete" (hence more calls to getResponseCode will eventually return a new response-code)?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20807538
type: Comment

http://stackoverflow.com/q/20715143
type: Question
has title: To initialize or not initialize JPA relationship mappings?
possible better answer: http://stackoverflow.com/a/22076469
has body: In one to many JPA associations is it considered a best practice to initialize relationships to empty collections? For example. @Entity public class Order { @Id private Integer id; // should the line items be initialized with an empty array list or not? @OneToMany(mappedBy="order") List&lt;LineItem&gt; lineItems = new ArrayList&lt;&gt;(); } In the above example is it better to define lineItems with a default value of an empty ArrayList or not? What are the pros and cons?
tagged with: jpa
score: 35
tagged with: eclipselink
has answer: http://stackoverflow.com/a/20716407
accepted answer: http://stackoverflow.com/a/20716407
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/55425385
linked to: http://stackoverflow.com/q/18076492
tagged with: openjpa
type: AnsweredQuestion
upvote count: 35
has answer: http://stackoverflow.com/a/22076469
downvote count: 0
has answer: http://stackoverflow.com/a/53446575
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/31050573
type: Comment
comment on: http://stackoverflow.com/q/20725481
score: 0
has text: `Mac localMac = "HMAC-SHA256";` – you can’t assign a `String` to a variable of type `Mac`. Also `localMac.doFinal("{"_uid":"3396112","_csrftoken":"a23482932482sdsf4428","media_id":"616150302791211280_187036957"}");`? Can you post some real code?
type: QuestionComment

http://stackoverflow.com/comment/31066031
type: AnswerComment
score: 0
has text: Sorry sir, I could not get what you have meant here: detail.setParam("data"); //you should define this method in your detail fragment
type: Comment
comment on: http://stackoverflow.com/a/20733944

http://stackoverflow.com/comment/31199019
type: QuestionComment
score: 0
has text: Fixed it. The main problem with your code formatting appears to have been tabs - there should **never** be tabs in code, and the editing display and the output may use different tab stops, so the indentation may look different. Also, if you use a decent IDE (say NetBeans), it's actually rather difficult to write code without it having decent formatting.
comment on: http://stackoverflow.com/q/20807647
type: Comment

http://stackoverflow.com/q/20812479
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/31206528
tagged with: java
has title: My program cannot break out of 'While Loop' when calculating # of divisors for a certain integer?
downvote count: 3
type: Question
tagged with: for-loop
tagged with: if-statement
upvote count: 0
tagged with: integer-division
has body: When I run the program in eclipse, I cannot break out of the while loop after the user enters a certain integer to move on and actually calculate the number of divisors it has and print it out with counts. /* * This program reads a positive integer from the user. * It counts how many divisors that number has, and then it prints the result. * Also prints out a ' . ' for every 1000000 numbers it tests. */ import java.util.Scanner; public class forloopTEST1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N; //A positive integer entered by the user. // Divisor of this number will be counted. int testDivisor; // A number between 1 and N that is a possible divisor of N. int divisorCount; // A number of divisors between 1 to N that have been found. int numberTested; // Used to count how many possible divisors of N have been tested, When # reached 1000000 //a period is output and the value of numberTested is reset to 0. /* Get a positive integer from the user */ while (true) { System.out.println("Enter a positive integer: "); N = input.nextInt(); if (N &lt; 0) break; System.out.println("That number is not positive. Please try again.: "); } /* Count divisor, printing ' . ' after every 1000000 tests. */ divisorCount = 0; numberTested = 0; for (testDivisor = 1; testDivisor &lt;= N; testDivisor++) { if ( N % testDivisor == 0 ); divisorCount++; numberTested++; if (numberTested == 1000000) { System.out.println("."); numberTested = 0; } } } }
tagged with: while-loop
has answer: http://stackoverflow.com/a/20812490

http://stackoverflow.com/q/20712792
tagged with: bigdecimal
upvote count: 4
has answer: http://stackoverflow.com/a/20712875
accepted answer: http://stackoverflow.com/a/20712875
answer count: 3
downvote count: 0
score: 4
possible better answer: http://stackoverflow.com/a/20712853
favorite count: 0
has title: How to limit BigDecimal to a fixed fractions amount?
type: AnsweredQuestion
has body: I'm trying to create a BigDecimal class that has always a fixed maximum fractions count. But when printing that number, it is not cut to the fractions I defined in scale. Why? class MyDecimal extends BigDecimal { public MyDecimal(double val) { super(val); setScale(4, RoundingMode.HALF_UP); } } Sysout(new MyDecimal(0.0001)); //0.000100000000000000008180305391403130954586231382563710212707519531254
has answer: http://stackoverflow.com/a/20712901
has answer: http://stackoverflow.com/a/20712853
type: Question
tagged with: math
tagged with: java

jar
tags question: http://stackoverflow.com/q/20743340
tags question: http://stackoverflow.com/q/20800206
tags question: http://stackoverflow.com/q/20778497
tags question: http://stackoverflow.com/q/20819004
tags question: http://stackoverflow.com/q/20838723
tags question: http://stackoverflow.com/q/20739732
tags question: http://stackoverflow.com/q/20818014
tags question: http://stackoverflow.com/q/20740882
tags question: http://stackoverflow.com/q/20739266
tags question: http://stackoverflow.com/q/20772783
tags question: http://stackoverflow.com/q/20841271
tags question: http://stackoverflow.com/q/20836047
tags question: http://stackoverflow.com/q/20819435
tags question: http://stackoverflow.com/q/20826702
tags question: http://stackoverflow.com/q/20759765
type: Tag
tags question: http://stackoverflow.com/q/20689224
tags question: http://stackoverflow.com/q/20846385
tags question: http://stackoverflow.com/q/20849419
tags question: http://stackoverflow.com/q/20765700
tags question: http://stackoverflow.com/q/20803436
tags question: http://stackoverflow.com/q/20735122
tags question: http://stackoverflow.com/q/20843741
tags question: http://stackoverflow.com/q/20723080
tags question: http://stackoverflow.com/q/20685286
tags question: http://stackoverflow.com/q/20770290
tags question: http://stackoverflow.com/q/20783808
tag name: jar
tags question: http://stackoverflow.com/q/20705580
tags question: http://stackoverflow.com/q/20806428
tags question: http://stackoverflow.com/q/20761890
tags question: http://stackoverflow.com/q/20768093
tags question: http://stackoverflow.com/q/20756276
tags question: http://stackoverflow.com/q/20838205
tags question: http://stackoverflow.com/q/20688608
tags question: http://stackoverflow.com/q/20705848
tags question: http://stackoverflow.com/q/20798011
tags question: http://stackoverflow.com/q/20848214
tags question: http://stackoverflow.com/q/20728621
tags question: http://stackoverflow.com/q/20707543
tags question: http://stackoverflow.com/q/20808490
tags question: http://stackoverflow.com/q/20802109
tags question: http://stackoverflow.com/q/20721563
tags question: http://stackoverflow.com/q/20750749
tags question: http://stackoverflow.com/q/20730497
tags question: http://stackoverflow.com/q/20763553
tags question: http://stackoverflow.com/q/20801874
tags question: http://stackoverflow.com/q/20762227
tags question: http://stackoverflow.com/q/20761413
tags question: http://stackoverflow.com/q/20744348
tags question: http://stackoverflow.com/q/20745462
tags question: http://stackoverflow.com/q/20749173
tags question: http://stackoverflow.com/q/20768779
tags question: http://stackoverflow.com/q/20848675
tags question: http://stackoverflow.com/q/20846756
tags question: http://stackoverflow.com/q/20814910
tags question: http://stackoverflow.com/q/20815475
tags question: http://stackoverflow.com/q/20756461
tags question: http://stackoverflow.com/q/20699519
tags question: http://stackoverflow.com/q/20723637
tags question: http://stackoverflow.com/q/20680546
tags question: http://stackoverflow.com/q/20690269

http://stackoverflow.com/comment/30980648
type: QuestionComment
has text: @PatriciaShanahan We're brainstorming to try to read the mind of an interviewer. For all we know, they may have been looking for him to ask about whether timing is needed, or not thought it through, or...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20686896

http://stackoverflow.com/q/20795488
has title: Getting Json Data in Soap webservice response
favorite count: 0
has comment: http://stackoverflow.com/comment/31179610
tagged with: android
has comment: http://stackoverflow.com/comment/31176021
tagged with: soap
has answer: http://stackoverflow.com/a/20803213
score: 2
upvote count: 2
tagged with: web-services
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/20803213
has comment: http://stackoverflow.com/comment/31175295
has body: I am using below code to get JSON in soap webservice response SoapSerializationEnvelope envelope = new new SoapSerializationEnvelope(SoapEnvelope.VER11); try { SOAP_ACTION = namespace + MethodName; //Adding values to request object request = new SoapObject(namespace, MethodName); //Adding Double value to request object PropertyInfo weightProp =new PropertyInfo(); //Adding String value to request object request.addProperty("myParam1", "" + myParam1); request.addProperty("myParam2", "" + myParam2); SetEnvelope(url); try { //SOAP calling webservice androidHttpTransport.call(SOAP_ACTION, envelope); //Got Webservice response SoapObject res = (SoapObject) envelope.getResponse(); return Integer.parseInt(res); } catch (Exception e) { return -1; //return 0; } } catch (Exception e) { return -1; //return 2; } In response My Json Data was ({"result":"123456" }) Then I checked my Json online, it was wrong then i converted my JSON data {"result":"123456" } But in both the cases I am getting Exception 12-27 13:49:58.905: I/Webservice(2196): unexpected type (position:TEXT [{"result":"" }]@1:16 in java.io.InputStreamReader@406d5c48)
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31175179

http://stackoverflow.com/a/20835758
has body: You can use Regular Expression to resolve it. You also don't need to replace the Bibliographic data:. I suppose that the .getText() gives you Bibliographic data:US6079404 (A) ― 2000-06-27 RegEx for that string with groups would be like: ^Bibliographic data:(.*)\s―\s(.*)$ Java Code String raw = driver.findElement(By.xpath("//*[@id='hedvalue']/h1")).getText(); Pattern pattern = Pattern.compile("^Bibliographic data:(.*)\\s―\\s(.*)$"); Matcher matcher = pattern.matcher(raw); if(matcher.find()){ System.out.println(matcher.group(1)); System.out.println(matcher.group(2)); }
answers question: http://stackoverflow.com/q/20835473
score: 0
type: Answer

http://stackoverflow.com/q/20704977
type: AnsweredQuestion
upvote count: 3
linked to: http://stackoverflow.com/q/13733299
tagged with: fragment
type: Question
score: 3
tagged with: android-fragments
accepted answer: http://stackoverflow.com/a/20705085
tagged with: java
possible better answer: http://stackoverflow.com/a/20705483
has answer: http://stackoverflow.com/a/20705483
has body: Cannot add to fragment transaction due to the following error, how would you go about this? add() in FragmentTransaction cannot be applied to: Expected Parameters: Actual Arguments: int R.id.mapWithOverlay android.support.v4.app.Fragment _mapFragment (com.google.android.gms.maps.MapFragment) String "map" Code is as follows: android.support.v4.app.FragmentTransaction fragTx = getSupportFragmentManager().beginTransaction(); if (fragTx != null) { _mapFragment = MapFragment.newInstance(mapOptions); fragTx.add(R.id.mapWithOverlay, _mapFragment, "map"); fragTx.commit(); } else { Toast.makeText(this, "Could not display the map", Toast.LENGTH_SHORT).show(); } Thanks in advance.
answer count: 2
has title: add() in FragmentTransaction cannot be applied?
has comment: http://stackoverflow.com/comment/31012140
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/20705085

http://stackoverflow.com/q/20713289
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31027906
tagged with: java
has answer: http://stackoverflow.com/a/20713384
has title: How do i implement a check on the password to see if there is a number?
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20713353
has answer: http://stackoverflow.com/a/20713343
has body: How do i implement a check on the password to see if there is a number? I have a check in place for the length but the password also requires a number, how do I accomplish this? I know that it has something to do with the char class and a loop but everything I have tried has led me into a wall. Any advice would help. import javax.swing.JOptionPane; public class Pasword { public static void main(String[] args) { String password1 = JOptionPane.showInputDialog(null, "Please Enter A Password That Contains 6 - 10 Characters One Of Which Is A Number"); int len = password1.length(); while((len &lt; 6) || (len &gt; 10)) { password1 = JOptionPane.showInputDialog(null, "! INVALID !Please Enter A Password That Contains 6 - 10 Characters One Of Which Is A Number"); len = password1.length(); } String password2 = JOptionPane.showInputDialog(null, "!PASSWORD VALIDATOR! Please Re-Enter Password"); int len2 = password2.length(); while((len2 &lt; 6) || (len2 &gt; 10)) { password2 = JOptionPane.showInputDialog(null, "! INVALID !Please Re-Enter"); len2 = password2.length(); } if(password1.equals(password2)) { JOptionPane.showMessageDialog(null, "Accepted"); } else { JOptionPane.showInputDialog(null, "Passwords do not match, Pleas Re-enter"); } } } I am new to java and have learned a lot about it, Im just having an issue implementing the knowledge. Thank You

http://stackoverflow.com/comment/31166239
score: 0
has text: Well, if you want some method do something, you first have to create it, don't you?
type: Comment
comment on: http://stackoverflow.com/a/20790251
type: AnswerComment

http://stackoverflow.com/comment/31260904
type: AnswerComment
has text: Could not find or load main class GUI
comment on: http://stackoverflow.com/a/20842059
type: Comment
score: 0

http://stackoverflow.com/q/20703944
has answer: http://stackoverflow.com/a/20713929
has body: I'm trying to implement a middle-ware for group communication in a distributed system using Java RMI. In there, I need to send an object to the server and modify it. So that changes should be reflected in the client-side. For example, I will give the most common tutorial in the Oracle web site: X.java public class X implements Serializable, Remote{ public int x; // defined as public, just be simple. } Hello.java import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { String sayHello(X c) throws RemoteException; } Server.java import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.server.UnicastRemoteObject; public class Server implements Hello { public Server() { } public String sayHello(X c) { c.x = 10; return "Hello, world!"; } public static void main(String args[]) { try { Server obj = new Server(); Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0); LocateRegistry.createRegistry(1099); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.getRegistry(); registry.bind("Hello", stub); System.err.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } } Client.java import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class Client { public int x = 4; private Client() { } public static void main(String[] args) { String host = (args.length &lt; 1) ? null : args[0]; try { Registry registry = LocateRegistry.getRegistry(host); Hello stub = (Hello) registry.lookup("Hello"); X x = new X(); String response = stub.sayHello(x); System.out.println("response: " + x.x); } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } } } My problem is, even if I update the value for x in object c on the server-side, it is not reflected to the client-side. I simply could use the return to get the updated value, but I'm pla…
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20713929
favorite count: 0
possible better answer: http://stackoverflow.com/a/20713340
tagged with: remote-access
has answer: http://stackoverflow.com/a/20713340
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: rmi
tagged with: java
has title: Java RMI:Updating client side objects in the server

http://stackoverflow.com/q/20799398
tagged with: android-layout
tagged with: java
tagged with: android-linearlayout
has body: I have made a form for LinearLayout. It is of the following. &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;EditText android:id="@+id/Edit1" android:layout_width="wrap_content" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:hint="Num1" /&gt; &lt;EditText android:id="@+id/Edit2" android:layout_width="wrap_content" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:hint="Num2" /&gt; &lt;Button android:id="@+id/BtnAdd" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Plus" /&gt; &lt;Button android:id="@+id/BtnSub" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Minus" /&gt; &lt;Button android:id="@+id/BtnMul" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Multiple" /&gt; &lt;Button android:id="@+id/BtnDiv" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Divide" /&gt; &lt;Button android:id="@+id/BtnSin" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Sin" /&gt; &lt;Button android:id="@+id/BtnCos" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Cos" /&gt; &lt;Button android:id="@+id/BtnTan" android:layout_width="match_parent" android:layout_height="32sp" android:layout_margin="0dp" android:textSize="16sp" android:text="Tan" /&gt; &lt;Button android:id="@+id/BtnSqrt" android:layout_width="match_parent" android:layout_heig…
answer count: 2
possible better answer: http://stackoverflow.com/a/20799485
has answer: http://stackoverflow.com/a/20799485
accepted answer: http://stackoverflow.com/a/20799517
has title: Change to TableLayout for code in LinearLayout
score: 0
tagged with: android
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/20799517

http://stackoverflow.com/comment/31070315
score: 0
comment on: http://stackoverflow.com/a/20736349
type: AnswerComment
type: Comment
has text: Maybe. But the text of the question suggested a broader usage.

http://stackoverflow.com/q/20742078
tagged with: supportmapfragment
tagged with: android
has body: I used a handler to get a GoogleMap from a support map fragment. I am literally lost and have been trying to fix it for days. The map loads fine but I am suspecting it is returning a null value. I know there may be some bad practices but that's not my problem. I tried it with an AsyncTask and Handler. I tested it on various mobile devices and did not use emulator. Here is my code where I removes some other imports, but they are there (It's obviously not the whole program): import com.codexmalta.mytravelbuddy.R; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import android.support.v4.app.FragmentActivity; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class Itinerary extends FragmentActivity implements View.OnClickListener { //Google Map GoogleMap map; byte choice; protected ProgressDialog dialog; CameraPosition cameraPosition; Timer timer = new Timer(); LinearLayout[] l = new LinearLayout[10]; TextView[] time = new TextView[10]; TextView[] desc = new TextView[10]; TextView[] loc = new TextView[10]; double[] lat = new double[10]; double[] lng = new double[10]; MarkerOptions[] marker = new MarkerOptions[10]; //Get Itinerary GetItinerary gi = new GetItinerary(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starting_point); choice = getIntent().getByteExtra("choice", choice); //Methods getMapFragment(); getLayouts(); getFields(); gi.main(choice); fillFields(); removeExtraLayouts(gi.giveNumDay1(),gi.giveNumDay2()); getMap(); displayMarkers(); animateCamera(); } SupportMapFragment fm = new SupportMapFragment(); @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().i…
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31083012
type: Question
has comment: http://stackoverflow.com/comment/31082303
has title: getMap() method possibly returning null?
tagged with: null
linked to: http://stackoverflow.com/q/20728069
has comment: http://stackoverflow.com/comment/31082037
has answer: http://stackoverflow.com/a/20742226
accepted answer: http://stackoverflow.com/a/20742226
upvote count: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31080323
favorite count: 0

eclipse-rcp
tags question: http://stackoverflow.com/q/20839754
tags question: http://stackoverflow.com/q/20789179
tags question: http://stackoverflow.com/q/20788303
tags question: http://stackoverflow.com/q/20743524
tags question: http://stackoverflow.com/q/20691673
type: Tag
tags question: http://stackoverflow.com/q/20703801
tags question: http://stackoverflow.com/q/20836400
tags question: http://stackoverflow.com/q/20689979
tags question: http://stackoverflow.com/q/20742107
tags question: http://stackoverflow.com/q/20824464
tags question: http://stackoverflow.com/q/20840918
tags question: http://stackoverflow.com/q/20782409
tags question: http://stackoverflow.com/q/20685476
tag name: eclipse-rcp

http://stackoverflow.com/q/20722120
tagged with: java
score: 15
tagged with: printstream
possible better answer: http://stackoverflow.com/a/20722217
has answer: http://stackoverflow.com/a/20722217
has title: System.out.println vs PrintWriter
has comment: http://stackoverflow.com/comment/31043789
downvote count: 1
upvote count: 16
has answer: http://stackoverflow.com/a/63097780
has comment: http://stackoverflow.com/comment/94179538
favorite count: 0
accepted answer: http://stackoverflow.com/a/20722223
tagged with: io
has comment: http://stackoverflow.com/comment/31043709
answer count: 4
has answer: http://stackoverflow.com/a/20722223
type: AnsweredQuestion
has body: Is there a difference in using these two? When would you use one over the other? System.out.println(result); versus PrintWriter out = new PrintWriter(System.out); out.println(result); out.flush();
tagged with: printwriter
has answer: http://stackoverflow.com/a/20722246
type: Question

http://stackoverflow.com/a/20776910
has comment: http://stackoverflow.com/comment/31142468
downvote count: 0
answers question: http://stackoverflow.com/q/20776885
has comment: http://stackoverflow.com/comment/31142334
has comment: http://stackoverflow.com/comment/31142482
type: Answer
has body: You could use an InputVerifier or adjust the spinner model to provide min/max values. See How to use Spinners
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31157544

http://stackoverflow.com/q/20796001
accepted answer: http://stackoverflow.com/a/20806084
tagged with: drag-and-drop
has body: how can I create a SWT widget, in my case a StyledText, that can recieve Drop events even while being disabled. textPane = new StyledText(parent, SWT.V_SCROLL | SWT.MULTI | SWT.WRAP); textPane.setEnabled(false); DropTarget target = new DropTarget(textPane, DND.DROP_DEFAULT | DND.DROP_MOVE); target.setTransfer(new Transfer[] {TextTransfer.getInstance(),FileTransfer.getInstance()}); target.addDropListener(new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { System.out.println(event); } }); Now the created textPane will not be able to recieve drop events. If I remove the textPane.setEnabled(false) it works again. How can I get this to work always? Thank you very much^^
has title: Receive drops on an disabled SWT widget
has answer: http://stackoverflow.com/a/20806084
type: AnsweredQuestion
tagged with: swt
type: Question
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/comment/31022926
score: 1
has text: @EvertonAgner <<never trust math...>>
type: QuestionComment
comment on: http://stackoverflow.com/q/20710742
type: Comment

http://stackoverflow.com/a/20782111
score: 0
has comment: http://stackoverflow.com/comment/31151219
has comment: http://stackoverflow.com/comment/31151745
answers question: http://stackoverflow.com/q/20782009
type: Answer
has body: Why dont you try like In your search class , create an object EX: Connection objConn= new Connetion; String myInputCopy=objConn.movedata(); You can use this in your search class. Hope it helps!

http://stackoverflow.com/a/20783917
has body: Try using Controller.this to refer to the outer/top level instance of the class public Controller() { Runnable guiCreator = new Runnable() { public void run() { login= new Login(Controller.this); } }; SwingUtilities.invokeLater(guiCreator); }
downvote count: 0
has comment: http://stackoverflow.com/comment/31165721
score: 3
has comment: http://stackoverflow.com/comment/31154260
has comment: http://stackoverflow.com/comment/31154150
has comment: http://stackoverflow.com/comment/31154238
answers question: http://stackoverflow.com/q/20783892
upvote count: 3
has comment: http://stackoverflow.com/comment/31154138
type: Answer

http://stackoverflow.com/q/20794375
has answer: http://stackoverflow.com/a/20794951
has title: Usage of a Abstract class and instantiation
tagged with: java
has body: This is my question What is the use of a Abstract class even though we cant instantiate a abstract class? is there a indirect way of creating instances of an Abstract class?
downvote count: 3
upvote count: 1
type: Question
score: -2
answer count: 3
has answer: http://stackoverflow.com/a/20794453
favorite count: 0
has answer: http://stackoverflow.com/a/20794430
type: UnansweredQuestion

http://stackoverflow.com/a/20781328
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20780980
has body: Create an onClickListener on the view that represents the base of the tower. In the click handler, create the new Cube view programmatically. If your cubes are in a LinearLayout then (assuming you have a variable called linearLayout that represents the LinearLayout) you can call linearLayout.addView(cubeView, 0). That will add it to the top.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20780980
upvote count: 1

http://stackoverflow.com/comment/31251206
type: AnswerComment
type: Comment
has text: thanks it's work but can i do this in other way like playing in the JPanel just looking for more information
comment on: http://stackoverflow.com/a/20836456
score: 0

http://stackoverflow.com/q/20724441
linked to: http://stackoverflow.com/q/15264373
tagged with: swing
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31048248
tagged with: java
has body: I programmed a code for a cube which can be turned on all pivots. Now I tried to put in a loop with Thread.sleep but each time it repaints it just gives me the half cube or nothing (it's kinda flickering and faltering). Maybe it doesn't work because my laptop is too slow but I don't think that this is the case. Here's the code: import java.awt.*; import javax.swing.*; public class Würfel1 extends JApplet { Container container; Dimension Screen = new Dimension(400,400); double c[] = new double[8]; double wx = 90; double wy = 90; double wz = 90; public Würfel1() { init(); } public void init() { this.setSize(Screen); container = this.getContentPane(); } public void paint(Graphics g) { super.paint(g); drawcube(g); wx = wx - 2; wy = wy + 1; wz = wz + 3; try {Thread.sleep(100);} catch (InterruptedException e) {e.printStackTrace();} repaint(); } private void drawcube(Graphics g) { /* * Punkt links oben vorne */ int xStart = 100; int yStart = 100; /* * Breite, Höhe und Länge des Körpers */ int b = 200; int h = 200; int l = 200; /* * Winkel der X-, Y- und Z-Achse des Körpers */ // int wx = 90; // int wy = 90; // int wz = 90; /* * Mittelpunkt des Körpers */ int x = xStart + b/2; int y = yStart + h/2; /* * erzeugt die Grundwerte für den Winkel 90,90,90 */ double xfield[] = {(-b/2),(b/2),(b/2),(-b/2),(-b/2),(b/2),(b/2),(-b/2)}; double yfield[] = {(-h/2),(-h/2),(h/2),(h/2),(-h/2),(-h/2),(h/2),(h/2)}; double zfield[] = {(l/2),(l/2),(l/2),(l/2),(-l/2),(-l/2),(-l/2),(-l/2)}; /* * verändert die Werte unter Berücksichtigung der Winkel */ for (int i = 0; i &lt; 8; i++) { double newx,newy,newz; newy = yfield[i] * Math.cos(Math.PI*(90-wx)/180) - zfield[i] * Math.sin(Math.PI*(90-wx)/180); newz = yfield[i] * Math.sin(Math.PI*(90-wx)/180) + zfield[i] * Math.cos(Math.PI*(90-wx)/180); yfield[i] = newy; zfield[i] = newz; newx = xfield[i] * Math.cos(Math.PI*(90-wy)/180) - zfield[i] * Math.sin(Math.PI*(90-wy)/180); newz = xfield[i] * Math.sin(Math.PI*(90-wy)/180) + zfield[i] * Math.cos(Math.PI*…
has comment: http://stackoverflow.com/comment/31048264
linked to: http://stackoverflow.com/q/4215968
has answer: http://stackoverflow.com/a/20724569
upvote count: 0
linked to: http://stackoverflow.com/q/14106953
answer count: 1
linked to: http://stackoverflow.com/q/13486803
duplicate of: http://stackoverflow.com/q/4215968
has comment: http://stackoverflow.com/comment/31048499
favorite count: 0
has comment: http://stackoverflow.com/comment/31048354
score: -1
accepted answer: http://stackoverflow.com/a/20724569
has comment: http://stackoverflow.com/comment/31048607
linked to: http://stackoverflow.com/q/16292498
has comment: http://stackoverflow.com/comment/31048419
tagged with: multithreading
has title: Thread.sleep(x) doesnt do what it has to do

http://stackoverflow.com/comment/31221905
type: QuestionComment
has text: You can't "remove" array elements. Do you mean "compact" the array so there's no nulls but the order of non-null references remains the same?
comment on: http://stackoverflow.com/q/20820883
score: 0
type: Comment

http://stackoverflow.com/comment/31145393
has text: @user2310289 Probably. But if a problem is worth solving, it's worth *solving*.
comment on: http://stackoverflow.com/q/20778486
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31010247
type: QuestionComment
comment on: http://stackoverflow.com/q/20704023
has text: _my controller should pass this information to my view_ yes it should, that's the purpose of MVC. Your view should know only about Controller, it should co-ordinate with models and others.
score: 0
type: Comment

http://stackoverflow.com/a/20839749
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31256549
answers question: http://stackoverflow.com/q/20839667
has body: Your class is called Verify but your so-called constructor is called Verify_Contact. I could see that causing a problem. Also, your class is already a JFrame. No need to create another JFrame. just add the progress bar to the class JFrame So in your run() just do this add(bar); pack(); // setSize(300, 300); &lt;--- why pack AND setSize? setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setVisible(true); And in your constructor public Verify(long ID,String path) { Local_cid=ID; local_path=path; // frame=new JFrame("Processing Contact"); &lt;-- leave this out setLayout(new FlowLayout()); } Also, I don't see these Local_cid, local_path as fields in the class, yet you're trying to access them in your constructor. Maybe you just left it out of your code, who knows. Also , post an SSCCE for better help.
has comment: http://stackoverflow.com/comment/31256588
downvote count: 0
has comment: http://stackoverflow.com/comment/31257099

http://stackoverflow.com/q/20795326
type: Question
tagged with: autocomplete
has body: I am doing with Google place Auto complete API call. I have looked out the reference from google developer side. From there i have done some code but i am not getting result so please help me for finding out my mistake... Thanks in advance. This my Manifest. &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.googleautocompleteapi" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&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.googleautocompleteapi.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; This is my java file public class MainActivity extends Activity implements OnItemClickListener{ private static final String LOG_TAG = "ExampleApp"; private static final String PLACES_API_BASE = "https://maps.googleapis.com/maps/api/place"; private static final String TYPE_AUTOCOMPLETE = "/autocomplete"; private static final String OUT_JSON = "/json"; private static final String API_KEY = "AIzaSyD1kYc0zUlKO6i4KfV-ecefi2II6cs4eFM"; static final HttpTransport HTTP_TRANSPORT = AndroidHttp.newCompatibleTransport(); static final JsonFactory JSON_FACTORY = new JacksonFactory(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AutoCompleteTextView autoCompView = (AutoCompleteTextV…
has title: Getting started with google Place Autocomplete API call
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20796310
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: google-places-api
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/20796310

http://stackoverflow.com/comment/30999976
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20697446
has text: @Nomanaliabbasi : I manually typed `happy` in notepad, saved as 'abc.txt' in UTF-8 encoding and tried the program. Gives the same non-printable character in the beginning. (BOM apparently)
score: 0

http://stackoverflow.com/comment/30991102
has text: What does "can't see" mean? Is there perhaps a variable scoping problem?
type: Comment
comment on: http://stackoverflow.com/a/20692350
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31260687
comment on: http://stackoverflow.com/q/20841581
has text: Is this actually an android question?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/20683922
has answer: http://stackoverflow.com/a/20684381
has body: There are three types of classes: Handler Service DAO A handler handles an incoming command an calls a services. The services does caching and calls other services or a DAO. Services and DAOs are singletons. Is there a way to create a custom warning if a DAO is used in one of the handlers?
type: Question
tagged with: compiler-construction
score: 0
tagged with: java
tagged with: warnings
tagged with: eclipse
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30974684
has title: How to create a custom Eclipse warning?
tagged with: types
linked to: http://stackoverflow.com/q/11764236

http://stackoverflow.com/comment/31055729
type: Comment
score: 1
has text: So nothing is printed at all? Not even the `start` println in your code?
comment on: http://stackoverflow.com/q/20728451
type: QuestionComment

http://stackoverflow.com/comment/31287142
type: Comment
has text: It wasn't supposed to be funny. People insist on shallow hierarchies of low-level UI widgets instead of building appropriate abstractions, and try to manage overpopulated panels with horribly complex layout managers like GridBagLayout instead of thinking of a proper structure. The API for Swing classes that were actually meant as building blocks is so large and complex that few dare to write their own JComponent subclasses, even if it's actually quite easy.
type: AnswerComment
comment on: http://stackoverflow.com/a/20827505
score: 0

http://stackoverflow.com/a/20711484
has comment: http://stackoverflow.com/comment/31024251
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31024286
accepted answer of: http://stackoverflow.com/q/20711454
has body: Java doesn't have the Property syntax that c# does. you have to use a setter. controller.getDal().getStudentData().setPerson( new Person(/*blah blah blah*/) ); if you control whatever type getStudentData returns, than you might have to make one. public void setPerson(Person newPerson) { this.person = newPerson; }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31024226
answers question: http://stackoverflow.com/q/20711454
type: Answer

http://stackoverflow.com/comment/31273718
type: Comment
type: QuestionComment
has text: @PM77-1 I think now I put in a better way.
score: 0
comment on: http://stackoverflow.com/q/20847138

http://stackoverflow.com/comment/31023860
type: Comment
type: QuestionComment
score: 0
has text: @HotLicks: That is merely the implementation. The program specified by the source code recurses infinitely. The fact that we cannot execute this program is irrelevant. We are limited, mathematics is not. In this case, the meaning of “infinite” is that, no matter how many resources we provide for the execution of the program, it will continue recursing.
comment on: http://stackoverflow.com/q/20710946

http://stackoverflow.com/a/20871058
has body: Looking at the autoconfig report that came out of the crash I can see that there is no DataSource defined. Spring Boot will create one for you if you have the right stuff on your classpath - eg at a minimum to get something working include h2 or hsqldb on your classpath. Incidentally, the XML file is redundant if you use Spring Boot the right way.
downvote count: 0
has comment: http://stackoverflow.com/comment/33660676
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/20808290
score: 3

http://stackoverflow.com/comment/31146018
has text: Tracy, thanks for your response. I think it makes sense, any idea how i can correct this, basically i need to adjust the current time to previous hour on the hour boundary..
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20778861

http://stackoverflow.com/a/20736841
has body: Guice has two features to deal with this situation. The first is module de-duplication. This means that if two modules are installed that are equivalent (by equals() and hashCode()), only one's configure() method will run. However, this solution is somewhat brittle because it won't survive SPI transformations, Modules.override(), etc. The second, and IMO better solution, is binding de-duplication. This means that Guice will accept bindings that are exact duplicates. So if your module does bind(Interface.class).to(Implementation.class), it doesn't even matter if its configure() method runs twice, because Guice will handle the duplicate binding just fine.
answers question: http://stackoverflow.com/q/20735211
has comment: http://stackoverflow.com/comment/31108091
score: 16
has comment: http://stackoverflow.com/comment/31076550
has comment: http://stackoverflow.com/comment/31102906
has comment: http://stackoverflow.com/comment/31119127
accepted answer of: http://stackoverflow.com/q/20735211
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31107783
type: Answer
upvote count: 16

http://stackoverflow.com/a/20766264
has comment: http://stackoverflow.com/comment/31123948
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20756357
answers question: http://stackoverflow.com/q/20756357
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31124923
has body: Evidently wrong is always >= 6. One possibility is that level is longer than 1 character and thus the contains check is always false. That's if it's always 'wrong' even with a 'right' guess. The more likely possibility is that because the check where you increment wrong is inside the loop, any time wordList[level] is 6 or more characters in length and does not contain letter, wrong will be incremented 6 or more times. You probably should put the check outside the loop. for(int i = 0; i&lt;wordList[level].length(); i++){ if(wordList[level].charAt(i) == userEnteredChar){ jlabelText[3 * i] = ' '; jlabelText[3 * i + 1] = userEnteredChar; jlLines.setText(String.valueOf(jlabelText)); } } if(!wordList[level].contains(letter)){ wrong++; } if(wrong&gt;=6){ System.out.println("dead"); } By the way, an obvious suggestion here is that if you are checking contains, you might as well check it first and skip the 'revealing' loop somehow if contains is false. It looks like wrong should probably be a field somewhere. Shown here I've declared it as a field on the ActionListener. Don't put it on the ActionListener, put it somewhere else, preferably on the containing class. I don't see where else to put it though and this may work initially. The point is to keep track of 'wrong' guesses outside the single guess in actionPerformed. That means you have to declare it somewhere outside the method scope. tf.addActionListener(new ActionListener() { int wrong; @Override public void actionPerformed(ActionEvent e) { JTextField tf = (JTextField)e.getSource(); char userEntry = tf.getText().charAt(0); jlLetsUsed.setText(jlLetsUsed.getText() + userEntry + " "); int level = 2; if (!wordList[level].contains(String.valueOf(userEntry))) { wrong++; if (wrong &gt;= 6) { System.out.println("dead"); } return; } char[] jlabelText = jlLines.getText().toCharArray(); for (int i = 0; i &lt; wordList[level].length(); i++) { if (wordList[level].charAt(i) == userEntry) { jlabelText[3 * i] = ' '; jlabelText[3 * i +…
type: Answer
has comment: http://stackoverflow.com/comment/31124214
has comment: http://stackoverflow.com/comment/31124427
has comment: http://stackoverflow.com/comment/31123880
has comment: http://stackoverflow.com/comment/31124582
has comment: http://stackoverflow.com/comment/31124096
score: 1

http://stackoverflow.com/comment/31173428
has text: It is valid Java, so it will compile, but it's not good Java.
comment on: http://stackoverflow.com/q/20794320
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31132022
score: 0
comment on: http://stackoverflow.com/q/20771026
type: Comment
type: QuestionComment
has text: 'list' is ArrayList of type Integer objects.

http://stackoverflow.com/comment/31076822
score: 0
type: Comment
has text: If i just do it this way to have only one CarkMasker instance. Is it fine? Or should i synchronize my getInstance() method as well? public static CardMasker getInstance() { if (null == instance) { instance = new CardMasker(); } return instance; }
comment on: http://stackoverflow.com/a/20738938
type: AnswerComment

http://stackoverflow.com/q/20775200
tagged with: android
tagged with: adb
has body: I found this question, which asks the same thing, but the answer to that seems to work on for the emulator, while I need it to work on the device. The only command I've run has been adb forward tcp:port tcp:port, which seems to only allow unidirectional communication, in the direction of host->remote. I need remote->host. How can I accomplish this?
answer count: 0
score: 0
tagged with: tcp
tagged with: java
type: Question
tagged with: portforwarding
has title: "adb forward" a port from remote to host
has comment: http://stackoverflow.com/comment/33266505
has comment: http://stackoverflow.com/comment/33266411
type: UnansweredQuestion

http://stackoverflow.com/a/20799220
type: Answer
has body: JButton has a model which answers these question: isArmed(), isPressed(), isRollOVer() etc. Hence you can ask the model for the answer you are seeking: if(jButton1.getModel().isPressed()) System.out.println("the button is pressed");
has comment: http://stackoverflow.com/comment/31202947
has comment: http://stackoverflow.com/comment/31181985
upvote count: 18
has comment: http://stackoverflow.com/comment/31206987
has comment: http://stackoverflow.com/comment/31182109
downvote count: 0
score: 18
answers question: http://stackoverflow.com/q/20799131

http://stackoverflow.com/a/21344726
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/20730790
has body: The answer by PearsonArtPhoto is correct. To add more… Joda-Time With Joda-Time, no need for format pattern, and no need for Calendar class. You are working too hard. The DateTime class takes an ISO 8601 string directly in its constructor. Call the getMinuteOfHour method on a DateTime to extract just that portion. If you want UTC/GMT rather than a specific time zone, pass the built-in constant, DateTimeZone.UTC. Be aware that time zone could affect your minute-of-hour. Not all time zones adjust by full hours. India for example has an offset of five and a half hours ahead of UTC/GMT (+05:30). String input = "2013-12-18T23:41:54.959Z"; DateTimeZone timeZone = DateTimeZone.forID( "Europe/Berlin" ); // Or, DateTimeZone.UTC; DateTime dateTime = new DateTime( input, timeZone ); int minuteOfHour = dateTime.getMinuteOfHour(); Dump to console… System.out.println( "dateTime: " + dateTime ); System.out.println( "minuteOfHour: " + minuteOfHour ); When run… dateTime: 2013-12-19T00:41:54.959+01:00 minuteOfHour: 41 java.time Joda-Time has been officially replaced by the java.time framework built into Java 8 and later. While Joda-Time continues to be updated, future work will go into the java.time classes and their extension, ThreeTen-Extra project. Much of java.time has been back-ported to Java 6 &amp; 7 in the ThreeTen-Backport project. That work is adapted to Android in the ThreeTenABP project. The discussion above applies to a java.time solution. An Instant is a moment on the timeline in UTC. Apply a time zone ZoneId to get a ZonedDateTime. String input = "2013-12-18T23:41:54.959Z"; Instant instant = Instant.parse( input ); ZoneId zoneId = ZoneId.of( "Europe/Berlin" ); // Or, ZoneOffset.UTC; ZonedDateTime zdt = ZonedDateTime.ofInstant( instant, zoneId ); int minuteOfHour = zdt.getMinute(); // Gets the minute-of-hour field.
type: Answer
score: 4

http://stackoverflow.com/a/20798513
type: Answer
has body: for (int i = 3; i * i &lt; num; i += 2) if (num % i == 0) return false; i * i is 9, and 9 in not less than 9, thus for loop is not run.
answers question: http://stackoverflow.com/q/20798391
score: 0

http://stackoverflow.com/q/20831359
tagged with: android
tagged with: android-adapter
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20831499
has comment: http://stackoverflow.com/comment/31259087
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31241772
downvote count: 0
has comment: http://stackoverflow.com/comment/31241727
tagged with: android-listview
upvote count: 1
has answer: http://stackoverflow.com/a/20841232
accepted answer: http://stackoverflow.com/a/20841232
possible better answer: http://stackoverflow.com/a/20831499
has title: Array adapter with custom subclass objects
has body: The solution is in the bottom: I made some classes that i want to use in a listview. They look like this: public class Equipment{ ....code.... } and public class Weapon extends Equipment{ ...More code... } and public class Armor extends Equipment{ ...More code... } As you can see weapon and armor extends equipment. Now i want to use theese classes in the same ArrayAdapter. In my imagination it would be simple as this: public class ShopItemAdapter extends ArrayAdapter&lt;Equipment&gt;{ private List&lt;Equipment&gt; itemList; public ShopItemAdapter(Context context, List&lt;Equipment&gt; itemList) { super(context, android.R.layout.simple_list_item_1, itemList); this.itemList = itemList; this.context = context; } .... CODE .... } But for some reason I may not create an ArrayAdapter Equipment with List Weapon or List Armor. ShopItemAdapter adapter = new ShopItemAdapter(getApplicationContext(), weaponList); This codes gives me the error that ShopItemAdapter(Context, List) is undefined Am I using subclasses in the wrong way or what? My goal is to show a list of armors when clicking on a button and viseversa. Hope my problem is clear. Thanks! SOLUTION ** So i just needed to change the constructor to receive then cast to List in the super constructor. public class ShopItemAdapter extends ArrayAdapter&lt;Equipment&gt;{ private List&lt;Equipment&gt; itemList; public ShopItemAdapter(Context context, List&lt;? extends Equipment&gt; itemList) { super(context, android.R.layout.simple_list_item_1, (List&lt;Equipment&gt;)itemList); this.itemList = (List&lt;Equipment&gt;)itemList; this.context = context; } .... CODE .... }
favorite count: 0

http://stackoverflow.com/comment/31174131
type: AnswerComment
has text: @user2852629 Write up jsp that shows an error message. `forward()` to that jsp when you've decided that the service is unavailable or when there's an internal server error, etc.
type: Comment
comment on: http://stackoverflow.com/a/20794791
score: 0

http://stackoverflow.com/a/20817624
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20817585
upvote count: 2
downvote count: 0
has body: Because otherwise your classes will get access to default (no modifiers) / protected members of standard JDK classes which are not meant to expose its internal details to the developer. Prohibiting custom classes in java.* packages forbids you from exploiting such thing.

http://stackoverflow.com/comment/30993453
comment on: http://stackoverflow.com/q/20694122
type: QuestionComment
type: Comment
has text: Maybe use `else if (choice == 2) {`...
score: 1

http://stackoverflow.com/comment/31070137
type: QuestionComment
has text: Actually it does answer my question, I sometimes have trouble parsing the language of java generics parameterization in the wild. Knowing that it is a raw type helps me think of it in terms of ArrayList vs ArrayList<String>, etc.
score: 1
comment on: http://stackoverflow.com/q/20736221
type: Comment

http://stackoverflow.com/q/20767469
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20767504
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20767504
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20767511
tagged with: android-listview
tagged with: android
has body: My application take barcode id of product and give back markets with prices where have that product. In listview I have markets and prices. When i click listview elements i want to proceed with new activity where market details should print to textview or something.. However when i click element, emulator crashes like "unfortunately stopped" Here my java code, php code and log; (i took barcode from previous activity and sending market name to next activity to do necessary json, php, db queries) public class Query_product extends ListActivity { JSONArray products = null; JSONParser jParser = new JSONParser(); String pid; String market; // Progress Dialog private ProgressDialog pDialog; ArrayList&lt;HashMap&lt;String, String&gt;&gt; productsList; // Creating JSON Parser object JSONParser jsonParser = new JSONParser(); // url to get all products list private static final String url_market = "http://furkan.feramor.gen.tr/webservice/enucuz.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_PRODUCTS = "products"; private static final String TAG_PID = "barcode"; private static final String TAG_NAME = "name"; private static final String TAG_PRICE = "price"; private static final String TAG_DESCRIPTION = "description"; private static final String TAG_MARKET = "mname"; // products JSONArray JSONArray product = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.all_products); productsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); pid = getIntent().getExtras().getString(Constants.ID); new GetProductDetails().execute(); ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem // String mName = ((TextView) view.findViewById(R.id.marketName)).getText().toString(); // Starti…
tagged with: php
has title: Android ListView click to new Activity
accepted answer: http://stackoverflow.com/a/20767511

http://stackoverflow.com/comment/31208953
type: Comment
has text: @Anony-Mousse That's Correct..
type: QuestionComment
comment on: http://stackoverflow.com/q/20813606
score: 0

http://stackoverflow.com/q/20707657
has comment: http://stackoverflow.com/comment/31017132
has title: Confusion about collections, enumeration, and iterator in Java
has comment: http://stackoverflow.com/comment/31017210
type: Question
upvote count: 4
tagged with: iterator
has comment: http://stackoverflow.com/comment/31017143
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31017031
has answer: http://stackoverflow.com/a/20707783
score: 4
tagged with: enumeration
linked to: http://stackoverflow.com/q/948194
linked to: http://stackoverflow.com/q/20454726
has body: My textbook barely talks about enumeration in Java, and the videos that I've watched don't explain much. So from what I'm understanding, enumeration is like a whole different class where you can store constants in. Can someone expand to me about the constants and perhaps show me better examples? Like I understand what constants are after seeing the examples such as colors, directions, and in the previous videos it was people, while in the enum version of one my projects during the school year, it was command words. But I don't 100% understand the concept or how to use. Also, what's the point of an Enumeration when you can just make a collection? Like for instance, the last video i saw, the video maker made enums of people in the format of name(String description, int age), and that's how he defined his constructor and he had get and set methods. What's the advantage of doing this rather than just creating a person object in the same exact way and them creating a collection and storing person objects in there? I went to look up the above, and after seeing this thread: Difference between Java Enumeration and Iterator An iterator is something that will let me loop through a collection, and all this time I thought enumeration was something like a different class. But in the thread they're comparing them. Enumeration is just something like an iterator, but without the remove method. Is this enumeration something different than what I was talking about above?
favorite count: 0
has comment: http://stackoverflow.com/comment/31017054
has comment: http://stackoverflow.com/comment/31017733
has comment: http://stackoverflow.com/comment/31016988
has comment: http://stackoverflow.com/comment/31019495
accepted answer: http://stackoverflow.com/a/20707783
has comment: http://stackoverflow.com/comment/31017343
tagged with: collections
type: AnsweredQuestion
tagged with: enums
tagged with: java

http://stackoverflow.com/a/20754678
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31103241
has comment: http://stackoverflow.com/comment/31103233
type: Answer
accepted answer of: http://stackoverflow.com/q/20754628
has body: I'd write it a little neater: ClassX def; for (ClassX value : listabc) { if (value.Id.equals(currentId)) return value; if (value.Id.equals(defaultId)) def = value; } return def == null ? listabc.get(0) : def;
answers question: http://stackoverflow.com/q/20754628
has comment: http://stackoverflow.com/comment/31103287

http://stackoverflow.com/comment/31283285
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20844968
has text: This hierarchy does not seem to suffice the 'Is-a' rule. An **approved** something is no longer **pending**. It is probably rather a naming issue. I would create unrelated `Creation` and `Approval` classes with a 1-1 relationship to the entity.
score: 0

http://stackoverflow.com/a/20772054
answers question: http://stackoverflow.com/q/20771777
type: Answer
score: 0
has body: If you are using Eclipse than just press Ctrl + Shift + O Eclipse will automatically add the required libraries in your source code. If still you are getting import issue than you need to check if you are using correct API or the spelling is correct.

android-4.4-kitkat
tags question: http://stackoverflow.com/q/20760791
tag name: android-4.4-kitkat
type: Tag
tags question: http://stackoverflow.com/q/20731975

http://stackoverflow.com/comment/31371707
type: Comment
comment on: http://stackoverflow.com/a/20868277
has text: Thanks for this, its quite a big change and there is a lot of additional things that happends within my GameView class, therefore it will take me a while to implement it all.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31077242
comment on: http://stackoverflow.com/a/20740355
score: 0
type: AnswerComment
type: Comment
has text: Sorry about the earlier comment. Earlier, I had only just skimmed through your answer and commented in my eagerness. After studying your answer, it was, indeed, what I was looking for.

http://stackoverflow.com/a/20836113
type: AcceptedAnswer
has body: private void dimActivity(Dialog dialog, float dimAmount) { WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); lp.dimAmount = dimAmount; dialog.getWindow().setAttributes(lp); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); } dimAmount: 0 - no dimming, 1.0f full dimming. You can check this: How to dim a screen on click of a button in android?
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20835812
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/20835812

http://stackoverflow.com/q/20784872
downvote count: 2
has body: I'm using the code TwoDHashMap&lt;Integer, DateTime, KeyNamePair&gt; shiftDetails = new TwoDHashMap&lt;Integer, DateTime, KeyNamePair&gt;(); Please help to iterate over each pair of key!
type: Question
has comment: http://stackoverflow.com/comment/31155910
has comment: http://stackoverflow.com/comment/31155795
upvote count: 4
has comment: http://stackoverflow.com/comment/31155797
answer count: 1
has comment: http://stackoverflow.com/comment/31155725
has title: How can i iterate through a TwoDHashMap in java??
has comment: http://stackoverflow.com/comment/31155751
favorite count: 0
has comment: http://stackoverflow.com/comment/31155783
has answer: http://stackoverflow.com/a/20784931
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20784931
tagged with: java

http://stackoverflow.com/comment/31039074
type: Comment
comment on: http://stackoverflow.com/q/20719363
has text: No - just writing the recursive methods to draw the different types of snowflakes.
score: 0
type: QuestionComment

http://stackoverflow.com/a/35295616
has comment: http://stackoverflow.com/comment/65706884
has comment: http://stackoverflow.com/comment/59054810
score: 12
answers question: http://stackoverflow.com/q/20743859
downvote count: 0
has comment: http://stackoverflow.com/comment/59073681
has body: NEW ANSWER Use Glide library for this. This lib is also recommended by Google. See How to round an image with Glide library? OLD ANSWER Just add that image in a cardView and set cardView's elevation on 0dp...will do the trick (in my case was a viewPager with images - just replace the viewPager with an ImageView): &lt;android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="250dp" app:cardElevation="0dp"&gt; &lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/viewPager" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/android.support.v7.widget.CardView&gt;
type: Answer
has comment: http://stackoverflow.com/comment/75141680
upvote count: 12

http://stackoverflow.com/q/20799336
answer count: 3
has title: Get Url of endpoint using on a handler (JAX-WS)
has body: I am implementing many JAX-WS web services with a common Handler class to validate the correct structure of incoming SOAP messages. Is there some way to obtain the URL to which is directed the current message so i could get the schema from this url automatically and get the message validated?
has answer: http://stackoverflow.com/a/21240165
favorite count: 0
has comment: http://stackoverflow.com/comment/31182044
score: 6
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: jax-ws
possible better answer: http://stackoverflow.com/a/21240165
has answer: http://stackoverflow.com/a/20799829
accepted answer: http://stackoverflow.com/a/20799829
has answer: http://stackoverflow.com/a/51775465
type: Question
upvote count: 6
tagged with: java-metro-framework

http://stackoverflow.com/q/20756864
favorite count: 0
has title: specified DSN contains an architecture mismatch between the Driver and Application. JAVA
duplicate of: http://stackoverflow.com/q/20008501
tagged with: jdbc
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2810754
type: Question
score: 3
tagged with: java
duplicate of: http://stackoverflow.com/q/2810754
has answer: http://stackoverflow.com/a/20756903
tagged with: jdbc-odbc
linked to: http://stackoverflow.com/q/20008501
has body: I'm trying to connect to a database made by MS Access using Java, but I cannot seem to manage. I am using JDBC ODBC bridge and I'm getting this exception: java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
answer count: 1
downvote count: 0
tagged with: ms-access

http://stackoverflow.com/q/20827106
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20875812
tagged with: android-activity
tagged with: android
tagged with: streaming
possible better answer: http://stackoverflow.com/a/20827144
tagged with: android-intent
linked to: http://stackoverflow.com/q/20657031
has body: I'm developing an online streaming application. I am facing an issue in my application. When i am running my application and click on device lock hardware key , the application is closed. I want the application to get launched on the same activity i was before locking the device. I want my application to stay active even if the device is locked. Appreciate any solution.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20827144
type: Question
accepted answer: http://stackoverflow.com/a/20875812
has title: Android Online Streaming Application should not be closed on screen locking and Unlocking

http://stackoverflow.com/q/20801667
has answer: http://stackoverflow.com/a/20802612
score: 0
has answer: http://stackoverflow.com/a/20801712
has body: I have the following page xhtml where i have to get some values for populate a DB table. The problem are the selection menu that don't work. Actually, the values of the selections are chosen from the database and are displayed but the values aren't taken when i use the button: <h:head> Add a Default Package </h:head> <h:body> <h:form> <p:panel header="DefaultPackage Form"> <h:panelGrid columns="3" id="regGrid"> <h:outputLabel for="Name">Name:</h:outputLabel> <p:inputText id="Name" value="#{addDefaultPackageBean.defpackDTO.name}" /> <p:message for="Name" /> <h:outputLabel for="location">Location:</h:outputLabel> <p:inputText id="location" value="#{addDefaultPackageBean.defpackDTO.location}" /> <p:message for="location" /> <h:selectOneMenu value="#{addDefaultPackageBean.nameFlies}"> <f:selectItems value="#{addDefaultPackageBean.elelisfly}" var="ElementDTO" itemValue="#{ElementDTO.location}" itemLabel="#{ElementDTO.location}"/> </h:selectOneMenu> <h:selectOneMenu value="#{addDefaultPackageBean.nameHotels}"> <f:selectItems value="#{addDefaultPackageBean.elelishotel}" var="ElementDTO" itemValue="#{ElementDTO.location}" itemLabel="#{ElementDTO.location}"/> </h:selectOneMenu> </h:panelGrid> <p:commandButton value="Add" update="regGrid" action="#{addDefaultPackageBean.add()}" /> </p:panel> </h:form> </h:body> The image displayed is: The bean page: package beans; import java.util.ArrayList; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import elementManagement.ElementMgr; import elementManagementDTO.ElementDTO; import DefaultPackageManagement.DefaultPackageMgr; import DefaultPackageManagementDTO.DefaultPackageDTO; @ManagedBean(name="addDefaultPackageBean") //come viene richiamato @RequestScoped public class AddDefaultPackageBean { @EJB private DefaultPackageMgr defpackMgr; private DefaultPackageDTO defpackDTO; private ArrayList<ElementDTO> elelisfly; private ArrayList<ElementDTO> eleli…
tagged with: jsf
type: UnansweredQuestion
has title: Get values from Selectiomenu with PrimeFaces
type: Question
tagged with: java
answer count: 2
linked to: http://stackoverflow.com/q/767372

http://stackoverflow.com/a/20846478
type: Answer
has comment: http://stackoverflow.com/comment/31269517
has comment: http://stackoverflow.com/comment/31270226
accepted answer of: http://stackoverflow.com/q/20846437
score: 3
has comment: http://stackoverflow.com/comment/31269594
downvote count: 0
answers question: http://stackoverflow.com/q/20846437
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31270182
has body: is the JFrame before EXIT_ON_CLOSE necessary? Isn't it already specified with using frame.setDefault...? It's necessary cause JFrame.EXIT_ON_CLOSE is a constant (class level variable). that when you set, exit the application using the System exit method. you can ommited it, if you make a static import like this. Example with static import: import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; public class Test{ public static void main(String args[]) throws CloneNotSupportedException { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); } } One last question is are there any particular benefits to using JFrame instead of Frame? Pros &amp; Cons? JFrame is from swing, and Frame is more outdated from awt. Here you have more information Swing vs AWT
upvote count: 3
has comment: http://stackoverflow.com/comment/31269831
has comment: http://stackoverflow.com/comment/31269741

http://stackoverflow.com/q/20793089
linked to: http://stackoverflow.com/q/24855182
upvote count: 51
has answer: http://stackoverflow.com/a/31127546
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23851004
score: 51
answer count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23690196
has comment: http://stackoverflow.com/comment/64960216
tagged with: java
has title: Secure Nashorn JS Execution
has answer: http://stackoverflow.com/a/54010900
has answer: http://stackoverflow.com/a/48751893
type: Question
tagged with: nashorn
has answer: http://stackoverflow.com/a/20793107
has answer: http://stackoverflow.com/a/22268837
linked to: http://stackoverflow.com/q/24466203
has body: How can I securely execute some user supplied JS code using Java8 Nashorn? The script extends some computations for some servlet based reports. The app has many different (untrusted) users. The scripts should only be able to access a Java Object and those returned by the defined members. By default the scripts could instantiate any class using Class.forName() (using .getClass() of my supplied object). Is there any way to prohibit access to any java class not explicitly specified by me?
tagged with: javascript
has answer: http://stackoverflow.com/a/31870046
has comment: http://stackoverflow.com/comment/83502821
has answer: http://stackoverflow.com/a/33739314

http://stackoverflow.com/a/20824959
type: Answer
score: 3
upvote count: 3
has body: The first method (A a = null;) doesn't create an instance of the A class so the variable's value is null. The second method (A a = new A();) creates an instance of the A class at the same time as declaring the variable. Memory leaks are not caused just by instantiating variables as you need to instantiate variables anyway to use them. This is a more complicated topic.
downvote count: 0
answers question: http://stackoverflow.com/q/20824943

http://stackoverflow.com/comment/31024160
score: 0
type: AnswerComment
type: Comment
has text: Thanx for commenting.. I did it Mr.Muhammad. customized main clz for several frames in same projects.. and also I did like this.. I set the lookAndFeel to a jButton with setvisible(true) to the next frame.. The frame I set as main class hadn't any lookAndFeel. then the jar was worked.But didn't allow to click that button.. Until click on that button evry things in that frame is worked.when click on it once, no further function.
comment on: http://stackoverflow.com/a/20710201

http://stackoverflow.com/comment/31096432
type: Comment
score: 0
has text: oh, it's got one of them. :)
type: AnswerComment
comment on: http://stackoverflow.com/a/20750810

http://stackoverflow.com/a/20689507
downvote count: 0
answers question: http://stackoverflow.com/q/20686896
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/30990134
has body: It's not a "perfect" answer, but you can solve this using a few classes to hold the logical connection/evaluation and then recursively evaluate the circuit. Create a base class LogicalNode and give it a list of inputs to manage. Give it a base class function to evaluate all the inputs and return an output. This gets overridden in derived classes. Each type of node (INPUT, NOT, AND, OR) gets a derived class with a special "ComputOutput" overridden version. If you compute the output at the output node, it should recurse up the tree, computing all inputs of inputs of inputs, etc., till it reaches the "INPUT" nodes, which are fixed/logical inputs to the system. You can create new types fairly quickly (see code). Not a lot of comments here, but it should be somewhat self explanatory. Something like this (in C#): public class LogicalNode { private List&lt;LogicalNode&gt; _inputs = new List&lt;LogicalNode&gt;(); private String _name = "Not Set"; public override string ToString() { return String.Format("Node {0}", _name); } public void Reset() { _inputs.Clear(); } public void SetName(String name) { _name = name; } protected List&lt;LogicalNode&gt; GetInputs() { return _inputs; } public void AddInput(LogicalNode node) { _inputs.Add(node); } protected virtual bool ComputeOutputInternal() { return false; } public bool ComputeOutput() { // Console.WriteLine("Computing output on {0}.", _name); return ComputeOutputInternal(); } } public class LogicalInput : LogicalNode { private bool _state = true; public void SetState(bool state) { _state = state; } public bool GetState() { return _state; } protected override bool ComputeOutputInternal() { return _state; } } public class LogicalAND : LogicalNode { protected override bool ComputeOutputInternal() { List&lt;LogicalNode&gt; inputs = GetInputs(); bool result = true; for (Int32 idx = 0; idx &lt; inputs.Count &amp;&amp; result; idx++) { result = result &amp;&amp; inputs[idx].ComputeOutput(); } return result; } } public class LogicalOR …
accepted answer of: http://stackoverflow.com/q/20686896
has comment: http://stackoverflow.com/comment/30992014
type: AcceptedAnswer

http://stackoverflow.com/comment/31092787
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20748114
has text: hi NigelK, i did not suggest him for code slandered, i am just find out error and i know very well what is the coding guide line and coding slandered, thanks for negative marking ?

http://stackoverflow.com/a/20760454
type: Answer
has comment: http://stackoverflow.com/comment/31113426
score: 0
has body: It does only instantiate a C# proxy for your service - an automatically generated class by .NET with all the behind-the-scenes code to manage communication with your service. I would advice you to test your service with a tool like SoapUI before trying to integrate it with .NET and see if you have the same problem.
answers question: http://stackoverflow.com/q/20760359

http://stackoverflow.com/q/20791116
has answer: http://stackoverflow.com/a/20811159
type: Question
possible better answer: http://stackoverflow.com/a/20791364
has body: I'm getting back data (an image) from my database. It has a header which looks like this below and also a footer that says webkitboundry. ------WebKitFormBoundaryv7RHmVQhhWVAEycr Content-Disposition: form-data; name="file"; filename="hey.jpg" Content-Type: image/jpeg image IO in java does not recognize this as a valid image because of the header and footer. I am sending this to my database like so: xmlhttp.open("post","http://localhost:8080/restService/api/submitinfo",true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(formData); is there any way I can send this file without the header or how can I go about removing it? I know I might be able to strip it with some for loops but I'm curious that there might be another way. What do you professionals do with this?
has comment: http://stackoverflow.com/comment/31167596
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/20811159
tagged with: web-services
tagged with: http
has comment: http://stackoverflow.com/comment/31167427
tagged with: java
tagged with: jersey
type: AnsweredQuestion
tagged with: header
has answer: http://stackoverflow.com/a/20791364
has title: How to remove header from data with java

http://stackoverflow.com/comment/31982741
has text: I believe this thread is becoming unnecessarily acrimonious and counter-productive.
type: Comment
comment on: http://stackoverflow.com/a/21186552
score: 6
type: AnswerComment

http://stackoverflow.com/comment/31255115
type: Comment
type: QuestionComment
has text: Yes I have MySQL(connector/J driver) under Drivers. I am using netbeans
score: 0
comment on: http://stackoverflow.com/q/20838709

http://stackoverflow.com/a/20703451
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31021157
type: Answer
has body: If both classes are in the same file, put all these imports at the top op the file import javax.swing.JPanel; import java.awt.Font; import java.awt.Graphics;
score: 1
answers question: http://stackoverflow.com/q/20703415

http://stackoverflow.com/comment/31040903
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20720503
type: Comment
has text: @VladfromMoscow Why should he accept that a person answering the question knows the **intent** of the program better than the person asking the question? Most likely this is a homework assignment, and any homeworks I ever had like this all said something along the lines of "When the user enters 0, the program should quit".

http://stackoverflow.com/comment/31050994
score: 0
has text: Can you show us what you've tried and why it doesn't work, and not just pseudocode
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20725779

http://stackoverflow.com/comment/31344746
has text: It's untrue that an "iBeacon" cannot send data. Simply changing a few bits of the major/minor numbers allows you to communicate a small amount of information - for example, make any even number mean "no" and any odd number mean "yes". There's also nothing that keeps you from having additional services beyond the manufacturer unique data field which makes it an "iBeacon".
comment on: http://stackoverflow.com/q/20799917
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/20733078
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20732941
score: 2
upvote count: 2
has body: In the equals method you are comparing only titles, not the student name. So if you have two examinations with same title, but different student name they are equal (based on your equals method). Compare also students in the equals method and you should be good. In general it is good practice to override both equals and hashcode methods. Your implementation of equals method is in general not following best practices for overriding equals method. Google a bit for "java equals method best practices" - you'll find something like this : http://javarevisited.blogspot.sk/2011/02/how-to-write-equals-method-in-java.html If you are lazy to write your own equals or hashcode methods (or you have other reasons) you can use : http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/builder/EqualsBuilder.html or http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/builder/HashCodeBuilder.html

http://stackoverflow.com/comment/31192745
type: Comment
has text: I'll accept your answer, it helped me more to find what I need
type: AnswerComment
comment on: http://stackoverflow.com/a/20804930
score: 0

http://stackoverflow.com/q/20714849
type: Question
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/20715452
has title: CustomListViewAdapter misbehaves when using if/switch statement in getView() method
accepted answer: http://stackoverflow.com/a/20715452
has body: i am working on this android application with ListView. i created a custom adapter for that,and what i am trying to do is setting onClickListener for a TextView in the first row of the list view (item 0 of the list). Only this item's TextView should have a listener. But when i put an if or a switch statement things get out of hand and the row at position 0 shares this position with row at position 2 so the textview in second row also gets a listener.I have 4 rows so after that the rows become 0,1,2 instead of 0,1,2,3 .Any idea what could be causing this? @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder=null; LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if(convertView==null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.contact_item, null); holder.imageViewPhoto = (ImageView) convertView.findViewById(R.id.image); holder.textViewName = (TextView) convertView.findViewById(R.id.namemain); holder.textViewProfession= (TextView) convertView.findViewById(R.id.profession); holder.textViewNumber = (TextView) convertView.findViewById(R.id.phone_number); holder.imageViewFacebook = (ImageView) convertView.findViewById(R.id.facebook); holder.imageViewTwitter = (ImageView) convertView.findViewById(R.id.twitter); holder.imageViewGoogle= (ImageView) convertView.findViewById(R.id.google); convertView.setTag(holder); } else{ holder=(ViewHolder)convertView.getTag(); Animation animation = new TranslateAnimation(0, 0, (position &gt; lastPosition) ? 100 : -200, 0); animation.setDuration(400); convertView.startAnimation(animation); } Contact aContact = (Contact) getItem(position); holder.textViewName.setText(aContact.getName()); holder.imageViewPhoto.setImageResource(aContact.getImageNumber()); holder.textViewProfession.setText(aContact.getProfession()); holder.textViewNumber.setText(aContact.getCellNumber()); holder.imageViewFacebook.setImageResource(…
downvote count: 0
type: AnsweredQuestion
tagged with: android-arrayadapter
score: 1
tagged with: java

http://stackoverflow.com/a/20836377
answers question: http://stackoverflow.com/q/20836245
has body: Use onPostExecute() instead. onPostExecute() receives the return value from doInBackground() after it finishes. From there you can do whatever needs to be done with your result. If onPostExecute() isn't flexible enough for you, consider using a CountDownLatch to stall your main code execution until AsyncTask returns.
score: 0
type: Answer

ondraw
type: Tag
tags question: http://stackoverflow.com/q/20747138
tag name: ondraw

http://stackoverflow.com/comment/31250986
type: QuestionComment
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44143/discussion-between-codegeek-and-umesh-awasthi)
comment on: http://stackoverflow.com/q/20835110
score: 0

http://stackoverflow.com/comment/31163674
type: QuestionComment
comment on: http://stackoverflow.com/q/20788517
has text: Previously I only had encType but I read on a blog that IE needs the encoding attribute on a form, so I added it to see if it helped with this issue. That didn't help, I actually removed it just after posting this issue. I'll edit it out of the form.
score: 0
type: Comment

http://stackoverflow.com/comment/31044345
has text: This question does not add value to the community. Try learning about debugging.
comment on: http://stackoverflow.com/q/20722165
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20822233
score: 4
accepted answer: http://stackoverflow.com/a/20822253
has comment: http://stackoverflow.com/comment/31326526
has body: I'm completely new to Java and Eclipse. I developed my first "Hello, world" program the other day following along with a tutorial. I understand most of the Eclipse UI since I worked with Flash Builder for awhile which was built on top of the Eclipse IDE. My question is, what does an orange square by folder in Package Explorer mean exactly? I imported the project "Hello, world" into the workspace on OSX and that's the first time I ever seen this orange square. I am really curious about it as it isn't on any of the rest of my projects? I referred to; http://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-icons.htm For a reference of icons in the Kepler IDE (btw that's what I'm using) and I found an orange square amongst the icons labeled "a monitor that is owned by a thread"; I don't understand the termonology used though... I don't even know if that is the correct icon I'm looking for? Here it is; And here's a screenshot of my package explorer... See them orange-looking squares? They look very similar but I'm not 100% sure. I really appreciate your help on this. Thank you!
answer count: 1
has answer: http://stackoverflow.com/a/20822253
favorite count: 0
has comment: http://stackoverflow.com/comment/31224394
has comment: http://stackoverflow.com/comment/31224449
has comment: http://stackoverflow.com/comment/31225634
has title: What does an orange square by folder in Package Explorer mean?
downvote count: 1
has comment: http://stackoverflow.com/comment/31224549
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/13617390
tagged with: java
has comment: http://stackoverflow.com/comment/31224367
has comment: http://stackoverflow.com/comment/31325941
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/13617390
upvote count: 5
tagged with: package-explorer
tagged with: icons

http://stackoverflow.com/comment/31102633
type: QuestionComment
score: 2
has text: Could we have a logcat as well, please?
comment on: http://stackoverflow.com/q/20754390
type: Comment

http://stackoverflow.com/comment/31099597
type: Comment
type: QuestionComment
has text: 1. You are using too many parentheses. 2. You have an encoding problem which cannot be solved by just those 3 lines. You should provide an [SCCE](http://sscce.org).
comment on: http://stackoverflow.com/q/20752725
score: 0

http://stackoverflow.com/q/20833426
type: Question
answer count: 2
has title: which method of mapper class shall be used to read the file in distributed cache
has body: You want to populate an associative array in order to perform a map-side join. You’ve decided to put this information in a text file, place that file into the DistributedCache and read it in your Mapper before any records are processed. Indentify which method in the Mapper you should use to implement code for reading the file and populating the associative array? map or configure ??
has answer: http://stackoverflow.com/a/20835314
possible better answer: http://stackoverflow.com/a/21980465
has answer: http://stackoverflow.com/a/21980465
score: 0
tagged with: java
tagged with: hadoop
has comment: http://stackoverflow.com/comment/31246234
accepted answer: http://stackoverflow.com/a/20835314
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31246308
has comment: http://stackoverflow.com/comment/31245642

http://stackoverflow.com/comment/31282190
type: Comment
has text: i put different value for order total and item amount.now i correct it.now it's return the token as i am expected.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20843096

http://stackoverflow.com/a/20848343
accepted answer of: http://stackoverflow.com/q/20847910
answers question: http://stackoverflow.com/q/20847910
type: AcceptedAnswer
score: 0
type: Answer
has body: It was an eclipse workspace error. The error was not detected by the compiler and the app was deployed! I do not know if that was due to the size of my legacy application which takes 10-15 mins to deploy.

http://stackoverflow.com/a/20789537
has body: Context context is never initialized in your Adapter class. Hence you get NullPointerException. Initialize it as below Context context; int rank; int[] flag; LayoutInflater inflater; public ListViewAdapter(Context context, int layout, Cursor cursor, String[] from, int[] to, int rank) { super(context, layout , cursor, from, to); this.rank = rank; this.context = context; //missing }
upvote count: 2
answers question: http://stackoverflow.com/q/20789512
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20789512
score: 2

http://stackoverflow.com/q/20801710
has comment: http://stackoverflow.com/comment/31186234
has answer: http://stackoverflow.com/a/20801932
tagged with: java
downvote count: 2
has body: I am writing a code in java to display text file in JTextArea. Can Anyone tell me what is wrong with this code. It is saying cannnot find symbol file.. FOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { final JFileChooser FileDialog = new JFileChooser(); int ReturnValue=FileDialog.showOpenDialog(null); if(ReturnValue==JFileChooser.APPROVE_OPTION) { File file = FileDialog.getSelectedFile(); } BufferedReader in = new BufferedReader(new FileReader(file)); String line = in.readLine(); while(line!=null) { WritingArea.append(line+"\n"); line=in.readLine(); } } });
tagged with: swing
tagged with: jfilechooser
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/31187061
has comment: http://stackoverflow.com/comment/31186030
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20801746
has title: Java Program Error: Cannot Find Symbol File
answer count: 2
tagged with: file-io
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31186191
type: Question
score: -2

http://stackoverflow.com/comment/31220671
score: 0
type: AnswerComment
has text: thread dies when it finish its work (little bit simplified answer and not perfectly correct but it most cases)
type: Comment
comment on: http://stackoverflow.com/a/20820265

http://stackoverflow.com/q/20837785
tagged with: java
has body: I have been creating a test program to test how movement on an angle may possibly work, and even though this is not where my problem lies, it is the program to which my problem/confusion is in. This error(?) does not affect the way my program works unless a user wants to key mash every key to see what happens and that is exactly what I did... I have a key listener which, on each key press and key release, sets a boolean in an array: public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); int a = KeyEvent.VK_LEFT; // int value of 37 int b = KeyEvent.VK_UP; // 38 int c = KeyEvent.VK_RIGHT; // 39 int d = KeyEvent.VK_DOWN; // 40 int aa = KeyEvent.VK_G; // 71 int bb = KeyEvent.VK_H; // 72 if(key == a || key == b || key == c || key == d) { player.setKeyValue(key - 37, true); // keyReleased is exactly the same but with a false } if(key == aa || key == bb) { player.setKeyValue((key - 71) + 4, true); } } I had my panel draw which keys were getting pressed, and I noticed that not all the keys I were pressing were getting drawn onto the screen. I was majorly confused thinking that it had something to do with the buffered image being too small, so I double checked that and strangely it wasn't. I decided to print all booleans in the array to the console and I found out that, indeed, some keys were actually not getting pressed when physically they were. Here is some of the output I had received when pressing different keys together: // booleans are in order: Left, up, right, down, g, h true, false, true, false, false, true true, false, true, false, true, true true, false, true, false, false, false I'm not sure why this is happened, but I'm getting the feeling that it has something to do with the amount of memory the JVM can hold at a given time. Though this poses no real obstacle for me, it would be nice to know how and why this occurs?
tagged with: keylistener
tagged with: output
type: Question
has answer: http://stackoverflow.com/a/20838080
answer count: 1
tagged with: boolean
has comment: http://stackoverflow.com/comment/31257739
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31253870
has title: Booleans not working simultaneously
score: 0

http://stackoverflow.com/comment/31033312
comment on: http://stackoverflow.com/a/20715825
score: 0
type: Comment
has text: Not sure what you mean about sorted/unsorted, though my code had an error too (oops). About time complexity, I might personally do this a different way, but I don't think it teaches anything to just say "your way has errors, so here is another way". Handing a solution that's vastly different solves a problem but is more like a shortcut and doesn't show somebody how to come up with solutions on their own.
type: AnswerComment

http://stackoverflow.com/comment/31030325
score: 0
has text: Apparantly the distances for node 13 was 100 vs 101. I wasn't comfortable using a debugger but I see it's usefulness now. Thanks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20714452

http://stackoverflow.com/a/20704712
type: Answer
score: 0
has body: Your example is not very object-oriented. You should convert all these lists of string arrays into Order objects. Then iterate over the Orders (sort them first by using a Comparable interface and comparing on the order id value). Then use some basic logic to check if the last order id value is the same as the last.
answers question: http://stackoverflow.com/q/20704498

http://stackoverflow.com/q/20848683
has answer: http://stackoverflow.com/a/20849298
has body: I'm having trouble using a couple of variables (the row and column number) I'm getting in other methods. Here is the code: public class playerPos { private int rowT; private int colT; public void setPos(String field[][]){ for(int i = 0; i&lt;field.length;i++){ for(int j = 0; j&lt;field[i].length; j++){ if(field[i][j] == "6"){ rowT = i; colT = j; } } } } now when I print inside the loop, or anywhere inside this method really, rowT and colT have the correct values. However, when I try to use rowT and colT in other methods (in the same class), they always return 0. Why is this? continuation of code above: public Integer getRowT(){ System.out.println("rowT from get : " + rowT); return rowT; } public Integer getColT(){ System.out.println("colT from get : " + colT); return colT; } } thanks for any help! More code: public class Home { public static void main(String[] args) { Field start = new Field(); Print first = new Print(); first.popField(start.newField()); logInput input = new logInput(); **playerPos position = new playerPos(); position.setPos(start.newField()**); **Move way = new Move();** first.popField(way.MoveP2(start.newField(), input.trekker, input.direction)); } } public class Move { public String[][] MoveP2(String field[][], String trekker, int direction){ playerPos pos = new playerPos(); Field type = new Field(); int rowT = pos.getRowT(); int colT = pos.getColT(); ... }
has answer: http://stackoverflow.com/a/20849573
possible better answer: http://stackoverflow.com/a/20849298
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: 2d
has comment: http://stackoverflow.com/comment/31274974
has comment: http://stackoverflow.com/comment/31274128
tagged with: java
has comment: http://stackoverflow.com/comment/31274308
score: -1
tagged with: methods
has comment: http://stackoverflow.com/comment/31274103
has comment: http://stackoverflow.com/comment/31274531
accepted answer: http://stackoverflow.com/a/20849573
answer count: 2
has title: How to use a variable located in a 2D array in another method?
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/31273919
favorite count: 0
has comment: http://stackoverflow.com/comment/31274356
tagged with: element
has comment: http://stackoverflow.com/comment/31274340

http://stackoverflow.com/comment/31236738
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20828845
has text: But i have a i == null it should not say anything if i have that, or?

http://stackoverflow.com/q/20702304
has answer: http://stackoverflow.com/a/20702405
upvote count: 4
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/20702392
favorite count: 0
type: Question
tagged with: encode
has comment: http://stackoverflow.com/comment/31007299
has comment: http://stackoverflow.com/comment/31007410
score: 4
has title: Captain crunch - ROT13 encoder program
answer count: 3
has body: The Captain Crunch decoder ring works by taking each letter in a string and adding 13 to it. For example, 'a' becomes 'n' and 'b' becomes 'o'. The letters "wrap around" at the end, so 'z' becomes 'm'. This is what I've got after editing it a bit from peoples comments, but now it keeps telling me that output may have not been initialized and I have no clue why... also is there anything else I need to fix in my program? In this case, I am only concerned with encoding lowercase characters import java.util.Scanner; public class captainCrunch { public static void main (String[] Args) { Scanner sc= new Scanner(System.in); String input; System.out.print("getting input"); System.out.println("please enter word: "); input= sc.next(); System.out.print(" "); System.out.print("posting output"); System.out.print("encoding" + input + " results in: " + encode(input)); }//end of main public static String encode(String input){ System.out.print(input.length()); int length= input.length(); int index; String output; char c; String temp= " "; for (index = 0; index &lt; length; index++) { c = input.charAt(index); if (c &gt;= 'a' &amp;&amp; c &lt;= 'm') c += 13; else if (c &gt;= 'n' &amp;&amp; c &lt;= 'z') c -= 13; output= temp + (char)(c); } return output; } }
has answer: http://stackoverflow.com/a/25493643
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/20780369
has comment: http://stackoverflow.com/comment/31148806
upvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/13977129
has comment: http://stackoverflow.com/comment/31148535
has comment: http://stackoverflow.com/comment/31148539
has comment: http://stackoverflow.com/comment/31148503
has answer: http://stackoverflow.com/a/20780810
score: -3
downvote count: 3
has comment: http://stackoverflow.com/comment/31148738
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31148496
tagged with: java
has body: Given a string aaaabaabaaaa(s to be generic), how many possible palindrome of size > 2 (n to be generic) can be generated from this string? I need to know how to count number of palindromes and to print those. Eg. for above string aaa, aaaa, aba, aba, aaa, aaaa, abaaba, aaaabaabaaaa. -Question asked in SAP(hiring for java) interview
accepted answer: http://stackoverflow.com/a/20780810
has comment: http://stackoverflow.com/comment/31148542
type: Question
has title: Write a function to count number of Palindrome substrings in given string?

http://stackoverflow.com/a/20847152
has comment: http://stackoverflow.com/comment/31271014
has body: I think you've almost got it. The static method makes the following promise, "if you request a new object that would compare .equals() to an existing object, I'll return the existing object instead". Given that guarantee, you know that a.equals(b) means that a == b, and you know that a == b means that a.equals(b). As a result, if you want to see if a and b are equal, you can use the == operator instead of the .equals method. That's useful because == is very fast and, depending on the object types, .equals could be slow. Here's a concrete example. Suppose we have a person class. A person is defined by their first and last name (pretend that there are no two people in the world with the same name). My class might look like this (didn't try to compile, so no guarantee of correctness): class Person { private final String fname; private final String lname; // Private constructor - must use the static method private Person(String first, String last) {fname = first; lname = last;} // Note that this is slow - the time it takes is proportional to the length of the // two names public boolean equals(Object o) { // Should check types here, etc. Person other = (Person) o; if (!person.fname.equals(other.fname)) {return false;} if (!person.lname.equals(other.lname)) {return false;} return true; } // Registry of all existing people private static Map&lt;String, Person&gt; registry = new TreeMap&lt;String, Person&gt;(); public static getPerson(String fname, String lname) { String fullName = fname + "-" + lname; // If we already have this person, return that object, don't construct a new one. // This ensures that p1.equals(p2) means that p1 == p2 if (registry.containsKey(fullName)) {return registry.get(fullName);} Person p = new Person(fname, lname); registry.put(fullName, p); return p; } } And then you can use it like this: public boolean isSamePerson(Person p1, Person p2) { // Guaranteed to have the same result as "return p1.equals(p2)" but will be faster return p1 == p2; }
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20846891
answers question: http://stackoverflow.com/q/20846891

http://stackoverflow.com/q/20785044
type: Question
answer count: 1
tagged with: applet
has answer: http://stackoverflow.com/a/20785185
has comment: http://stackoverflow.com/comment/31156769
has comment: http://stackoverflow.com/comment/31156498
tagged with: jframe
score: 0
has comment: http://stackoverflow.com/comment/31156061
tagged with: swing
accepted answer: http://stackoverflow.com/a/20785185
type: AnsweredQuestion
has body: I wrote this code in JFrame + Applet for a Game. import javax.swing.*; import java.awt.*; import java.awt.image.*; import java.applet.*; import java.net.URL; public class myGame extends Applet { static myGame k = new myGame(); JFrame f = new JFrame("myGame"); URL url; Image player; public void init(){ url = this.getDocumentBase(); player = this.getImage(url,"as.jpeg");//Here is the Image import } public void paint(Graphics g){ g.setColor(Color.BLUE); g.drawString("HI THERE",200,200); g.fillRect(120,130,50,50); g.drawImage(player,20,200,this); Here I draw it } public void start(){ f.setSize(600,400); f.setResizable(false); f.setLocationRelativeTo(null); f.add(k); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args){ k.start(); } } I cannot see the Image showing up as.jpg. I wanted to Import this Image as a player sprite. My code is not giving any errors, it just not showing the image.
tagged with: java
tagged with: image
has title: Java Applet in JFrame image not Showing UP

http://stackoverflow.com/a/20836018
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31257172
has comment: http://stackoverflow.com/comment/31257372
type: Answer
has comment: http://stackoverflow.com/comment/31251792
has comment: http://stackoverflow.com/comment/31252579
has body: Firstly your jsonString is not valid. You can test it at http://jsonviewer.stack.hu/. I've modified it a bit to make it valid: final GsonBuilder builder = new GsonBuilder(); final Gson gson = builder.create(); String jsonObjectString ="{\"menu_fields\":[{\"id\": 22, \"menu_id\": 1, \"field_type_id\": 1, \"c4w_code\": \"1234\", \"field_label\": \"Customer No\", \"field_values\": \"\", \"date_created\": \"2012-09-16 05:11:23\", \"date_modified\": \"2013-11-20 10:33:23\", \"is_required\": 0, \"is_static\": 1, \"field_order\": 1 }, {\"id\": 23, \"menu_id\": 1, \"field_type_id\": 1, \"c4w_code\": \"1234\", \"field_label\": \"Company Name\", \"field_values\": \"\", \"date_created\": \"2012-09-16 05:11:56\", \"date_modified\": \"2013-11-20 10:33:23\", \"is_required\": 1, \"is_static\": 1, \"field_order\": 3 }]}"; try { MenuFieldHolder menuFieldHolder= gson.fromJson(jsonObjectString, MenuFieldHolder.class); Log.i("TAG", "Result: " + menuFieldHolder.toString()); } catch (Throwable t) { t.printStackTrace(); } And your MenuFieldHolder and MenuField classes should be like below: private class MenuFieldHolder { @SerializedName("menu_fields") private MenuField[] menuFields; } private class MenuField { private int id; @SerializedName("menu_id") private int menuId; @SerializedName("field_type") private int fieldType; @SerializedName("c4w_code") private String c4wCode; @SerializedName("field_label") private String fieldLabel; @SerializedName("field_values") private String fieldValues; @SerializedName("date_created") private String dateCreated; @SerializedName("date_modified") private String dateModified; @SerializedName("is_required") private int isRequired; @SerializedName("is_static") private int isStatic; @SerializedName("field_order") private String fieldOrder; } or without SerializedName annotation(I prefer above. Because using camel case field names is a best practice for Java): private class MenuFieldHolder { private MenuField[] menu_fields; } private class MenuField { privat…
has comment: http://stackoverflow.com/comment/31251440
has comment: http://stackoverflow.com/comment/31251036
has comment: http://stackoverflow.com/comment/31251620
upvote count: 7
answers question: http://stackoverflow.com/q/20835536
score: 7
has comment: http://stackoverflow.com/comment/31281283
has comment: http://stackoverflow.com/comment/51921220
accepted answer of: http://stackoverflow.com/q/20835536

http://stackoverflow.com/comment/31015516
has text: so, you have annotations to map on the controller? or have configured in the xx-servlet.xml file?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20706776
score: 0

http://stackoverflow.com/a/20757654
score: 0
has body: 4H8 isn't an integer, so parseInt won't work on it. It seems like you still have a bit of a way to go on this, so I won't spoil your fun by giving you the code, just some ideas. Assuming the equation is always X + Y = Z, which X, Y and Z being some integers, one of which can contain an H... You need to have a couple of cases: If the H is in X, you can get X by subtracting Y from Z. If the H is in Y, you can get Y by subtracting X from Z. If the H is in Z, you can get Z by adding X and Y. But this still doesn't give you H. For this, you can simply find the position of the H in the string we have and extract the digit at that position in the number calculated above. So before calling parseInt, you should look for the H and simply store the string instead if you find it. parseInt also doesn't like spaces, so you should remove those in some way or another. If equations aren't always in the form X + Y = Z (i.e. you can also have subtraction, multiplication, division and/or multiple terms), it gets a bit more complicated.
has comment: http://stackoverflow.com/comment/31108363
type: Answer
has comment: http://stackoverflow.com/comment/31108625
answers question: http://stackoverflow.com/q/20757432
has comment: http://stackoverflow.com/comment/31108608
has comment: http://stackoverflow.com/comment/31108746

http://stackoverflow.com/a/20763341
has body: I would suggest using something like Drools. Creating your own custom solution would be an overkill because you would have to debug it, and still provide functionality certainly less than the one provided by a rule engine like Drools. I understand that Drools has a learning curve, but I would not compare it with creating a custom language, or a custom solution... In my opinion, in order for a user to write rules, he/she would have to learn something. While I suppose you could provide for a language simpler than the drools rule language, you would never capture all of his/her needs. Drools rule language would be simple enough for simple rules. Plus, you could provide him/her with a well formed documentation. If you plan to control the rules created by the end user and applied on the system, then perhaps it would be wiser to create a gui that would form the rules applied on drools. Hope I helped!
has comment: http://stackoverflow.com/comment/31334415
answers question: http://stackoverflow.com/q/20763189
downvote count: 0
upvote count: 11
has comment: http://stackoverflow.com/comment/31121895
type: Answer
score: 11

http://stackoverflow.com/comment/31251814
type: QuestionComment
has text: Well I am already using Timer tasks liberally, but want to shift to Scheduled Executor. Would really like to browse through all the use-cases considering limitations and benefits.
score: 0
comment on: http://stackoverflow.com/q/20837084
type: Comment

http://stackoverflow.com/comment/31024371
has text: Sorry, the last sentence is a bit unclear to me. Why create static method here? All `Animal`s `sleep()` and `run()`, they all inherit from `Animal`.
score: 0
comment on: http://stackoverflow.com/a/20711205
type: Comment
type: AnswerComment

http://stackoverflow.com/a/20748920
has body: because you have padding in your layout android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingBottom="5dp" android:paddingTop="5dp"
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20748560
answers question: http://stackoverflow.com/q/20748560

http://stackoverflow.com/comment/31229173
comment on: http://stackoverflow.com/a/20824881
score: 0
type: AnswerComment
type: Comment
has text: @MarkoTopolnik: Hmmm, very good point. You should post an answer explaining that for the OP. But looking at the code in that class, I don't think it's meant to be run that way.

http://stackoverflow.com/comment/30994197
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20694549
has text: Well what would happen if you removed it?
type: Comment

http://stackoverflow.com/comment/31184353
score: 0
type: Comment
has text: In most cases, for me it didn't work, since there always was some well hidden bug in some xml files (sometimes, in strings.xml, in someone of the languages I support)
comment on: http://stackoverflow.com/a/20800465
type: AnswerComment

http://stackoverflow.com/a/20849729
type: Answer
upvote count: 1
has body: From a command prompt you can do something like: java -jar \apps\fitnesse\fitnesse.jar -c "MyTests?suite" See: http://fitnesse.org/FitNesse.UserGuide.ControllingFitNesseFromTheCommandLine
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20837943

http://stackoverflow.com/a/20696783
downvote count: 0
has body: You can always do it like this: System.out.println("hey\n I can't believe that mark is "+mark+" years old.. thank god alex and david are "+alex+" and "+david+"..."); note: since you are using println(which indicate new line) for "hey", you need to add \n there
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/30998124
answers question: http://stackoverflow.com/q/20696756

http://stackoverflow.com/q/20808782
has comment: http://stackoverflow.com/comment/31199147
has answer: http://stackoverflow.com/a/20808829
has answer: http://stackoverflow.com/a/20808802
type: Question
has answer: http://stackoverflow.com/a/20809303
linked to: http://stackoverflow.com/q/5313832
answer count: 6
upvote count: 2
tagged with: int
score: 0
accepted answer: http://stackoverflow.com/a/20808789
downvote count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/20808795
has answer: http://stackoverflow.com/a/20808789
has body: I was doing a Tetris tutorial online, and noticed that there is an integer declared like this int[][][] blah; Why does the integer have those 3 brackets?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20808804
tagged with: declaration
has title: What does it mean when an integer is declared like this?
possible better answer: http://stackoverflow.com/a/20808829
has comment: http://stackoverflow.com/comment/31199211
tagged with: java

http://stackoverflow.com/q/20680159
answer count: 0
upvote count: 2
tagged with: java
has body: I am having a problem with an Ant project in Netbeans 7.4 . When building a certain web app that i had to create via importing it from a WAR into Netbeans it keeps nesting the output directories in the build directory deeper and deeper. It happens during the Ant target -copy-webdir . It outputs "x.class omitted as pathtox/x.class" for every file in the build/web directory and creates an even deeper nested set of directories on each build. Here is a small extract from the project.properties file: build.classes.dir=${build.web.dir}/WEB-INF/classes build.classes.excludes=**/*.java,**/*.form build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results build.web.dir=${build.dir}/web build.web.excludes=${build.classes.excludes} target -copy-webdir in the nbproject/build-impl.xml: &lt;target name="-copy-webdir"&gt; &lt;copy todir="${build.web.dir}"&gt; &lt;fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/&gt; &lt;/copy&gt; &lt;copy todir="${build.web.dir}/WEB-INF"&gt; &lt;fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/&gt; &lt;/copy&gt; &lt;/target&gt; What am i doing wrong here?
type: Question
tagged with: build-target
tagged with: ant
has comment: http://stackoverflow.com/comment/136740882
downvote count: 0
has comment: http://stackoverflow.com/comment/30979115
favorite count: 0
has comment: http://stackoverflow.com/comment/30971271
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30971391
has comment: http://stackoverflow.com/comment/30971417
score: 2
tagged with: netbeans
has title: Netbeans, Ant and nesting build directories

http://stackoverflow.com/q/20771737
type: Question
accepted answer: http://stackoverflow.com/a/20772015
has body: I have the following Java code that compiles the given Java code using the javax.tools.JavaCompiler API: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); ByteArrayOutputStream err = new ByteArrayOutputStream(); compiler.run(new FileInputStream("Test.java"), new FileOutputStream("Test.class"), err, "Test.java"); // Test.java contains the code of a simple Java class String compilationErrors = err.toString(); In the above code, all compilation errors are returned as one String instance. Is there a way to get compilation errors parsed i.d. get the file name, line number, cause of the error and line of code or do I have to do the parsing?
tagged with: compilation
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20772015
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: Java code compilation using JavaCompiler API and compilation errors handling

http://stackoverflow.com/q/20776292
score: -2
downvote count: 2
tagged with: spring
answer count: 1
tagged with: java
has body: I am migrating to Spring 3 from 2.5 and would like to use annotations to inject my beans. I could not figure out how do I create use annotations to achieve the following true
has title: Moving from xml to Annotations
has comment: http://stackoverflow.com/comment/31144688
has answer: http://stackoverflow.com/a/20776554
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/20776554
favorite count: 0
type: Question

http://stackoverflow.com/q/20721462
has answer: http://stackoverflow.com/a/22314620
tagged with: android
tagged with: ssh
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33908792
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/22314620
type: Question
has comment: http://stackoverflow.com/comment/33902942
tagged with: java
has title: SSH with Android
answer count: 1
downvote count: 0
has body: I'm trying to take in user details and then store it in a text file, send it off using ssh and delete it. But I'm getting open failed: ENOENT (No such file or directory) I'm using jsch to connect to the sever and the program works with a normal Java file but I'm having problems integrating it into Android. I am really working on the sending part right now. import android.os.Environment; import com.jcraft.jsch.*; import java.io.*; public class ServerIO { boolean getFile(String [] arg){ if(arg.length!=2){ System.err.println("usage: java ScpFrom user@remotehost:file1 file2"); System.exit(-1); } FileOutputStream fos=null; try{ String user=arg[0].substring(0, arg[0].indexOf('@')); arg[0]=arg[0].substring(arg[0].indexOf('@')+1); String host=arg[0].substring(0, arg[0].indexOf(':')); String rfile="webspace/UserDetails.txt"; String lfile="UserDetails.txt"; String prefix=null; File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if(new File(root, lfile).isDirectory()){ prefix=lfile+File.separator; } JSch jsch=new JSch(); Session session=jsch.getSession(user, host, 22); // username and password will be given via UserInfo interface. UserInfo ui=new MyUserInfo(); session.setUserInfo(ui); session.connect(); // exec 'scp -f rfile' remotely String command="scp -f "+rfile; Channel channel=session.openChannel("exec"); ((ChannelExec)channel).setCommand(command); // get I/O streams for remote scp OutputStream out=channel.getOutputStream(); InputStream in=channel.getInputStream(); channel.connect(); byte[] buf=new byte[1024]; // send '\0' buf[0]=0; out.write(buf, 0, 1); out.flush(); while(true){ int c=checkAck(in); if(c!='C'){ break; } // read '0644 ' in.read(buf, 0, 5); long filesize=0L; while(true){ if(in.read(buf, 0, 1)&lt;0){ // error break; } if(buf[0]==' ')break; filesize=filesize*10L+(long)(buf[0]-'0'); } String file=null; for(int i=0;;i++){ in.read(buf, i, 1); if(buf[i]==(byte)0x0a){ file=new String(buf, 0, i); break; } } // send '\0' buf[0]=0; out.write(buf…
tagged with: jsch
favorite count: 0

http://stackoverflow.com/q/20762160
type: UnansweredQuestion
tagged with: rest
downvote count: 0
score: 1
favorite count: 0
type: Question
upvote count: 1
tagged with: playframework-2.0
has title: Implementing oauth2 authentication on existing service
tagged with: java
tagged with: oauth-2.0
has body: I've got a rest service with three methods so not so complex. I used play framework and implemented some basic authentication (Global): @Override public Action onRequest(Request request, Method actionMethod) { if ("/dataDumps".equals(request.path()) || "/limitations".equals(request.path()) || "/entities".equals(request.path())) { if(null != request.getHeader("api-key") &amp;&amp; request.getHeader("api-key").equals("xxxxxxx")) { return super.onRequest(request, actionMethod); } else { return new Action.Simple() { @Override public Promise&lt;SimpleResult&gt; call(play.mvc.Http.Context ctx) throws Throwable { return F.Promise.pure((SimpleResult) forbidden()); } }; } } return super.onRequest(request, actionMethod); } Which works great. Now I got requirement that I need to add oauth2 authentication. Didn't do this before so surely I read some links like: http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified http://oauth.net/code/ http://coolthingoftheday.blogspot.com/2012/03/o-what-is-oauth-big-picture-free-ebook.html I was trying to find example online of oauth service provider example implementation. I found this : http://oauth.googlecode.com/svn/code/java/example But it's not even buildable with maven. So I tried to see how it's done in this example and add the logic to my onRequest method, but in the example code request object is HttpServletRequest but my request object is play.mvc.Http.Request. I found this gist https://gist.github.com/feliperazeek/1033587 which can solve this issue above but I feel like I'm overcomplicating stuff already before even getting started. 1. Spent fair amount of hours already reading and trying stuff out. Maybe someone who implemented Oauth service provider can give me some hints, helpful insight, links or code? My service is going to be used by other clients which may be other services or devices so I assume I need to create authorization service so clients can authenticate against but at the same time they will be consuming …
answer count: 0

http://stackoverflow.com/a/20821196
answers question: http://stackoverflow.com/q/20821111
score: 1
has body: You have a few options. You Could Simply handle the error should it occur... public void actionPerformed (ActionEvent e){ //... File save = new File("/home/bekk/Outline.txt"); PrintWriter out = null; try { out = new PrintWriter(save); out.println(Clientname); //... } catch (IOException exp) { JOptionPane.showMessageDialog(null, "Failed to save file", "Error", JOptionPane.ERROR_MESSAGE); } finally { try { out.close(); } catch (Exception exp) { } } } This is "okay", but you do tend to encapsulate a lot of potentially reusable code within a single method... You Could Create a save method and pass the values you want saved to it... public void actionPerformed (ActionEvent e){ //... File save = new File("/home/bekk/Outline.txt"); try { save(save, Clientname, DateofService, Nameofpc, manufacturer, CPUBit, Serialnumber, Productnumber, HardDriveplug, Typeofhd, ModelofHarddrive, SpeedofHardDrive, WhatDidtheCustomerSay, WorkDone, TechniciansComments, TechnicianWorking); } catch (IOException exp) { JOptionPane.showMessageDialog(null, "Failed to save file", "Error", JOptionPane.ERROR_MESSAGE); } } public void save(File save, String... values) throws IOException { PrintWriter out = null; try { out = new PrintWriter(save); for (String value : values) { out.println(value); } } finally { try { out.close(); } catch (Exception exp) { } } } This is still going to require you to handle the IOException yourself, but provides for a reusable piece of code which could be extended/overwritten in the future to provide other possibilities. You Could Encapsulate the properties you are trying to save into a Object and use something like Java Architecture for XML Binding (JAXB) to manage it... But... None of those are going to fix the "it throws an exception saying no file exists", because the file, simply can't be written. The most likely cause of this is because the file path does not exist, not that the file does not exist. The system simple can't create a new file in the location you are try…
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20821111
type: AcceptedAnswer
downvote count: 0
type: Answer

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/20723745
tag name: android-scrollview

http://stackoverflow.com/a/20755089
type: Answer
answers question: http://stackoverflow.com/q/20754129
has body: You should first start the java program, and then invoke java method from python. py4j doesn't start jvm, it just connects to the already started java process.
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/a/20792545
has body: Nice covering of the basics. Make sure all of your source files are in one place. Remember, it is the .CLASS files that the IDE compiles that you want to run, not the .JAVA files. http://www.cs.swarthmore.edu/~newhall/unixhelp/debuggingtips_Java.html
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31170044
answers question: http://stackoverflow.com/q/20792515
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31227521
type: Comment
type: QuestionComment
has text: What is your question ?
comment on: http://stackoverflow.com/q/20824022
score: 1

http://stackoverflow.com/comment/31046591
has text: The Apache timeout just needs to be higher than your flush intervals.
comment on: http://stackoverflow.com/a/20723464
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20728593
has body: While compling use something like this Javac -d . *.java it will automatically create package structure and place class files in corresponding packages
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20728383
answers question: http://stackoverflow.com/q/20728383

http://stackoverflow.com/comment/30970349
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20680595
has text: Show the corrected code on which you get that error. And best just read more about JSONObject and JSONArray: http://developer.android.com/reference/org/json/JSONArray.html http://developer.android.com/reference/org/json/JSONObject.html

http://stackoverflow.com/comment/31268755
has text: I am not using the symbolic links though, I am using the actual directories located inside the user directory. Does it still try to access the symbolic links even though I do this?
comment on: http://stackoverflow.com/a/20846115
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20685531
upvote count: 1
has body: Provide the so called accessors for the variables. For example: public String getAuthor() { return this.author; } public void setAuthor(String author) { this.author = author; } Same goes for the yeaofPub field.
answers question: http://stackoverflow.com/q/20685489
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/20713169
answers question: http://stackoverflow.com/q/20713054
has body: The file names must start with a letter because at build time the file names are converted to java identifiers. After you do that you can use reflection access each of the members of R.drawable.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31027666
has comment: http://stackoverflow.com/comment/31028087

http://stackoverflow.com/a/20723545
type: Answer
has body: copyLarge(InputStream input, OutputStream output, long inputOffset, long length) is using copy buffer of 4kb. So you can use it also for smaller files.
upvote count: 2
answers question: http://stackoverflow.com/q/20723380
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20723380
has comment: http://stackoverflow.com/comment/31046563

http://stackoverflow.com/a/20713733
has comment: http://stackoverflow.com/comment/31065647
downvote count: 0
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20707223
upvote count: 5
accepted answer of: http://stackoverflow.com/q/20707223
has body: Your problem is here: while(LimitOrderTransport.newBuilder().mergeDelimitedFrom(stream)) { LimitOrderTransport gpbQuote= LimitOrderTransport.parseDelimitedFrom(stream); The first line constructs a new LimitOrderTransport.Builder and uses it to parse a message from the stream. Then that builder is discarded. The second line parses a new message from the same stream, into a new builder. So you are discarding every other message. Do this instead: while (true) { LimitOrderTransport gpbQuote = LimitOrderTransport.parseDelimitedFrom(stream); if (gpbQuote == null) break; // EOF
type: Answer

http://stackoverflow.com/q/20769425
has title: How to use ChrisBanes' ActionBar-PullToRefresh library with Tab view at bottom in activity
answer count: 1
downvote count: 0
has body: I am trying to use Chris Banes' library Actionbar-PullToRefresh. It can be found here. I am using Tabs at bottom of screen in my app. as you can see in screen shot. I read through the sample code. He says that all you have to do is, wrap your refreshable view in a PullToRefreshLayout like this: How do i integrate it into my app. public class MainActivity extends Activity implements OnTabChangeListener { private TabHost mTabHost; public static final String TAB_1 = "Open"; public static final String TAB_2 = "Approved"; public static final String TAB_3 = "Decline"; private int mCurrentTab; public String result; Vector&lt;String&gt; msgvector = new Vector&lt;String&gt;(); Vector&lt;String&gt; usernamevector = new Vector&lt;String&gt;(); Vector&lt;String&gt; feedIdvector = new Vector&lt;String&gt;(); Vector&lt;String&gt; userIdvector = new Vector&lt;String&gt;(); ListView listview,listview1,listview2; private ProgressDialog simpleWaitDialog; List&lt;Rowfeeds&gt; rowfeedlist; public String result2; public String result3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTabHost = (TabHost) findViewById(android.R.id.tabhost); listview = (ListView)findViewById(R.id.tab_1); listview1 = (ListView)findViewById(R.id.tab_2); listview2 = (ListView)findViewById(R.id.tab_3); new Feedsdata().execute(); setupTabs(); mTabHost.setOnTabChangedListener(this); mTabHost.setCurrentTab(mCurrentTab); } private class Feedsdata extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... arg0) { // TODO Auto-generated method stub try { Log.i("doInBackground", "doInBackground"); HttpClient hc = new DefaultHttpClient(); HttpPost postMethod = new HttpPost("http://192.168.21.74/mynetwork/formapi/top_feeds"); List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("from", "0")); nameValuePairs.add(new Basic…
favorite count: 0
has answer: http://stackoverflow.com/a/20769855
tagged with: android
type: AnsweredQuestion
tagged with: tabs
upvote count: 1
tagged with: pull-to-refresh
type: Question
accepted answer: http://stackoverflow.com/a/20769855
score: 1
tagged with: java

http://stackoverflow.com/comment/31217523
score: 0
type: Comment
has text: Yes, same thing for SAX. You define what is to change. Good luck!
type: QuestionComment
comment on: http://stackoverflow.com/q/20817019

http://stackoverflow.com/comment/31141940
comment on: http://stackoverflow.com/q/20769881
score: 0
type: Comment
has text: *I want to measure for both width and height, which text completely contains in rectangle and has the maximum font size.* - do you mean as a one liner (which is where your current code is headed) or do you also want to allow line breaks to best fill the rectangle?
type: QuestionComment

http://stackoverflow.com/q/20800438
has answer: http://stackoverflow.com/a/20800465
linked to: http://stackoverflow.com/q/20782771
tagged with: java
tagged with: eclipse
duplicate of: http://stackoverflow.com/q/20782771
linked to: http://stackoverflow.com/q/4085959
has body: R.java in gen is missing. There are no errors in my xml. Please help.
accepted answer: http://stackoverflow.com/a/20800465
possible better answer: http://stackoverflow.com/a/20800450
duplicate of: http://stackoverflow.com/q/4085959
has answer: http://stackoverflow.com/a/20800450
has comment: http://stackoverflow.com/comment/31183758
type: Question
type: AnsweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31184033
has title: R.java is missing, what are other possible errors that led to this?
score: 0
answer count: 2

http://stackoverflow.com/comment/31049720
comment on: http://stackoverflow.com/q/20723080
has text: @jny: Eclipse automatically generates a Manifest.mf when exporting a project with "Runnable JAR" setting. I checked it anyways and it seemed valid. The Programm runs flawlessly when launched in eclipse, but it neither works when called via command line. It also doesent work on win 7 as I just noticed....
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/30982144
comment on: http://stackoverflow.com/q/20687980
type: QuestionComment
has text: I see...yes, your `start` node is empty (by the way, this is not how we usually do this; start node should have the first item). Take a look at your `display` loop, and think about what happens when you reach the second to last node here `n=n.link; } while(n.link!=null);`
score: 0
type: Comment

http://stackoverflow.com/a/20733587
upvote count: 30
answers question: http://stackoverflow.com/q/20733572
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39465857
has body: Solved it. Found out that you can add -Dorg.eclipse.swt.browser.DefaultType=mozilla to the end of your eclipse.ini file. Note that this not will work when using the OpenJDK.
type: Answer
score: 30
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20733572

http://stackoverflow.com/comment/30984114
comment on: http://stackoverflow.com/a/20689116
score: 1
type: AnswerComment
has text: +1 for JLS. Also to get `2` instead of `-3` OP can add 5 to result and in case new result will not be negative use modulo 5 again like `(-33 % 5 + 5) %5`
type: Comment

http://stackoverflow.com/comment/30969852
type: QuestionComment
has text: `FirstService` will work with the `BaseResponse`; `? super` will make it possible to call `myservice.process()`, but I then cannot assign `FirstService` anymore...
comment on: http://stackoverflow.com/q/20681364
score: 0
type: Comment

http://stackoverflow.com/q/20811061
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20812919
has answer: http://stackoverflow.com/a/20811179
has title: Running time of the same code blocks is different in java. why is that?
favorite count: 0
possible better answer: http://stackoverflow.com/a/20811122
score: 0
has answer: http://stackoverflow.com/a/20811122
has comment: http://stackoverflow.com/comment/31203582
duplicate of: http://stackoverflow.com/q/20655963
linked to: http://stackoverflow.com/q/504103
answer count: 4
accepted answer: http://stackoverflow.com/a/20812919
upvote count: 2
downvote count: 2
has body: I had the below code. I just wanted to check the running time of a code block. And mistakenly i had copied and pasted the same code again and get an interesting result. Though the code block is the same the running times are different. And the code block 1 taking more time than the others. If i switch the code blocks (say i move the code blocks 4 to the top) then code block 4 will be taking more time than others. I used two different types of Arrays in my code blocks to check it depends on that. And the result is same. If the code blocks has the same type of arrays then the top most code block is taking more time. See the below code and the given out put. public class ABBYtest { public static void main(String[] args) { long startTime; long endTime; //code block 1 startTime = System.nanoTime(); Long a[] = new Long[10]; for (int i = 0; i &lt; a.length; i++) { a[i] = 12l; } Arrays.sort(a); endTime = System.nanoTime(); System.out.println("code block (has Long array) 1 = " + (endTime - startTime)); //code block 6 startTime = System.nanoTime(); Long aa[] = new Long[10]; for (int i = 0; i &lt; aa.length; i++) { aa[i] = 12l; } Arrays.sort(aa); endTime = System.nanoTime(); System.out.println("code block (has Long array) 6 = " + (endTime - startTime)); //code block 7 startTime = System.nanoTime(); Long aaa[] = new Long[10]; for (int i = 0; i &lt; aaa.length; i++) { aaa[i] = 12l; } Arrays.sort(aaa); endTime = System.nanoTime(); System.out.println("code block (has Long array) 7 = " + (endTime - startTime)); //code block 2 startTime = System.nanoTime(); long c[] = new long[10]; for (int i = 0; i &lt; c.length; i++) { c[i] = 12l; } Arrays.sort(c); endTime = System.nanoTime(); System.out.println("code block (has long array) 2 = " + (endTime - startTime)); //code block 3 startTime = System.nanoTime(); long d[] = new long[10]; for (int i = 0; i &lt; d.length; i++) { d[i] = 12l; } Arrays.sort(d); endTime = System.nanoTime(); System.out.println("code block (has long array) 3 = " + (en…
has answer: http://stackoverflow.com/a/20811175
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/31203593

http://stackoverflow.com/a/20897347
answers question: http://stackoverflow.com/q/20834468
has body: Thanks to all. Finally I found a solution. The error was due to the version mismatch b/w my device and soap version. I resolved the issue by changing the schema envelope url in the wsdl.
type: Answer
has comment: http://stackoverflow.com/comment/32686352
score: 1
upvote count: 3
downvote count: 2
accepted answer of: http://stackoverflow.com/q/20834468
type: AcceptedAnswer

http://stackoverflow.com/comment/31191996
type: Comment
has text: I can get focus currently, I'm just having a problem getting the focus without having to click the spinner twice. Is there a listener I can put that into that would stop me from having the problem I'm having?
comment on: http://stackoverflow.com/a/20789596
type: AnswerComment
score: 0

http://stackoverflow.com/q/20777620
score: 0
answer count: 2
has title: How to serialize integers and delimiter bits in a single data structure?
has comment: http://stackoverflow.com/comment/31144542
tagged with: serialization
has answer: http://stackoverflow.com/a/20777999
has body: I want to serialize a binary tree, but instead of nulls, I want to save a single bit. Example, consider a simple binary tree, node with value 1 and 2 children left is of value 2 and right is of value 3. I want to serialize it like 1 2 . . 3 . . I was thinking of converting all integers into bits, and for dots I want to store just a single bit. Which data structure in java can I use to convert and int to bits and interspace them with set bits ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31143775
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20777651

http://stackoverflow.com/comment/31061334
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20731616
score: 0
has text: I dont think it will works.. Because i m getting html content (page) from httpclient... Before i m logging by httpclient so i have cookies(I cant get "mypage" without cookies)... Sorry for my bad English (Hope you understand :) )

http://stackoverflow.com/comment/31089732
has text: @Mellon I am really sorry, I accidentally skipped your updates. I updated my answer and suggested a workaround although I am currently working on a "real" solution.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20745968

http://stackoverflow.com/q/20737044
type: Question
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/31072024
tagged with: extjs
has body: I have a servlet which returns an ArrayList to a Jsp .I have no idea on how to Add values from the Servlet to ExtJs dyanamically.
has comment: http://stackoverflow.com/comment/31071544
type: UnansweredQuestion
has title: How to dyanamically poppulate values to an extjs grid from servlet?
answer count: 0
tagged with: java

http://stackoverflow.com/comment/30991508
type: QuestionComment
comment on: http://stackoverflow.com/q/20692500
type: Comment
has text: Can anybody tell me if i can link and array with Loanbook?
score: 0

http://stackoverflow.com/a/20780609
answers question: http://stackoverflow.com/q/20780495
type: Answer
has body: While creating session override a method PasswordAuthentication and in that give username and password. Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("pqr@gmail.com","xyz@123"); } });
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/31071380
type: QuestionComment
type: Comment
score: 0
has text: @chintankhetiya nothing except for Debugger is active, debugger has connected, waiting for debbuger to settle, and debugger has settled
comment on: http://stackoverflow.com/q/20736791

http://stackoverflow.com/q/20805123
tagged with: java
has comment: http://stackoverflow.com/comment/31192337
tagged with: collections
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/31192855
has title: How to loop a result-set and Save it in list of maps
has body: I am trying to loop a Result set and store the values in Map and save the map into list but when i execute, for the first loop i'am getting the data correctly but for the second time i'am receiving twice the value and if the loop run for nth time the result i am getting n times. Below is the code! List&lt;HashMap&lt;String, String&gt;&gt; value = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); PreparedStatement selectStmt; selectStmt = conn.prepareStatement("select * from ETR_INT_partc_DOCM where DOCM_TYP_CDE ='22'"); ResultSet result = selectStmt.executeQuery(); while (result.next()) { HashMap&lt;String, String&gt; resultValues = new HashMap&lt;String, String&gt;(); resultValues.put("PARTC_ID", result.getString("PARTC_ID")); resultValues.put("FILE_NME", result.getString("FILE_NME")); resultValues.put("LOC_ID", result.getString("LOC_ID")); resultValues.put("CRTE_DTE", result.getString("CRTE_DTE")); resultValues.put("CRTE_BY", result.getString("CRTE_BY")); value.add(resultValues); System.out.println(value); resultValues.clear(); } genarateXML(value, sheet)
has comment: http://stackoverflow.com/comment/31192311
score: 0
has comment: http://stackoverflow.com/comment/31192370
answer count: 1
has comment: http://stackoverflow.com/comment/31192384
has comment: http://stackoverflow.com/comment/31192320
has comment: http://stackoverflow.com/comment/31192853
tagged with: dictionary
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/20805205
accepted answer: http://stackoverflow.com/a/20805205

rotation
tags question: http://stackoverflow.com/q/20759227
tag name: rotation
type: Tag
tags question: http://stackoverflow.com/q/20821450

http://stackoverflow.com/comment/31190071
has text: Yes that was the kind of thing I was trying to implement, however was struggling to code it. Might start fresh and give it another go tonight.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20803704
type: AnswerComment

http://stackoverflow.com/a/20688302
score: 0
type: Answer
has body: I prefer using return in these kinds of loops as i think breaks would just be a waste. Keep a return statement at the end of your method, and use 2 regular returns in your if statements that will either return true or false. Also last I remember coding something similar to this, since the return type of my methods were void, i could simply use: return; and it would exit the loop and the method.
answers question: http://stackoverflow.com/q/20688085

http://stackoverflow.com/q/20849551
upvote count: 3
tagged with: for-loop
has answer: http://stackoverflow.com/a/20849833
downvote count: 1
has body: Situation: I have been downloading a .java-file from the internet. It's pretty messy, and I have cleaned a lot of the code with Java Docs in mind. However: The author of the code seems to practice three to four different ways of writing the for-loop, making it super-hard for me to debug. Example 1 (This is the form I like): for (int i = 0; i &lt; x; i++) { . . //Action inside the for-loop. } Example 2 (I can understand this one): for (int i = 0; i &lt; x; i++) //Action inside the for-loop. Example 3 (It becomes harder...): for (int i = 0; i &lt; x; i++) . . //Line 1 //Line 2 //Line 3 Example 4 (I'm totally lost): for (int i = 0; i &lt; x; i++) . . //Line 1 //Line 2 for (int i = 0; i &lt; x; i++) //Line 3 for (int i = 0; i &lt; x; i++) . . //Line 4 //Line 5 //Line 6 //Line 7 Question The for-loop format i name "Example 1" is so clean; it got brackets and is tabbed. Why are they using the other formats? Are they cooler than the first example? How are the for-loops in example 4 working? Are they inside each other? Thanks for your time and answers.
has answer: http://stackoverflow.com/a/20849635
accepted answer: http://stackoverflow.com/a/20849635
favorite count: 0
has comment: http://stackoverflow.com/comment/31275786
has comment: http://stackoverflow.com/comment/31275593
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20849968
possible better answer: http://stackoverflow.com/a/20849628
has answer: http://stackoverflow.com/a/20849840
has answer: http://stackoverflow.com/a/20849628
has answer: http://stackoverflow.com/a/20849581
type: Question
has answer: http://stackoverflow.com/a/20849683
has comment: http://stackoverflow.com/comment/31275791
answer count: 8
has answer: http://stackoverflow.com/a/20850443
has comment: http://stackoverflow.com/comment/31275612
tagged with: java
has comment: http://stackoverflow.com/comment/31276090
has title: Java: for-loops: Different loop-styles

http://stackoverflow.com/comment/31054978
score: 0
has text: @JBNizet It depends what you mean by words. You are right when comparing sentence where treating `What's` to `What is`. :)
comment on: http://stackoverflow.com/q/20728050
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31206832
has text: http://pastebin.com/EkqfRxkB
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20812767
score: 0

http://stackoverflow.com/a/20920385
has body: The problem was that I have built android application using jdk 1.6, but aniqroid library using 1.7. Changing to 1.6 solved this issue.
type: Answer
accepted answer of: http://stackoverflow.com/q/20848642
answers question: http://stackoverflow.com/q/20848642
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/20723422
has answer: http://stackoverflow.com/a/26882532
score: 0
tagged with: input
has comment: http://stackoverflow.com/comment/31049164
type: AnsweredQuestion
tagged with: java.util.scanner
has body: When creating e.g an address book I also want a method for searching it. Imagine I go for an object like this: public class someone { private static someone [] addressBook = new someone[150]; private String firstName; private String lastName; private String address; //... public someone(String firstName, String lastNameame, String adress/*,...*/){ this.firstName=firstName; //... } Now I'm planning on searching for someone using user input and Scanner. First, the user should declare for what (s)he is searching in gerneral: public static void searchSomeone(){ System.out.println("What do you want to search for?: "); Scanner sc1 = new Scanner(System.in); String userInput1 = sc1.next(); // e.g. userInput1="firstName" Second, the user is asked for the exact value (s)he is searching for: System.out.println("Enter a " + userInput1 + ": "); Scanner sc2 = new Scanner(System.in); String userInput2 = sc2.next(); // e.g. userInput2="Peter" for (int i=1;i<150;++i){ if(getAddressBook[i].**"Value of userInput1"**.contains(userInput2)){ // here is my problem!* System.out.println("Congrats, we've found someone! "); } } } Is there a way to use the value of the input as a call for the member variable? In this case the argument should 'become' if(getAddressBook[i].firstName.contains(userInput2)){} I tried to implement another method like getInputValue that simply returns the String but it didn't work here. If there is no such solution I will have to include code for every member variable separately which I really dont want to! Hope you get my idea! And please be kind I'm quite new to forums. :P
accepted answer: http://stackoverflow.com/a/26882532
has title: Using user input for searching object in java
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31057218
has comment: http://stackoverflow.com/comment/31048792
answer count: 1
tagged with: member-variables

http://stackoverflow.com/q/20775749
answer count: 1
accepted answer: http://stackoverflow.com/a/20775844
tagged with: flyweight-pattern
type: AnsweredQuestion
tagged with: memory-management
tagged with: design-patterns
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20775844
has title: Flyweight pattern with a bidimensional array
score: 0
has body: I have a matrix (bidimensional array) of Objects Bee, I want to apply the flyweight pattern, how should I apply it?, if I instantiate the matrix directly with a huge size I would be allocating too much memory. Is there a efficient way to apply the pattern?. I already checked that the pattern is applicable to the Bee object, but I'm concerned about the matrix memory. PD I'm using java.

http://stackoverflow.com/a/20731295
answers question: http://stackoverflow.com/q/20728886
type: Answer
has body: I found out that when you turn off the screen using power button then android go to sleep after sometimes. CPU also go to sleep when screen is off. That's whey Thread.sleep() is giving large delay. In my case my device was in sleep mode for 7.30 minute and when i turn on the screen cpu wake up and start the Thread again. By acquiring the Partial_wake_lock you can hold cpu to go to sleep even when you press the power button(not shutdown). More details
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/31541293
type: Comment
comment on: http://stackoverflow.com/a/20814664
score: 0
type: AnswerComment
has text: @Adorjan Thanks for reporting back. I feel happy for you too : )

http://stackoverflow.com/q/20798570
tagged with: jsp
linked to: http://stackoverflow.com/q/29185042
tagged with: struts2-convention-plugin
favorite count: 0
linked to: http://stackoverflow.com/q/14207301
type: AnsweredQuestion
has title: Struts 2 Convention Plugin and JSP files under WEB-INF
type: Question
score: 3
tagged with: configuration
tagged with: java
has answer: http://stackoverflow.com/a/20799404
accepted answer: http://stackoverflow.com/a/20799404
tagged with: struts2
upvote count: 3
has body: When using Struts2 convention plugin, the plugin automatically forwards a hello-world.action request to /WEB-INF/content/hello-world.jsp even if no HelloWorld.java is defined. Please see http://struts.apache.org/release/2.1.x/docs/convention-plugin.html for that. On the other hand, we put JSP files under WEB-INF to avoid any direct access to JSP files. I think this behavior of convention plugin ruins JSP access policy. Any one can make a direct access to a JSP by simply calling a, build on the fly, action. Am I correct?! If yes, can we disable this feature?
answer count: 1
downvote count: 0

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/20684266
type: Tag
tags question: http://stackoverflow.com/q/20790560
tags question: http://stackoverflow.com/q/20832793
tags question: http://stackoverflow.com/q/20742001

http://stackoverflow.com/comment/31126669
type: QuestionComment
has text: Then `videoBox` is `null`.
comment on: http://stackoverflow.com/q/20767713
score: 0
type: Comment

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/20825976
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/20680589

combinations
tags question: http://stackoverflow.com/q/20686255
tags question: http://stackoverflow.com/q/20690104
tag name: combinations
type: Tag
tags question: http://stackoverflow.com/q/20685212

http://stackoverflow.com/a/20763893
downvote count: 0
has body: &amp;amp; is the HTML escaped version of &amp;. You should replace all &amp;amp; with &amp;
answers question: http://stackoverflow.com/q/20763857
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31010303
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20703628
type: Comment
has text: (There is a significant difference between "constant" and "final".)

http://stackoverflow.com/q/20689055
linked to: http://stackoverflow.com/q/33477695
score: 42
upvote count: 42
has body: Java 8's java.time.Instant stores in "nanosecond resolution", but using Instant.now() only provides millisecond resolution... Instant instant = Instant.now(); System.out.println(instant); System.out.println(instant.getNano()); Result... 2013-12-19T18:22:39.639Z 639000000 How can I get an Instant whose value is 'now', but with nanosecond resolution?
tagged with: nanotime
downvote count: 0
has title: Java 8 Instant.now() with nanosecond resolution?
favorite count: 0
has comment: http://stackoverflow.com/comment/66438513
answer count: 5
type: UnansweredQuestion
tagged with: time
has comment: http://stackoverflow.com/comment/30984141
has answer: http://stackoverflow.com/a/38658066
has answer: http://stackoverflow.com/a/66984250
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20689213
has answer: http://stackoverflow.com/a/20689231
has answer: http://stackoverflow.com/a/20689298

http://stackoverflow.com/comment/31100458
has text: Apologies, MySQL. Editing question.
score: 0
comment on: http://stackoverflow.com/q/20753143
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31110648
comment on: http://stackoverflow.com/a/20758196
type: Comment
has text: abhishek i have tried this but i didn't get ....could you plz help me out of this
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31190175
comment on: http://stackoverflow.com/q/20803960
score: 0
has text: are you sure? I have read that eclipse comes with its own compiler. also, my programs are running fine (meaning they are compiling fine) until I close them, re-open, and try to run them again. also, I have JDK installed at my home computer, and I am getting this same sort of problem.. I don't think it's caused by JDK
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20765809
downvote count: 0
has title: Java generics understanding
tagged with: generics
duplicate of: http://stackoverflow.com/q/2770321
favorite count: 0
has answer: http://stackoverflow.com/a/20765866
has answer: http://stackoverflow.com/a/20765837
answer count: 5
has answer: http://stackoverflow.com/a/20765854
accepted answer: http://stackoverflow.com/a/20765866
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31122554
tagged with: java
has body: Could you please explain to me what happens here and why it works without errors. List list = new ArrayList&lt;String&gt;(); list.add(1); I'm sorry, if there already were similar questions, I failed to properly formulate the question so can't google it
type: Question
possible better answer: http://stackoverflow.com/a/20765843
has answer: http://stackoverflow.com/a/20765843
has answer: http://stackoverflow.com/a/20765849
linked to: http://stackoverflow.com/q/2770321

http://stackoverflow.com/a/21023956
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20727030
downvote count: 0
answers question: http://stackoverflow.com/q/20727030
has body: Instead of using @Broadcast, use Broadcaster directly using the BroadcasterFactory, and invoke broadcaster.broadcast(message, ClientB). Look at atmosphere-sample's, there is many example doing that. -- Jeanfrancois

http://stackoverflow.com/q/20730752
has comment: http://stackoverflow.com/comment/31062341
tagged with: java
upvote count: 1
answer count: 1
has title: Can i run a vert.x instance inside an application server like tomcat or jboss
has body: I'm a newbie in Websockets and i would like to know if it's possible to run a Websocket server from a Servlet for example, if answer is no, please give me an explanation.
type: UnansweredQuestion
tagged with: jboss
has comment: http://stackoverflow.com/comment/73129572
tagged with: vert.x
downvote count: 0
tagged with: websocket
score: 1
has answer: http://stackoverflow.com/a/20736634
tagged with: tomcat
favorite count: 0
type: Question

http://stackoverflow.com/comment/31055216
type: Comment
has text: Thought so ;) Thanks for sharing your knowledge about `@Immediate`. I will give up for now and just create the objects I need at start up manually.
comment on: http://stackoverflow.com/a/20721765
type: AnswerComment
score: 0

http://stackoverflow.com/q/20735448
has comment: http://stackoverflow.com/comment/31068908
upvote count: 1
has comment: http://stackoverflow.com/comment/31068936
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20735580
has body: When I create an int COun that increments with the following function, once it gets to desired int to set it back to zero, the COun is set to zero and starts incrementing again until 10 but it increments another int, by the same name I assume. Why does it do that? Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { // Your code counterr++; System.out.println("COun "+counterr); // System.out.println("Refresh? "+refresh); if(counterr&gt;10){ json = jParser.makeHttpRequest(url_all_products, "GET", params); Intent i = new Intent(getApplicationContext(), AllProductsActivity.class); startActivity(i); counterr=0; } } }, delay, period); When you print out COun, you can tell it starts by just incrementing one COun, but then every time if sentence kicks in, it generates another COun counter. 12-20 18:50:16.170: I/System.out(10465): COun 1 12-20 18:50:17.071: I/System.out(10465): COun 2 12-20 18:50:18.082: I/System.out(10465): COun 3 12-20 18:50:19.083: I/System.out(10465): COun 4 12-20 18:50:20.084: I/System.out(10465): COun 5 12-20 18:50:21.085: I/System.out(10465): COun 6 12-20 18:50:22.086: I/System.out(10465): COun 7 12-20 18:50:23.077: I/System.out(10465): COun 8 12-20 18:50:24.078: I/System.out(10465): COun 9 12-20 18:50:25.079: I/System.out(10465): COun 10 12-20 18:50:26.080: I/System.out(10465): COun 11 12-20 18:50:27.071: I/System.out(10465): COun 1 12-20 18:50:28.082: I/System.out(10465): COun 2 12-20 18:50:29.073: I/System.out(10465): COun 3 12-20 18:50:30.083: I/System.out(10465): COun 4 12-20 18:50:31.084: I/System.out(10465): COun 5 12-20 18:50:31.405: I/System.out(10465): COun 1 12-20 18:50:32.085: I/System.out(10465): COun 6 12-20 18:50:32.406: I/System.out(10465): COun 2 12-20 18:50:33.086: I/System.out(10465): COun 7 12-20 18:50:33.407: I/System.out(10465): COun 3 12-20 18:50:33.407: I/System.out(10465): COun 8 12-20 18:50:33.407: I/System.out(10465): COun 4 12-20 18:50:33.407: I/System.out(10465): COun 9 12-20 18:50:33…
has comment: http://stackoverflow.com/comment/31069453
accepted answer: http://stackoverflow.com/a/20735580
answer count: 1
has comment: http://stackoverflow.com/comment/31068615
favorite count: 0
linked to: http://stackoverflow.com/q/20732039
has comment: http://stackoverflow.com/comment/31069429
type: AnsweredQuestion
score: 0
tagged with: java
has title: int set to zero generates new int by the same name tho

http://stackoverflow.com/q/20764344
type: Question
has title: MongoDB search in embedded array
has answer: http://stackoverflow.com/a/20860785
upvote count: 3
tagged with: java
answer count: 1
tagged with: mongodb
has body: I am trying to store all my written java files in a MongoDB and so far I've applied a schema like this (incomplete entry): { "_id" : ObjectId("52b861c230044fd08d6c27c4"), "interfaces" : [ { "methodInterfaces" : [ { "name" : "add", "name_lc" : "add", "returnType" : "Integer", "returnType_lc" : "integer", "parameterTypes" : [ "Integer", "Integer" ], "parameterTypes_lc" : [ "integer", "integer" ] }, { "name" : "isValid", "name_lc" : "isvalid", "returnType" : "Boolean", "returnType_lc" : "boolean", "parameterTypes" : [ "Integer", "Double" ], "parameterTypes_lc" : [ "integer", "double" ] } ], "name" : "Calculator", "name_lc" : "calculator", "filename" : "Calculator.java", "filename_lc" : "calculator.java" } ], "name" : "Calculator", "name_lc" : "calculator", "filename" : "Calculator", "filename_lc" : "calculator", "path" : "/xyz/Calculator.java", "md5" : "6dec7e62c5e4f9060c7612c252cd741", "lastModification" : "" } So far I am able to query a class that contains a method name, but I am not able to query a class with a certain name (let interfaces.name_lc="calculator") that must contain two methods with particular names (let's say "add" and "divide") which themselves should have two integer, resp. an integer and a double as parameters and both return an integer (don't question whether this is reasonable or not -- just for illustration purposes). This is just one example; it can be more complex, of course. I don't know how I can query for a particular class with method and specified parameters. I need to describe it sharp and want sharp results. I am not able to construct a query, that would only return files like Calculator ( add(integer,integer):integer; divide(integer,double):integer; ). I get, e.g., OtherClass ( add():void; method(integer):integer; ), which is not what I want. I am trying this for days now, and maybe one can enlighten me, how to solve this in MongoDB. Thanks a lot in advance!
tagged with: find
type: UnansweredQuestion
score: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23246054
has body: Set the background like this: IconGenerator icnGenerator = new IconGenerator(this); icnGenerator.setBackground(getResources().getDrawable(R.drawable.marker_background)); marker_background has to be a .9.png file. Like the drawables of the library. It works pretty good for me.
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/20791299
has comment: http://stackoverflow.com/comment/52800562
downvote count: 0
score: 8

http://stackoverflow.com/a/20844227
accepted answer of: http://stackoverflow.com/q/20844191
has comment: http://stackoverflow.com/comment/139696143
answers question: http://stackoverflow.com/q/20844191
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31265219
type: Answer
score: 19
has body: Because in conventional mathematical notation, and (logical conjunction) has higher precedence than or (logical disjunction). All non-esoteric programming languages will reflect existing convention for this sort of thing, for obvious reasons.
upvote count: 19

http://stackoverflow.com/a/20815357
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/20815009
type: Answer
has body: public class deck { public static void main(String[] args) { edward test = new edward(); //1 System.out.print(test); //2 } } In line 1, you create a new edward object called test. In line 2, you print the object itself. According to the Java API, print(Object) Prints an object. The string produced by the String.valueOf(Object) method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method. I'm guessing that the output looked something like: edward@672563. That is because String.valueOf(obj) returns the type of obj (edward), followed by the character @, followed by the location in memory of obj (672563). Here is some code that should do what you are attempting: public class Deck //all class names should be capitalized { public static void main(String[] args) { Edward test = new Edward(); test.message(); //1 } } public class Edward { public void message() //`message` doesn't need a parameter { System.out.print("hello, this is text!"); } } In line 1, you call test's method message(). Calling a method executes the code that is in that method, so test.message() executes the line System.out.print("hello, this is text!"); Here is a different way of doing the same thing: public class Deck { public static void main(String[] args) { Edward test = new Edward(); System.out.println(test.message); //1 } } public class Edward { public String message = "hello, this is text!"; //2 } In line 2, you create a new String "field" with the value of "hello, this is text!". In line 1, you print the value of the field message contained in the object test. If there are other parts of this code that you don't understand, feel free to comment on this answer!

http://stackoverflow.com/comment/31150291
has text: Nope, JSON parsers ignore it completely. There's no point in adding it in if you don't plan on reading it. Even if you do plan on reading it, it's easier to just install a browser extension or format it inside of your text editor.
score: 2
comment on: http://stackoverflow.com/q/20781351
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31100970
comment on: http://stackoverflow.com/q/20753401
score: 0
has text: if it treats the boolean elements of the array as boolean variables, then it's enough. Because the operation on a boolean var is atomic. I either write or read a true or false! @ChrisHayes btw, I edited the question and added a note.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20709777
has title: javafx 2 webview custom url handler, don't work relative url
has body: I have simple app with code: webView.getEngine().load("classpath:data/index.html"); Custom URLStreamHandler: public class Handler extends URLStreamHandler { private final ClassLoader classLoader; public Handler() { this.classLoader = getClass().getClassLoader(); } public Handler(ClassLoader classLoader) { this.classLoader = classLoader; } @Override protected URLConnection openConnection(URL u) throws IOException { URL resourceUrl = classLoader.getResource(u.getPath()); if(resourceUrl == null) throw new IOException("Resource not found: " + u); return resourceUrl.openConnection(); } } installed by: URL.setURLStreamHandlerFactory(protocol -> { if(protocol.equals("classpath")) { return new Handler(); } else { return null; } }); It load data/index.html: Test Hello, World!!! but in result image doesn't appears. What to do to allow WebView resolve relative link like "download.jpg"?
downvote count: 0
tagged with: webview
has answer: http://stackoverflow.com/a/20767007
accepted answer: http://stackoverflow.com/a/20767007
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: javafx-8
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/30998386
type: AnswerComment
type: Comment
has text: please let me know what is array ? ArrayAdapter<String> dataAdapter1 = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, array,systemTypeArrayList)); in your code?
score: 0
comment on: http://stackoverflow.com/a/20682670

http://stackoverflow.com/q/20821112
type: Question
tagged with: android-viewpager
tagged with: arraylist
has title: How to populate ViewPager with strings from ArrayList?
upvote count: 1
answer count: 1
has body: I have a list of items that each has their own ArrayList&lt;String&gt;. When an item is clicked, the ViewPager activity is opened. I want each string to fill up an entire view in ViewPager, so that the user can swipe through each of these strings as pages. Is ViewPager the best way to go about doing this? If so, how can I populate it with the contents of the ArrayList&lt;String&gt;?
favorite count: 0
tagged with: android
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20821221
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20821221

http://stackoverflow.com/comment/31145995
has text: i have already done this , but its not on any server its on windows machine.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20776798

http://stackoverflow.com/comment/31057464
type: QuestionComment
type: Comment
has text: @RaymondChen: You shouldn't get problem #1 in Java.
comment on: http://stackoverflow.com/q/20726033
score: 0

http://stackoverflow.com/a/20683003
answers question: http://stackoverflow.com/q/20682832
has comment: http://stackoverflow.com/comment/30973131
has comment: http://stackoverflow.com/comment/30973576
score: 0
has comment: http://stackoverflow.com/comment/30972715
has body: There is obviously something wrong with your classpath. What Web Server Are You Using?
type: Answer
has comment: http://stackoverflow.com/comment/30974003
has comment: http://stackoverflow.com/comment/30972939
has comment: http://stackoverflow.com/comment/30973826

http://stackoverflow.com/q/20802649
downvote count: 0
answer count: 6
has body: I need help to identify the border and compare the images with the original image. I need guidance on How can I achieve this through processing or matlab or anything for beginner. for example look at the image below. Original Image: The Multiple Image:
score: 39
linked to: http://stackoverflow.com/q/10168686
upvote count: 39
has title: Detecting multiple images in a single image
has comment: http://stackoverflow.com/comment/31187837
has answer: http://stackoverflow.com/a/20895950
favorite count: 0
has answer: http://stackoverflow.com/a/20952034
has answer: http://stackoverflow.com/a/20869967
accepted answer: http://stackoverflow.com/a/20869967
has comment: http://stackoverflow.com/comment/31382383
tagged with: matlab
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20802987
tagged with: java
has answer: http://stackoverflow.com/a/20912167
tagged with: image-processing
tagged with: image
type: Question
has answer: http://stackoverflow.com/a/20859042
has answer: http://stackoverflow.com/a/20802987

http://stackoverflow.com/comment/31034102
has text: I am using DB2 8.1 version
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20716801

http://stackoverflow.com/comment/41976357
has text: @Romski Thanks for your suggestion, I will like to know the other way you want to suggest :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20730794

http://stackoverflow.com/a/20787974
type: Answer
has body: Packet capture doesn't allow you to prevent a packet being sent. It is for monitoring only. If you want to delay a packet you need a device e.g. a multi-homed PC, to sit between your system and rest of the network. This can be used to capture on one network interface and copy packets to a second interface with what ever delay you want. If you want to do this in software you can create a TCP proxy server and have your software connect to it.
answers question: http://stackoverflow.com/q/20787909
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31163412
upvote count: 3

http://stackoverflow.com/comment/30984746
comment on: http://stackoverflow.com/q/20689367
score: 0
type: Comment
type: QuestionComment
has text: Can you post the code where you tried to update the views on the ui thread? Also, what was the crash that you were getting when trying to do this?

http://stackoverflow.com/a/20848515
score: 1
has comment: http://stackoverflow.com/comment/31293174
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20848187
has comment: http://stackoverflow.com/comment/31276764
type: Answer
answers question: http://stackoverflow.com/q/20848187
has body: Here is an example to go along with my comment. Pretty strait forward, although I would clean up this code if you plan on using it in a production environment. import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.util.ArrayList; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class MainTest { JLabel countLabel = new JLabel(""); Thread printer = null; public static void main(String[] args) { // passes in a directory MainTest test = new MainTest(); } public MainTest() { JFrame frame = new JFrame("TestFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); frame.setBounds(new Rectangle(200, 200, 200, 200)); JButton button = new JButton("Open Instances"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub Thread t = new Thread(new Runnable() { @Override public void run() { OpenStuff(); } }); t.start(); } }); countLabel.setSize(new Dimension(50, 50)); panel.add(countLabel); panel.add(Box.createVerticalStrut(20)); panel.add(button); printer = new Thread(new CountPrinter()); printer.start(); frame.add(panel); frame.show(); } private void OpenStuff() { int count = 0; ArrayList&lt;Thread&gt; threads = new ArrayList&lt;Thread&gt;(); while (count &lt; 5) { Thread t = new Thread(new OpenNotePadAndJoin()); t.start(); threads.add(t); count++; } for (Thread t : threads) { try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } } printer.interrupt(); } private static class SharedResource { public static volatile int count = 0; } private class CountPrinter implements Runnable { @Override public void run() { while (true) { countLabel.setText(String.valueO…
downvote count: 0
has comment: http://stackoverflow.com/comment/31298431
has comment: http://stackoverflow.com/comment/31292490

http://stackoverflow.com/comment/30989467
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20691673
has text: Do you use `Platform.createAndRunWorkbench` to run the Eclipse workbench or does your RCP do something else? It is `createAndRunWorkbench` that calls `getBundleProgressMonitor`.
score: 0

http://stackoverflow.com/comment/31048006
comment on: http://stackoverflow.com/q/20724247
score: 0
type: Comment
type: QuestionComment
has text: You provided to few details to get a good advice. The code above doesn't even compile, and doesn't make sense. We don't know what you're trying to achieve, what those classes are for, etc.

http://stackoverflow.com/comment/30994310
type: AnswerComment
comment on: http://stackoverflow.com/a/20694593
type: Comment
has text: I just thought about it a second before you wrote this answer! :D Thank you for approving my thought ^^
score: 0

http://stackoverflow.com/comment/31014019
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20689326
has text: No, it won't be opening up my $HOME directory - that was just a test I did. It will be opening up a secure area. That said, most all of these areas are secure - now days what is not? Can you cite any particular concerns particular to Java?

http://stackoverflow.com/a/20977228
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/20712782
has comment: http://stackoverflow.com/comment/31518653
type: Answer
has body: There is an interesting discussion about it here. To quote nat_pryce: Hi. I wrote the original version of Hamcrest, although Joe Walnes added this wierd method to the base class. The reason is because of a peculiarity of the Java language. As a commenter below said, defining Matcher as a base class would make it easier to extend the library without breaking clients. Adding a method to an interface stops any implementing classes in client code from compiling, but new concrete methods can be added to an abstract base class without breaking subclasses. However, there are features of Java that only work with interfaces, in particular java.lang.reflect.Proxy. Therefore, we defined the Matcher interface so that people could write dynamic implementations of Matcher. And we provided the base class for people to extend in their own code so that their code would not break as we added more methods to the interface. We have since added the describeMismatch method to the Matcher interface and client code inherited a default implementation without breaking. We also provided additional base classes that make it easier to implement describeMismatch without duplicating logic. So, this is an example of why you can't blindly follow some generic "best practice" when it comes to design. You have to understand the tools you're using and make engineering trade-offs within that context. EDIT: separating the interface from the base class also helps one cope with the fragile base class problem: If you add methods to an interface that is implemented by an abstract base class, you may end up with duplicated logic either in the base class or in subclasses when they are changed to implement the new method. You cannot change the base class to remove that duplicated logic if doing so changes the API provided to subclasses, because that will break all subclasses -- not a big problem if the interface and implementations are all in the same codebase but bad news if you're a library author. If the int…
score: 2

http://stackoverflow.com/comment/38085431
comment on: http://stackoverflow.com/a/20842113
score: 1
has text: But someone can go to that url and download rhat DB file. and can understand encryption decryption technique and read it...
type: AnswerComment
type: Comment

magic-numbers
tag name: magic-numbers
type: Tag
tags question: http://stackoverflow.com/q/20811211

http://stackoverflow.com/q/20790900
has answer: http://stackoverflow.com/a/20790962
has body: I am wondering about the purpose of JVM. If JVM was created to allow platform independent executable code, then can't a cross-compiler which is capable of producing platform independent executable code replace a JVM? the information about cross-compiler was retrieved from: http://en.wikipedia.org/wiki/Cross_compiler
has answer: http://stackoverflow.com/a/20791084
has comment: http://stackoverflow.com/comment/31167155
has title: Cross-compiler vs JVM
has comment: http://stackoverflow.com/comment/31167456
answer count: 3
has comment: http://stackoverflow.com/comment/31167279
has comment: http://stackoverflow.com/comment/31167317
favorite count: 0
type: UnansweredQuestion
tagged with: cross-compiling
downvote count: 1
has comment: http://stackoverflow.com/comment/31167136
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/20790961
type: Question
upvote count: 4

http://stackoverflow.com/q/20708115
has answer: http://stackoverflow.com/a/20708134
has body: If an Android device were connected to a computer via USB charger, would it be possible to launch a java GUI on the computer from the device (i.e. by pressing a button in an android app)? Also, would this be a platform dependency nightmare?
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20708134
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
has title: Possible to Run a Java GUI on a computer from an Android?
score: 1
tagged with: java

http://stackoverflow.com/comment/31228042
score: 0
type: AnswerComment
has text: I found another option that is exactly what I wanted (I will post it). Thanks a lot for your help.
type: Comment
comment on: http://stackoverflow.com/a/20723464

http://stackoverflow.com/comment/31169521
comment on: http://stackoverflow.com/q/20780235
type: QuestionComment
type: Comment
score: 0
has text: Apart from Sotirios Delimanolis's observation, your *.java should not be in classes folder. It wll not hurt, if it is there; just that it shows you are not sure what should go where. Check this out: http://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html

http://stackoverflow.com/a/20836857
has body: By hint you mean a tooltip? editor.setToolTipText("Tooltip here"); You should be able to find a toolTipText property in the properties for the pane.
has comment: http://stackoverflow.com/comment/31251623
upvote count: 2
answers question: http://stackoverflow.com/q/20836776
accepted answer of: http://stackoverflow.com/q/20836776
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/20776301
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/20776396
has answer: http://stackoverflow.com/a/20776396
type: Question
answer count: 2
has title: if we can make ArrayList synchronized then what is the need of Vector?
accepted answer: http://stackoverflow.com/a/20776321
has body: if we can make ArrayList synchronized then what is the need of Vector? similarly, if we can make HashMap synchronized then what is the need of Hashtable?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20776321
has comment: http://stackoverflow.com/comment/31141219
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/31261222
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20842188
has text: @user2336315 : no because it would handle the cases where there is a streak of more than 2 spaces
type: Comment

http://stackoverflow.com/comment/31169522
score: 2
has text: The order of headers has no importance.
comment on: http://stackoverflow.com/q/20792268
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20686040
has comment: http://stackoverflow.com/comment/30978424
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/20686081
downvote count: 1
has body: Help me please to add some code to finish a logic. I have a some search method(public String search(String url, String someword)) which find a words in content by jsp title. So here a code String[] argi = {"http://www.google.com", "http://www.youtube.com"}; for (int i = 0; i &lt; argi.length; i++) { String result = search(argi[i], "\\b"+word+"\\b"); if (word == null || word.isEmpty()) { str = "Enter a search word!"; } else if(!word.matches("^\\w+$")){ str="Incorrect word!"; } else if (result != null) { str += "Search phrase " + "&lt;b&gt;"+ word + "&lt;/b&gt;" + " have found in " + "&lt;a href=\"" + argi[i] + "\"&gt;" + result + "&lt;/a&gt;"+ "&lt;p&gt;&lt;/p&gt;"; } else if (????????) {str="Word not found!";} } } What should i put in last "else if" to get "str="Word not found!" if i enter to search input some normal word or digit, which is absent in content
favorite count: 0
accepted answer: http://stackoverflow.com/a/20686383
has title: Finish some search logic
tagged with: regex
has answer: http://stackoverflow.com/a/20686383
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20686081
has comment: http://stackoverflow.com/comment/30978807
has comment: http://stackoverflow.com/comment/30978158
type: Question
has comment: http://stackoverflow.com/comment/30978081
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/30978071
has comment: http://stackoverflow.com/comment/30978114

http://stackoverflow.com/comment/31177947
comment on: http://stackoverflow.com/a/20797131
has text: I am not talking about the concept of casting in general - I'm talking about the syntax.
type: Comment
score: 2
type: AnswerComment

rhel5
tags question: http://stackoverflow.com/q/20794862
type: Tag
tag name: rhel5

http://stackoverflow.com/comment/31079661
type: AnswerComment
comment on: http://stackoverflow.com/a/20741373
score: 0
type: Comment
has text: Thanks for your reply. I tried your generic converter, but unfortunately the uuid String is still null...

http://stackoverflow.com/q/20750311
accepted answer: http://stackoverflow.com/a/20750350
answer count: 3
has answer: http://stackoverflow.com/a/20750342
has body: Let's suppose I have a class OuterClass which has a method classMethod() and an nested interface NastedInterface which in its turn has a method callback(). So how can I call the method of the interface callback() in the method of class classMethod()? My goal is to be able to implement OuterClass.NastedInterface in other classes and do some operations in the callback() method, which will be called when the classMethod() will be called in OuterClass. The code will look like something like this. public class OuterClass { public void classMethod(){ if(SOME_CONDITION){ \\ here I want to call the **callback()** method of **NastedInterface** } } public interface NastedInterface { void callback(); } } And the class that will implement this interface should look like something like this. public class TestClass implements OuterClass.NastedInterface { @Override public void callback (){ DO SOMETHING.... } } Basically I want to create a callback mechanism, such as I have used many times in Android. For example the View.OnClickListener or all other such kind of ON_SOMETHINK_LISTENER s. May be I am going in wrong direction, and I need to create such a mechanism in other way?
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/20750342
has comment: http://stackoverflow.com/comment/31095246
has comment: http://stackoverflow.com/comment/31095141
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20750350
tagged with: java
has answer: http://stackoverflow.com/a/20760401
has comment: http://stackoverflow.com/comment/31111993
has comment: http://stackoverflow.com/comment/31095172
has comment: http://stackoverflow.com/comment/31095196
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/31095123
has title: call a method of nested interface from enclosing class
tagged with: callback
favorite count: 0

http://stackoverflow.com/a/20808829
has body: It means its a three dimensional array. It can hold the values like: [ [1,2] [4,5] [2,3], [6,7], ] At above, each values are integer. [1,2] is an array. [1,2] [2,3] is a 2d array.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20808782
type: Answer
downvote count: 0

http://stackoverflow.com/q/20682263
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/30971232
tagged with: dom
has answer: http://stackoverflow.com/a/20682497
type: Question
has title: Java Assign value to an XML Node
has body: I am trying to assign a value to an empty XML node but it doesn't seem to be working. My XML structure is as so: &lt;createCustomer&gt; &lt;customerAttributes&gt; &lt;firstName&gt;&lt;/firstName&gt; &lt;lastName&gt;&lt;/lastName&gt; &lt;/customerAttributes&gt; &lt;/createCustomer&gt; I am trying to assign a first name and surname in the following code: private void createXML(Document skeleton, Map params) { skeleton.getDocumentElement().normalize(); NodeList customerNodes = skeleton.getElementsByTagName("customerAttributes"); for(int i=0; i&lt;customerNodes.getLength(); i++) { NodeList children = customerNodes.item(i).getChildNodes(); for(int j=0; j&lt;children.getLength(); j++) { String childNode = children.item(j).getNodeName(); if(childNode.equalsIgnoreCase("firstName")){ children.item(j).setNodeValue(String.valueOf(params.get("fname"))); System.out.println(children.item(j)); } else if (childNode.equalsIgnoreCase("lastName")){ children.item(j).setNodeValue(String.valueOf(params.get("sname"))); System.out.println(children.item(j)); } } } } } The output of the print statements are: firstname: null surname: null but I know for certain that the values in the map are correct because print statements output the expected map values. Also, if I replace the params.get("string") with a hardcoded string, I still get the output: firstname: null. The code is not throwing any exceptions. I've also tried setTextContent but this doesn't work either
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20682497
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/30971433

http://stackoverflow.com/q/20696108
upvote count: 2
has comment: http://stackoverflow.com/comment/30997028
has comment: http://stackoverflow.com/comment/30997210
score: 2
type: AnsweredQuestion
has title: Why do constructor calls in C++ and Java require explicit type parameters?
tagged with: parametric-polymorphism
tagged with: java
has body: C++ and Java have this similarity in how they handle parametric polymorphism: both will infer the type parameters to regular functions or methods, but require the programmer to explicitly give the type parameters when calling a constructor (Though this was changed in Java 7). What is the technical reason behind this behavior? edit: I mistakenly thought this applied to Scala as well. Here is an example from Java: class Foo&lt;T&gt; { Foo(T x) { } } &lt;T&gt; void foo(T x) { } Foo&lt;Integer&gt; f = new Foo(3); foo(3); both of these are legal, but the first one creates a "raw type" rather than a Foo&lt;Integer&gt;, and performs an unchecked assignment.
type: Question
has answer: http://stackoverflow.com/a/20696793
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/30997022
favorite count: 0
has comment: http://stackoverflow.com/comment/30997192
has comment: http://stackoverflow.com/comment/30997226
tagged with: c++
has comment: http://stackoverflow.com/comment/30997202
accepted answer: http://stackoverflow.com/a/20696793

http://stackoverflow.com/a/20691766
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/30990186
has comment: http://stackoverflow.com/comment/30990361
score: 2
accepted answer of: http://stackoverflow.com/q/20691697
downvote count: 0
has body: The reason this does not work is that you may be calling sc.nextInt() multiple times, when you expect your user to enter only one value. You should store the result in a variable, and use that variable in all your if statements. Alternatively, you could use a switch statement. var userEntry = sc.nextInt(); sc.nextLine(); // skip to the end of the line if ( userEntry == 1 ) { ... } else if ( userEntry == 2 ) { ... } else if ( userEntry == 3 ) { ... } else ... or var userEntry = sc.nextInt(); sc.nextLine(); // skip to the end of the line switch ( userEntry ) { case 1: ... break; case 2: ... break; case 3: ... break; default: ... break; }
answers question: http://stackoverflow.com/q/20691697
upvote count: 2

http://stackoverflow.com/comment/31301392
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20748954
type: Comment
has text: I'd encourage you to roll back the edit to your question and post the new problem as a separate question. Otherwise the answers your already accumulated will be confusing to other readers.

http://stackoverflow.com/q/20843191
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20843709
tagged with: spring
tagged with: spring-mvc
has title: Spring MVC, Form Control for a List of non selectable elements
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: jsp
has body: As the title stated, i was wondering if there is an HTML element for handling a list of non-selectable elements) and how i can use it with Spring MVC. A list of non-selecteable elements is a kind of control that acts as holder of multiple separated values, in fact, described in functional terms, we can thing on a select with multiple="true" with all of his elements selected by default, so all the values are sent to the controller on the {{onSubmit}}. I don't renember is there was a name for that kind of control and if exists in HTML standart FORM (i guess no). (*) For example, suppose that we have a View (called view.jsp), that uses a Bean (called Bean.java) that is created and populted by a controller (called Controler.java, sorry for the cheaps names :D). Let's assume for simplicity that all the wiring stuff is done. Bean.java Class Bean { Collection&lt;String&gt; values; // setters and getters } view.jsp &lt;form:select path="values" items="${values}" /&gt; // (*) the idea is here use the right component, not a select, because a select excludes some values, and i want all values! Controller.java protected ModelAndView onSubmit(final HttpServletRequest request, final HttpServletResponse response, final Object command, final BindException errors) throws Exception { Bean bean = (Bean) command; bean.getValues(); // do my bussiness-model stuff } Well thanks to everyone who read this! And greetings for all! Victor.

http://stackoverflow.com/q/20688267
has comment: http://stackoverflow.com/comment/30985376
tagged with: jtable
has comment: http://stackoverflow.com/comment/30987101
has comment: http://stackoverflow.com/comment/30985255
has comment: http://stackoverflow.com/comment/30983048
score: 0
has comment: http://stackoverflow.com/comment/30986919
has body: Attempting to create a custom JTable structure, I started with a very simple project to better understand. Unfortunately, as soon as I start to customize stuff, I get weird behaviours and I would like you to help me understand them. Thank you very much. Here is my small project : public class Tableau extends JFrame { public Tableau() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800,600); setContentPane(new Panel()); setVisible(true); } public static void main(String[] args) { new Tableau(); } private static class Panel extends JPanel { private JTable table = new Table(4, 4); public Panel() { add(table); } } private static class Table extends JTable { private Renderer randerer = new Renderer(); public Table(int row, int col) { super(new Model(row, col)); setAutoResizeMode(AUTO_RESIZE_OFF); setDefaultRenderer(String.class, randerer); setDefaultEditor(String.class, randerer); } private class Renderer implements TableCellRenderer, TableCellEditor { String previousContent = ""; JTextPane rendererComponent = new JTextPane(); public Renderer() { super();setOpaque(true); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { rendererComponent.setText((String)value); rendererComponent.setBorder(hasFocus ? BorderFactory.createLineBorder(Color.RED) : null); rendererComponent.setBackground(isSelected ? Color.PINK : Color.GREEN); FontMetrics fm = rendererComponent.getFontMetrics(rendererComponent.getFont()); if(((String)value).length()!=0) {rendererComponent.setPreferredSize(new Dimension(fm.stringWidth((String)value),fm.getHeight()));} else {rendererComponent.setPreferredSize(new Dimension(20, fm.getHeight()));} return rendererComponent; } @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { rendererComponent.setText((String)value); rendererComponent.setBackground(isSelected ? table.getSelectionBackgro…
answer count: 0
has comment: http://stackoverflow.com/comment/30983301
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30983340
tagged with: swing
has comment: http://stackoverflow.com/comment/30985280
has title: Customize JTable, unexpected behaviours
type: Question
tagged with: java

http://stackoverflow.com/a/20697421
accepted answer of: http://stackoverflow.com/q/20697132
answers question: http://stackoverflow.com/q/20697132
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Your test is fragile - as pointed out in comments, you're not testing anything about a concrete implementation, but rather the mock. I'm not even convinced you're testing anything at all. Remember: you assert against concrete data; you mock what you absolutely need to. Given that I don't know the full implementation of Constructor, I don't know what it'd take to cause it to fail. I do know, however, there are at least three conditions in which it would fail: Some kind of IOException - likely the file doesn't exist or can't be read Some kind of JsonMappingException - the object can't be mapped to JSON Some kind of JsonParseException - the JSON entity can't be parsed It is good practice to test all of these conditions, to ensure that your code behaves appropriately when any of these exceptions come up. If you don't expect your code to handle it, then it is acceptable for it to throw these exceptions, and when such a situation occurs in your code, you are verifying that the exception was actually thrown. But how do we get to that? Let's start off simple. Suppose we mocked out the instance of the File, and whenever/wherever we decided to read it, we'd get back a string of invalid JSON. That would be a sufficient case to test against - we can't create a file on the host file system (not worth the headache to spin up different files, so simply mocking them out would be acceptable), but we can dictate the data coming from the file. (In the time I've written this answer, you've changed the class name from Constructor to Class. That's not going to fly - there's already a Class object.)
score: 1
upvote count: 1

http://stackoverflow.com/q/20823477
has comment: http://stackoverflow.com/comment/31226434
has answer: http://stackoverflow.com/a/43855946
upvote count: 0
linked to: http://stackoverflow.com/q/38922754
favorite count: 0
has title: Get the Week day List in a Month For specified week day
accepted answer: http://stackoverflow.com/a/20823773
has comment: http://stackoverflow.com/comment/74746514
has answer: http://stackoverflow.com/a/20948518
tagged with: java
has body: I need to prepare a list of week day dates Note :- Week day are not satudrday or sunday, (I can pass the Week day as parameter) I have written following code but not working, Can you please correct the code public static void main (String[] args) { List weekoffDates = new ArrayList&lt;Timestamp&gt;(); Timestamp date = "2013-12-01 00:00:00.0"; //This is timestamp object not string Timestamp endDate = "2013-12-31 00:00:00.0"; //This is timestamp object not string int dayOfWeek = 3 //TuesDay for ( int i =1 ; i&lt;=5; i++ ) { if( ! date.after(endDate) ) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(date.getTime()); calendar.set( Calendar.DAY_OF_WEEK, dayOfWeek ); //This is my parameter //calendar.set( Calendar.WEEK_OF_MONTH, i ); date = new Timestamp( calendar.getTimeInMillis() ); weekoffDates.add(date); dayOfWeek = dayOfWeek +7; System.out.println(date); } System.out.println(weekoffDates); } } EDIT:- date :- 2013:December:1 (I have sent as Timestamp object) EndDate :- 2013:December:31 (I have sent as Timestamp object) dayOfWeek :- This is Day Of Week ( I have sent this parameter as tuesday 3 ) //It will change dynamically Expected Result :- All tuesday in the month of decemer as ArrayListlist Problem :- calendar.set( Calendar.DAY_OF_WEEK, dayOfWeek ); setting is wrong
tagged with: calendar
downvote count: 1
type: Question
tagged with: timestamp
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31226439
score: -1
tagged with: date
has answer: http://stackoverflow.com/a/20823773
has comment: http://stackoverflow.com/comment/31226464
possible better answer: http://stackoverflow.com/a/43855946
answer count: 3

http://stackoverflow.com/comment/31204975
comment on: http://stackoverflow.com/q/20811807
has text: can you post your xml layout as well where you have these fragments
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/31168843
comment on: http://stackoverflow.com/q/20787922
score: 1
type: QuestionComment
has text: <p:fileUpload> in advanced mode already includes a progressbar for each uploaded file. I don't see how you uplate the *progresso* variable. Did you set the filter and filtermapping as described [here](http://stackoverflow.com/questions/8875818/how-to-use-primefaces-pfileupload-listener-method-is-never-invoked) ?
type: Comment

http://stackoverflow.com/a/20782625
has body: Use PackageManager.getInstallerPackageName() to get the package name of application which installed the the application. The value is com.android.vending if the app was installed from Google Play. You can check as shown below: getPackageManager().getInstallerPackageName(getPackageName()).equals("com.android.vending")
upvote count: 1
answers question: http://stackoverflow.com/q/20781987
accepted answer of: http://stackoverflow.com/q/20781987
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/31269885
type: QuestionComment
type: Comment
has text: @DaveRigby is correct, if a node fails, you either have to fail it over to replica partitions (either automatic or manual), or if you don't have replicas configured, then the keys that hash into the partitions that live on the failed node will be inaccessible.
comment on: http://stackoverflow.com/q/20841416
score: 0

jenkins
tags question: http://stackoverflow.com/q/20760039
tag name: jenkins
tags question: http://stackoverflow.com/q/20796003
tags question: http://stackoverflow.com/q/20713157
tags question: http://stackoverflow.com/q/20702930
tags question: http://stackoverflow.com/q/20770818
type: Tag

http://stackoverflow.com/a/20790759
upvote count: 1
answers question: http://stackoverflow.com/q/20790660
type: Answer
downvote count: 0
score: 1
has body: With the guava library, you can use Ints#max. It takes an int[] as argument. You will be better off using a TreeMap (instead of array) for this kind of an application.

http://stackoverflow.com/q/20762495
has title: Java not sending client certificate
favorite count: 0
has comment: http://stackoverflow.com/comment/63672078
has comment: http://stackoverflow.com/comment/31549133
tagged with: apache-httpclient-4.x
has comment: http://stackoverflow.com/comment/78029902
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31126694
has body: I'm using HttpClient 4.2.3 on Java 1.7 to connect to a remote server hosted by nginx. My organization uses PKI extensively, and both the remote and the client have certificates issued by a common CA. The server has a signing chain like the following: CN=Server 123, OU=Servers, OU=My Division, O=My Org, C=US CN=My Division CA, OU=My Division, O=My Org, C=US CN=My Org CA, O=My Org, C=US And the client has a signing chain like the following: CN=Client 456, OU=Servers, OU=My Division, O=My Org, C=US CN=My Division CA, OU=My Division, O=My Org, C=US CN=My Org CA, O=My Org, C=US For some reason, the client does not present its certificate to the server. The server is configured properly (curl with --cert, --key, and --cacert works, for example). The client has its cert, private key, and signing chain in the key store, and the "My Division CA" and "My Org CA" certs (among others) in its trust store. With SSL debugging on, I can see the key store and trust store load successfully. The client can connect to other servers that request certificates correctly. However, when trying to connect to "Server 123", I see something like the following: *** ServerHello, TLSv1 ... ** TLS_RSA_WITH_AES_256_CBC_SHA ... *** Certificate chain ... *** Found trusted certificate: ... *** CertificateRequest Cert Types: RSA, DSS Cert Authorities: &lt;CN=My Division CA, OU=My Division, O=My Org, C=US&gt; &lt;CN=My Org CA, O=My Org, C=US&gt; &lt;CN=Some Other CA, OU=Some Division, O=My Org, C=US&gt; ... *** ServerHelloDone ... *** Certificate chain *** *** ClientKeyExchange, RSA PreMasterSecret, TLSv1 ... HTTP/1.1 400 Bad Request ... No required SSL certificate was sent ... The most confusing part is that other clients with the same software present their certificate and can connect just fine. I have configured all of the infrastructure correctly (to my knowledge), and this should work. I really do not want to write and maintain custom SSL code to fix this.
tagged with: jsse
tagged with: java
tagged with: ssl
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/32789244
downvote count: 0
has comment: http://stackoverflow.com/comment/31192190
score: 4

http://stackoverflow.com/comment/31124601
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20766572
score: 0
has text: Have you checked the `wid` and `hgt` variables value, using breakpoints?

http://stackoverflow.com/a/20834440
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31247478
has comment: http://stackoverflow.com/comment/31247385
upvote count: 2
answers question: http://stackoverflow.com/q/20834417
has body: Java provides the callback mechanism using Observable and Observer. Read javdocs for more: Here is sample taken from: http://www.java2s.com/Code/Java/Design-Pattern/AsimpledemoofObservableandObserver.htm /* * Copyright (c) Ian F. Darwin, http://www.darwinsys.com/, 1996-2002. * All rights reserved. Software written by Ian F. Darwin and others. * $Id: LICENSE,v 1.8 2004/02/09 03:33:38 ian Exp $ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Java, the Duke mascot, and all variants of Sun's Java "steaming coffee * cup" logo are trademarks of Sun Microsystems. Sun's, and James Gosling's, * pioneering role in inventing and promulgating (and standardizing) the Java * language and environment is gratefully acknowledged. * * The pioneering role of Dennis Ritchie and Bjarne Stroustrup, …
has comment: http://stackoverflow.com/comment/31247760
type: Answer
has comment: http://stackoverflow.com/comment/31247403

http://stackoverflow.com/a/66496896
answers question: http://stackoverflow.com/q/20714058
upvote count: 1
has body: First make sure that you are asking the permission for reading the external storage <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> if you want you can the Dexter library for asking permission it is very easy to ask permission using the dexter library here is the link to that Dexter library then after that add the following tag in the <application tag in the manifest android:requestLegacyExternalStorage="true" then the listFiles() function will not return null array
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/20789766
score: 0
answers question: http://stackoverflow.com/q/20788810
has body: Finally, I found a solution to handle the situation. What I did is that if the image size if bigger than the preferred size, then first reduce the size and after that use createScaledBitmap to scale the image to exact size. private Bitmap checkBitmapDetails(int index) { Bitmap bitmap; BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; bitmap = BitmapFactory.decodeResource(getResources(), ImageSources.getImageId(index), options); // Calculate inSampleSize options.inSampleSize = calculateInSampleSize(options, PREFERRED_WIDTH, PREFERRED_HEIGHT); options.inJustDecodeBounds = false; bitmap = BitmapFactory.decodeResource(getResources(), ImageSources.getImageId(index), options); bitmap = Bitmap.createScaledBitmap(bitmap, PREFERRED_WIDTH, PREFERRED_HEIGHT, true); return bitmap; } public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height &gt; reqHeight || width &gt; reqWidth) { final int halfHeight = height / 2; final int halfWidth = width / 2; // Calculate the largest inSampleSize value that is a power of 2 and // keeps both // height and width larger than the requested height and width. while ((halfHeight / inSampleSize) &gt; reqHeight &amp;&amp; (halfWidth / inSampleSize) &gt; reqWidth) { inSampleSize *= 2; } } return inSampleSize; }
type: Answer

http://stackoverflow.com/comment/31209790
type: Comment
has text: +1 for using the correct term - "field", as opposed to the incorrect term - "property", like some other answers.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20814321

http://stackoverflow.com/q/20830382
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20830468
has title: JPanel won't display
tagged with: java
tagged with: jpanel
type: Question
has answer: http://stackoverflow.com/a/20830515
accepted answer: http://stackoverflow.com/a/20830515
answer count: 2
linked to: http://stackoverflow.com/q/9389187
score: 0
has body: I got a class that's supposed to launch a game (with main()), and the game's opening screen. The class with main() (named Starter), that extends JFrame, creates a new OpeningScreen class (extending JPanel), and adds it to the JFrame. For some reason, the OpeningScreen won't be added to the JFrame. Code: Starter class: import javax.swing.*; import java.awt.*; public class Starter extends JFrame { public Starter(){ setSize(500,500); setResizable(false); setTitle("Ping-Pong Battle"); setDefaultCloseOperation(EXIT_ON_CLOSE); OpeningScreen openingS = new OpeningScreen(); add(openingS); setVisible(true); } public static void main(String[]args){ Starter starter = new Starter(); } } OpeningScreen class: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class OpeningScreen extends JPanel { public OpeningScreen(){ setBackground(Color.BLACK); setFocusable(true); setVisible(true); } public void paint(Graphics g){ // Soon code here to be drawn. } public void startGame(){ Board board = new Board(); } } What's the problem? Thanks EDIT: The constructor of OpeningScreen does run, but doesn't paint the background black. Also, trying to draw things in paint() doesn't work.
has comment: http://stackoverflow.com/comment/31239988
has comment: http://stackoverflow.com/comment/31239995
tagged with: swing
possible better answer: http://stackoverflow.com/a/20830468

http://stackoverflow.com/comment/31022300
score: 0
type: Comment
type: QuestionComment
has text: I don't get it. What's the purpose of TopLink if not being an entity manager interface implementation? Sorry if the question is stupid...
comment on: http://stackoverflow.com/q/20704684

http://stackoverflow.com/comment/31131936
comment on: http://stackoverflow.com/a/20770158
has text: but I don't think so that `AES/CBC/PKCS5Padding` is interpreted as `AES/CBC/PKCS7Padding` as if I read [Cipher](http://docs.oracle.com/javase/7/docs/api/javax/crypto/Cipher.html) it is mentioned `AES/CBC/PKCS5Padding (128)` so this must be having some mechanism defined
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31216217
score: 0
comment on: http://stackoverflow.com/a/20817857
type: Comment
type: AnswerComment
has text: yes, i know that, thanks, but what after? what should i write in console when i run a client?If you see a code, when should i get out.println("S ::: "+input);

http://stackoverflow.com/a/20803677
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/20803501
has body: In the example the class name is called TextTransfer. You have renamed it to JP_Clipboard. Either use JP_Clipboard textTransfer = new JP_Clipboard(); or rename the class back to TextTransfer (preferrable - follows Java naming conventions)
type: Answer

http://stackoverflow.com/q/20732397
has comment: http://stackoverflow.com/comment/31063099
tagged with: android-relativelayout
tagged with: android
possible better answer: http://stackoverflow.com/a/20732608
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31062948
has title: Relativeview 5 buttons, don't understand my mistake
has answer: http://stackoverflow.com/a/20732827
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31062878
tagged with: java
score: -1
answer count: 2
accepted answer: http://stackoverflow.com/a/20732827
upvote count: 0
has body: I'm trying to make myself an app to track my progress at the gym since it's one of my new year resolution... I don't go to the gym, and I figure that if I can track progress, i could have some interest in going back. Here's my issue: I'm doing my main layout right now, and I want one large button that says: Start workout. I would like to have 4 buttons centered next to each other with some spaces between each other and the four together would have the form of a square. I wrote this code, and nothing is working at all right now. I just don't even know where to look anymore. I know I could use LinearLayout but I read everywhere that RelativeLayout should be prioritize &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical"&gt; &lt;Button android:id="@+id/start_workout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:hint="@string/start_workout" /&gt; &lt;Button android:id="@+id/log_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:hint="@string/log_button" /&gt; &lt;Button android:id="@+id/progress_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:hint="@string/progress_button" /&gt; &lt;Button android:id="@+id/cardio_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/calendar_button" android:layout_below="@id/progress_button" android:hint="@string/cardio_button" /&gt; &lt;Button android:id="@+id/calendar_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@+id/cardio_button" android:layout_below="@+id/log_button" android:hint="@string/calendar_button" /&gt…
favorite count: 0
has answer: http://stackoverflow.com/a/20732608

http://stackoverflow.com/comment/31077561
has text: Please do your own homework
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20740767
score: 1

http://stackoverflow.com/a/20781761
downvote count: 1
has comment: http://stackoverflow.com/comment/31150660
type: Answer
has body: The url "jdbc:mysql://localhost:3306/mydb". You lost the port 3306.
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/31150616
answers question: http://stackoverflow.com/q/20781588
has comment: http://stackoverflow.com/comment/31150631

http://stackoverflow.com/comment/31235827
score: 0
type: Comment
has text: if you return cell; then mouse click will work fine ,do you want to achieve some thing else ?
comment on: http://stackoverflow.com/a/20823085
type: AnswerComment

http://stackoverflow.com/a/66686336
answers question: http://stackoverflow.com/q/20748280
has body: There's a shortcut for filling all the values of a particular row. -> Arrays.fill(Dictionary[i],"value"); If you want to fill the whole 2D array. for(String[] array : Dictionary) Arrays.fill(array,"value"); By this logic, you can fill any dimension array instead of iterating and assigning each value.
type: Answer
score: 0

http://stackoverflow.com/a/20713348
answers question: http://stackoverflow.com/q/20713229
score: 0
type: Answer
has body: There is no harm in using while (true) { ... } in a servlet because the example is simple. All it does it waits for the next message and then prints it out. In more complex applications, there is typically a thread dedicated to just reading the messages and a thread pool to process the messages. while (true) { QueueingConsumer.Delivery delivery = consumer.nextDelivery(); String message = new String(delivery.getBody()); process(message); // performs the processing in another thread } The reason you another thread is used for processing is to avoid filling up the message buffer while a message is being processed. If only 1 thread is used for reading from the queue and processing, new messages won't be read until the processing is complete. This can result in the queue buffer overflowing.

http://stackoverflow.com/comment/31033775
score: 0
type: AnswerComment
has text: Even better as I don't need to add the apostrophe in the second part, thanks.
type: Comment
comment on: http://stackoverflow.com/a/20716573

http://stackoverflow.com/q/20823272
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23034193
has body: When I export my JMX agent for remote management, and set the following parameters as VM arguments -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false It works fine as my JMX client is able to easily establish connection with the MBean at port 9999. Now, I want to set these properties at run time via my configuration file. I tried setting it via System.setProperty("com.sun.management.jmxremote.port","9999"); and other properties similarly but to no avail. The JMX Agent doesn't get exposed for remote management in this way. I even tried creating a registry on the port 9999 but still doesn't seem enough. private void init() { try { LocateRegistry.createRegistry(9999); System.setProperty("com.sun.management.jmxremote", "true"); System.setProperty("com.sun.management.jmxremote.authenticate", "false"); System.setProperty("com.sun.management.jmxremote.port", "9999"); System.setProperty("com.sun.management.jmxremote.ssl", "false"); } catch (RemoteException e) { e.printStackTrace(); } } I just don't understand why setting these properties via VM arguments works and not while setting the same properties programatically as I described above.
has answer: http://stackoverflow.com/a/32502973
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/20825424
tagged with: jvm-arguments
favorite count: 0
has title: Facing issues while setting JVM properties for JMX remote management
type: UnansweredQuestion
tagged with: jmx
has answer: http://stackoverflow.com/a/20912148
answer count: 4

http://stackoverflow.com/comment/31142043
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20776645
has text: Thank you I guess import is what I was looking for. @user1896769 How is a package defined? Is it defined by the folder that it's in? Do subfolders also get automatically included?
score: 0

http://stackoverflow.com/a/20794844
type: Answer
has comment: http://stackoverflow.com/comment/31204619
answers question: http://stackoverflow.com/q/20794587
score: 0
has body: I know following is not an answer to your question by my feedback and observation is too long to be described in comment section. So SORRY for this. Couldn't get what exactly you problem is. But after going through your code I have following beservation: First two call to r2.nextInt(JokeAArray.length); in onCreate() and onClick() respectively are of no use because you are not using the generated random numbers. Where as in updateJokeTextView() you are calling jq = r1.nextInt() as well as ja = r1.nextInt() both will generate two different random numbers which is again of no use because your question and answer will never match. In updateJokeTextView(), instead of txtJokeA.setText(JokeAArray[ja].toString()); use txtJokeA.setText(JokeAArray[jq].toString()); Hope this solves you problem. If it doesn't, then please mention what exactly you want from your code.

http://stackoverflow.com/q/20701320
has answer: http://stackoverflow.com/a/20701413
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20701367
upvote count: 8
possible better answer: http://stackoverflow.com/a/20701413
answer count: 4
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20701367
has answer: http://stackoverflow.com/a/20701440
has title: Eclipse: Find call tree of a method
has body: I know that Ctrl + Shift + G gives an output of all the methods that call directly the method I'm searching for. But how can I find the whole tree and not just the caller method. I want to output the whole call chain of a method (caller's caller etc), from the method it first started until the one I'm searching for.
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/20701372
type: Question
has comment: http://stackoverflow.com/comment/31008504

http://stackoverflow.com/q/20836400
answer count: 1
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/31251484
has body: I would like to display multiple texts in a text wizard container. I have used the setText method but it displays only the last text. Please can someone gives me a solution
favorite count: 0
upvote count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: swt
has comment: http://stackoverflow.com/comment/31251394
has comment: http://stackoverflow.com/comment/31250637
has title: How can i display multiple texts in text container of a wizard
has comment: http://stackoverflow.com/comment/31251023
has answer: http://stackoverflow.com/a/20837111
tagged with: java
has comment: http://stackoverflow.com/comment/31251165
type: Question
score: -2

http://stackoverflow.com/a/20838739
has comment: http://stackoverflow.com/comment/31259794
answers question: http://stackoverflow.com/q/20828257
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: You're referring to the API responses, right? Those are (US) English only. It's good practice to map PayPal API error responses to an appropriate customer-facing message on your end (which can of course be in any language you'd like). I wouldn't recommend exposing PayPal API error responses directly to a customer.
accepted answer of: http://stackoverflow.com/q/20828257

http://stackoverflow.com/comment/119463259
score: 0
type: AnswerComment
type: Comment
has text: @manikantanvsr only if Address has mutable fields. The Student field to an Address instance s declared final, thus it can't be changed. I was proposing a general way of thinking about classes, not just the implementation of one class.
comment on: http://stackoverflow.com/a/23826374

http://stackoverflow.com/comment/31106334
type: Comment
has text: Hi Sujith, i already accept but it said wait 2 minutes. now accepted sujith.
comment on: http://stackoverflow.com/a/20756306
type: AnswerComment
score: 0

http://stackoverflow.com/a/20746139
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/20746050
has body: put this line as the first statment in your paint method super.paint(g); it will be good to place also Graphics2D g2 = (Graphics2D)g; after above statment to use the improved performance and extra methods offered by Graphics2D
score: 2

http://stackoverflow.com/a/77418708
answers question: http://stackoverflow.com/q/20703450
has body: This may be very belated, but probably useful for somebody. For all labels you just have to hide tick labels like that: CategoryPlot barChart = getNewBarchart(); // This will be your code-specific CategoryAxis axis = barChart.getDomainAxis(); axis.setTickLabelsVisible(false); To hide only some I am pretty sure you will have to extend the CategoryAxis class and override the refreshTicks method
score: 0
type: Answer

uri
tags question: http://stackoverflow.com/q/20790613
tags question: http://stackoverflow.com/q/20778499
tag name: uri
tags question: http://stackoverflow.com/q/20800360
tags question: http://stackoverflow.com/q/20738796
type: Tag
tags question: http://stackoverflow.com/q/20713522
tags question: http://stackoverflow.com/q/20692661

http://stackoverflow.com/comment/31057119
type: QuestionComment
has text: Trying to debug is the most elegant answer for all these type of problems
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20729339

http://stackoverflow.com/a/20763502
type: Answer
has body: yes, we can 'overload' main method in java even in the same class you can something like public static void main(int arr[]) or public static void main(float f) but when you execute your application, JVM will search for main method with String[] args i.e. public static void main(String[] args)
answers question: http://stackoverflow.com/q/20763456
score: 0

http://stackoverflow.com/comment/31233465
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20827022
has text: to the html rendered to your web browser

http://stackoverflow.com/comment/31158684
comment on: http://stackoverflow.com/a/20780297
type: Comment
has text: Even when creating a new instance of the Book object I still get the same results. I believe it's because my two for-loops are nested within a while-loop, therefore I keep editing the same instance of the object Book, since it's instanced within the while loop. Therefore a new instance is created with every while. Am I right?
type: AnswerComment
score: 0

http://stackoverflow.com/q/20791532
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/20791555
tagged with: exception
type: UnansweredQuestion
has title: using a try but still having a exception
tagged with: java
has body: Good morning. I have a method "insert" in a "table" class. in this method i take the members of the class and i write them on the db with a preparedStatement. i whould that the "insert" throw a SQLException if the things goes wrong. this is the source: public void insert() throws SQLException { PreparedStatement sqlCommand = null; try { sqlCommand = this.db.prepareStatement(prepareInsertQuery()); sqlCommand.execute(); } finally { if (sqlCommand!=null) { sqlCommand.close(); } } } this is a problem: if i put a "catch SQLException" block,i must handle the exception INSIDE my method, and i don't want it (i want to put exception handling in main program, for logging). if i don't put a "catch SQLException", the exception will be ignored. how can i do to close the sqlCommand but if i get a exception, to propagate it? thank you!
has comment: http://stackoverflow.com/comment/31168141
has answer: http://stackoverflow.com/a/20791664

http://stackoverflow.com/a/20790447
type: Answer
answers question: http://stackoverflow.com/q/20790360
has body: abstraction is great when the original programmer/architect want's to allow customized behavior to some base class and ensure that the consuming programmer implements the required methods.
score: 0

http://stackoverflow.com/a/20834375
answers question: http://stackoverflow.com/q/20834353
has comment: http://stackoverflow.com/comment/31247353
score: 4
has body: If you do not have any parameterized constructor and I strictly mean no constructor then and only then java will add a default constructor(One with no parameters) for you. Each constructor must call a constructor of it's super class. You cannot perform any other action in the subclass constructor untill all constructors of superclasses up the inheritance tree are called. Hence this call must be the 1st line of your subclass constructor If you do not provide one again java does that for you. Refer Why does this() and super() have to be the first statement in a constructor?
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20834353
type: Answer

http://stackoverflow.com/comment/31164346
has text: Thanks antiduh but PLEASE vote up @uckleman 's comment as well!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20789352
type: AnswerComment

http://stackoverflow.com/a/20820845
answers question: http://stackoverflow.com/q/20820155
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31228784
has comment: http://stackoverflow.com/comment/31232544
has body: The h:messages is for so-called global messages which are unrelated to a specific component and therefore the for attribute is not allowed here. The h:message is for messages related to a specific component, therefore the for attribute is required, this means you need a component to bind to. To reach your goal you can use two h:message elements bound to some component (e.g. an empty h:grapicImage) in the following way: &lt;h:graphicImage id="someID" /&gt; &lt;h:message for="someID" id="container-messages" infoClass="info-message" warnClass="warn-message" errorClass="error-message"/&gt; &lt;div&gt; stuff &lt;/div&gt; &lt;h:message for="someID" id="aside-messages" infoClass="info-message" warnClass="warn-message" errorClass="error-message" /&gt; Adding the messages in the way you already described: facesContext.addMessage("container-messages", new FacesMessage(FacesMessage.SEVERITY_INFO, "message1", null)); facesContext.addMessage("aside-messages", new FacesMessage(FacesMessage.SEVERITY_INFO, "message2", null)); See also: What does h:messages do in JSF? jsf h:messages/ h:message for specific clientId
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20820155

http://stackoverflow.com/a/24034972
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20808679
has body: Use below code to convert your .xls or .xlsx file to xml. import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.w3c.dom.Document; import org.w3c.dom.Element; public class ImportDataFromXLStoXML { public ImportDataFromXLStoXML() { } public void displayFromExcel(String xlsPath) { InputStream inputStream = null; try { inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; try { // Initializing the XML document DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element rootElement = document.createElement("categories"); document.appendChild(rootElement); fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); Integer count = workBook.getNumberOfSheets(); ArrayList&lt;ArrayList&lt;String&gt;&gt; data = new ArrayList&lt;ArrayList&lt;String&gt;&gt;();…

http://stackoverflow.com/q/20790289
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/31165931
answer count: 5
linked to: http://stackoverflow.com/q/1806816
has answer: http://stackoverflow.com/a/20790331
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20790373
favorite count: 0
has comment: http://stackoverflow.com/comment/31165759
has comment: http://stackoverflow.com/comment/31165911
has answer: http://stackoverflow.com/a/20790426
type: Question
has title: Finding the largest number in an array
has answer: http://stackoverflow.com/a/20790444
has comment: http://stackoverflow.com/comment/31165746
score: -2
has comment: http://stackoverflow.com/comment/31165888
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/31165846
has comment: http://stackoverflow.com/comment/31173199
has body: I'm trying to figure how to find the largest number in an array of random numbers. So far I cant manage to get it right. Its an array[50] and the random, numbers are between 0-100. Thanks!
has answer: http://stackoverflow.com/a/20790417
has comment: http://stackoverflow.com/comment/31165828
tagged with: algorithm

http://stackoverflow.com/comment/31063616
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20732809
score: 1
has text: What does `x` reference to here?

http://stackoverflow.com/comment/31001680
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20693073
has text: I would like to know if Java/JavaFx should clean / destruct Tab right after it is closed and / or removed from TabPane, that is it.
score: 0

http://stackoverflow.com/comment/31063050
type: Comment
comment on: http://stackoverflow.com/a/20712470
has text: @templatetypedef, it's the same bound as the one you give. Look at the plot I added, in fact n2^n is larger for n >= 3. But the only thing that matters is that they approach a constant (in this case 1) as n->infinity meaning they have the same big-O time complexity.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31171054
score: 0
type: Comment
has text: yep thank you for the code and explication but I want to move just the two circles is this possible with my code?
comment on: http://stackoverflow.com/a/20792984
type: AnswerComment

http://stackoverflow.com/q/20775501
answer count: 1
has comment: http://stackoverflow.com/comment/31139792
linked to: http://stackoverflow.com/q/414001
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/31139706
has answer: http://stackoverflow.com/a/20775607
has body: import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; public class CSVReader { public static void main(String[] args) { CSVReader obj = new CSVReader(); obj.run(); } public void run() { String CSVFile = "/Users/Wyatt/CSVFile2.csv"; BufferedReader br = null; String Line = ""; String analysisStr; String CSVDelimiter = ","; int analysis; double AVGDate = 0; BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); try { br = new BufferedReader(new FileReader(CSVFile)); while ((Line = br.readLine()) != null) { String[] Weather = Line.split(CSVDelimiter); System.out.println("Weather [Date: " + Double.parseDouble(Weather[0]) + ", Interval: " + Double.parseDouble(Weather[1]) + ", Rainfall: " + Double.parseDouble(Weather[2]) + ", Sunlight: " + Double.parseDouble(Weather[3]) + ", Time: " + Double.parseDouble(Weather[4]) + ", Total: " + Double.parseDouble(Weather[5]) + ", Overall: " + Double.parseDouble(Weather[6]) + "]"); AVGDate = (Double.parseDouble(Weather[0]) / 804); System.out.println(AVGDate); } System.out.println("What data is wanted?"); analysisStr = console.readLine(); analysis = Integer.parseInt(analysisStr); if(analysis == 0) { System.out.println("Date."); System.out.println("Minimum date is:"); System.out.println("Maximum date is:"); System.out.println("Average date is: " + AVGDate); } else if(analysis == 1) { System.out.println("Interval."); System.out.println("This data isn't useful."); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } System.out.println("Done."); } } Heading The program above reads the file correctly, reads and prints out all the records but for my average date it is calculating each individual records date instead of calculating all the dates together, I am a novice…
type: UnansweredQuestion
tagged with: file
tagged with: java
has title: Printing out specific data and calculations when multiple records in a CSV file
type: Question
score: 0

http://stackoverflow.com/comment/31212548
has text: @HotLicks: it is *not* valid. There is a literal newline inside json string (between quotes). You might have removed the newline on copy-paste. Or OP doesn't use ` ` or other format preserving tags.
score: 0
comment on: http://stackoverflow.com/q/20811214
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31148336
comment on: http://stackoverflow.com/q/20779899
has text: search for <partition type="__java_javadoc"/> on http://help.eclipse.org/kepler/index.jsp gived no results, but on Juno http://help.eclipse.org/juno/index.jsp returns "JavaScript Completion Proposal Computer" & "Java Completion Proposal Computer
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20816992
answers question: http://stackoverflow.com/q/20816800
type: AcceptedAnswer
downvote count: 0
has body: First Of All, you haven't told where did the "block" in the if statement came from. What you may need to do, is: public void swap(){ for(Entity en:entityList){ if((en instanceof Block)&amp;&amp;(en.position.equals(agent.position)){ // ^here is "en" instead of block System.out.println("Agent overlab block: "+en); en.previousPosition=new Dimension( en.position.width, en.position.height); en.setPosition(agent.previousPosition); } } } At last, you may use java.awt.Point instead of Dimension. Also, you should use setter method for the field "previousPosition".
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20816800

http://stackoverflow.com/comment/31128147
comment on: http://stackoverflow.com/q/20768653
score: 0
has text: http://stackoverflow.com/questions/9477354/how-to-allow-introducing-only-digits-in-jtextfield does this help? Let me know.
type: QuestionComment
type: Comment

executorservice
type: Tag
tags question: http://stackoverflow.com/q/20691933
tag name: executorservice
tags question: http://stackoverflow.com/q/20759129

http://stackoverflow.com/q/20710946
has body: Im trying to complete the Project Euler question and attempting to do a recursive solution, but I am getting Stack overflow Error and cant seem to figure out why. Any help would be great. Thanks public class Collatz { public static void main(String[] args) { List&lt;Integer&gt; length = new ArrayList&lt;Integer&gt;(); for(int i = 13; i &lt; 1000000; i++){ length.add(collat(i, 0)); } } public static int collat(int x, int c){ if(x == 1){ return c; } if(x % 2 == 0){ return collat(x/2, c + 1); }else{ return collat((3 * x) + 1, c + 1); } } }
has title: Can anybody explain to me why I am getting Stack Overflow Error?
has answer: http://stackoverflow.com/a/20710998
has comment: http://stackoverflow.com/comment/31023361
has comment: http://stackoverflow.com/comment/31023273
downvote count: 3
has comment: http://stackoverflow.com/comment/31023572
has comment: http://stackoverflow.com/comment/31023310
possible better answer: http://stackoverflow.com/a/20711054
has comment: http://stackoverflow.com/comment/31023285
has answer: http://stackoverflow.com/a/20711054
tagged with: recursion
has comment: http://stackoverflow.com/comment/31023435
has comment: http://stackoverflow.com/comment/31023324
linked to: http://stackoverflow.com/q/2643260
has comment: http://stackoverflow.com/comment/31024094
has comment: http://stackoverflow.com/comment/31023860
tagged with: java
has comment: http://stackoverflow.com/comment/31023531
has comment: http://stackoverflow.com/comment/31023399
accepted answer: http://stackoverflow.com/a/20711456
has comment: http://stackoverflow.com/comment/31023392
has answer: http://stackoverflow.com/a/20711411
has comment: http://stackoverflow.com/comment/31023485
has comment: http://stackoverflow.com/comment/31023666
linked to: http://stackoverflow.com/q/3700459
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31024363
has comment: http://stackoverflow.com/comment/31023333
linked to: http://stackoverflow.com/q/860550
has comment: http://stackoverflow.com/comment/31023343
has comment: http://stackoverflow.com/comment/31023219
favorite count: 0
type: Question
score: 3
upvote count: 6
has comment: http://stackoverflow.com/comment/31023263
has comment: http://stackoverflow.com/comment/31023608
has answer: http://stackoverflow.com/a/20711456

http://stackoverflow.com/a/20755170
has comment: http://stackoverflow.com/comment/31157077
has comment: http://stackoverflow.com/comment/31105738
type: Answer
has comment: http://stackoverflow.com/comment/31104543
has comment: http://stackoverflow.com/comment/31104564
has comment: http://stackoverflow.com/comment/31157107
answers question: http://stackoverflow.com/q/20755124
upvote count: 3
has comment: http://stackoverflow.com/comment/31104696
has comment: http://stackoverflow.com/comment/31104676
has body: You have JSONObject json = jParser.getJSONFromUrl(url); And in JSONParser HttpResponse httpResponse = httpClient.execute(httpPost); Running NetworkRelated operation on the ui thread. Use AsyncTask or Thread http://developer.android.com/reference/android/os/AsyncTask.html new TheTask().execute(params); Then class TheTask extends AsyncTask&lt;Void,Void,Void&gt; { protected void doInbackground(Void... params) { // your http request return null; } } You can make asynctask an inner class of fragment and update ui in onPostExecute Edit: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_qm, container, false); new TheTask().execute(url); return rootView; } Then class TheTask extends AsyncTask&lt;String,String,String&gt; { @override protected String doInbackground(String... params) { String _response =null; try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(params[0]); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); _response=EntityUtils.toString(httpEntity); }catch(Exception e) { e.printStacktrace(); } return _response; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); Log.i(".......",result); } }
score: 3
has comment: http://stackoverflow.com/comment/31104569
has comment: http://stackoverflow.com/comment/31157148
has comment: http://stackoverflow.com/comment/31104581
has comment: http://stackoverflow.com/comment/31105447
has comment: http://stackoverflow.com/comment/31104091
accepted answer of: http://stackoverflow.com/q/20755124
has comment: http://stackoverflow.com/comment/31157178
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20779010
favorite count: 0
linked to: http://stackoverflow.com/q/8738369
has answer: http://stackoverflow.com/a/20779046
has comment: http://stackoverflow.com/comment/31146275
upvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/20779131
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5369682
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20779146
type: Question
linked to: http://stackoverflow.com/q/567659
has body: I am trying to do something on time-updation in Android. My specification is: When i compile the project my activity must display two edittext fields. Assume todays date is 26/DEC/2013 first edittext field must display that and for the next exit text field it must display 2/JAN/2014 This means the edit text must dynamically update time from today(first-edit-text) till next 7 days(second-edit-text) Snapshot: I just have basic code structure: 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;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1" android:layout_alignBottom="@+id/textView1" android:layout_alignParentRight="true" android:layout_marginRight="18dp" android:ems="10" /&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textView1" android:layout_alignLeft="@+id/editText1" android:ems="10" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="18dp" android:text="From" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/textView2" android:layout_below="@+id/textView2" android:layout_marginTop="68dp" android:text="To" /&gt; &lt;/RelativeLayout&gt; MainActivity.java public class MainActivity…
downvote count: 0
accepted answer: http://stackoverflow.com/a/20779131
has answer: http://stackoverflow.com/a/20779090
has title: Dynamically updating time in android
tagged with: android
possible better answer: http://stackoverflow.com/a/20779090

http://stackoverflow.com/comment/31029618
comment on: http://stackoverflow.com/a/20713495
score: 0
has text: My other point was that you probably should check whether you can move in a direction *before* you move in that direction, rather than after you have moved in that direction. Your code is modifying x or y before checking whether that modification is "legal".
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31235269
type: QuestionComment
has text: can you use [`BigInteger`](http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html)?
score: 2
comment on: http://stackoverflow.com/q/20828143
type: Comment

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

http://stackoverflow.com/comment/31046798
score: 0
has text: @kba Sorry ! My mistake. I editted. Thank you!
type: QuestionComment
comment on: http://stackoverflow.com/q/20723607
type: Comment

http://stackoverflow.com/comment/31159392
score: 0
type: AnswerComment
has text: arrayObjects_hosp[] is an array of different arrays.. arrayObjects_hosp[0] is string array & arrayObjects_hosp[1] is double array
comment on: http://stackoverflow.com/a/20786182
type: Comment

http://stackoverflow.com/q/20732915
possible better answer: http://stackoverflow.com/a/20741373
has answer: http://stackoverflow.com/a/20807355
has body: I am using a Primefaces selectManyCheckbox within an editable Datatable like this one. When the user clicks the edit button, he is able to select between different Documents in the Documents-Column. That is my code. Please note the converter I am using: &lt;p:dataTable id="tbl" styleClass="fixedLayoutTable no-highlight dblclick-edit edit-commit-others" value="#{cc.attrs.manager.mg}" var="mg" emptyMessage="#{msgs.noManager}" editable="true" widgetVar="tbl"&gt; &lt;p:column headerText="Documents"&gt; &lt;p:cellEditor&gt; &lt;f:facet name="output"&gt; &lt;h:outputText value="#{msgs.noDocs}" rendered="#{mg.docs.size() == 0}" /&gt; &lt;h:outputText value="#{mg.docs.toArray()[0].fileName}" rendered="#{mg.docs.size() &gt; 0}" /&gt; &lt;/f:facet&gt; &lt;f:facet name="input"&gt; &lt;p:selectManyCheckbox id="chkDoc" value="#{mg.docs}" layout="pageDirection" converter="myConverter" collectionType="java.util.HashSet"&gt; &lt;f:selectItems value="#{cc.attrs.manager.docs}" var="d" itemValue="#{d}" itemLabel="#{d.fileName}" /&gt; &lt;/p:selectManyCheckbox&gt; &lt;/f:facet&gt; &lt;/p:cellEditor&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; In another Tab of the application (lets call it Tab1) the user is able to upload some Documents. These documents were added to the cc.attrs.manager.docs-List in the backing bean, but won't get persisted in the database yet. If the user uploads some documents in Tab1 and goes to Tab2 (the tab with the datatable), he should be able to select between all documents including the recently added ones. So the user clicks on the edit button, all the documents appear in the SelectManyCheckbox. If the user selects these documents and clicks the ✔-Sign my Converter gets called. I followed this example to implement the Converter. Here is a Code Snippet of this class: @FacesConverter(value="myConverter") public class MyConverter implements Converter { @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { if (component i…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20807355
tagged with: jsf
downvote count: 0
tagged with: primefaces
score: 1
tagged with: java
type: Question
tagged with: jsf-2
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/20741373
favorite count: 0
tagged with: selectmanycheckbox
has title: Primefaces selectManyCheckbox withing editable Datatable submitting null to Converter

http://stackoverflow.com/a/20773387
upvote count: 1
has body: If you want an apply method that is usable in Scala you should implement it on the scala an side using object to wrap your java class with the same name of the class which instantiate it object OutPin { def apply(pinNumber :Int) = new OutPin(pinNumber) }
type: Answer
answers question: http://stackoverflow.com/q/20771996
downvote count: 0
score: 1

http://stackoverflow.com/comment/31005658
type: Comment
comment on: http://stackoverflow.com/q/20701477
type: QuestionComment
has text: There's more than one programming language out there - maybe we can tell you more about the syntax error, if you tell us something about the compiler (= language) you use...
score: 0

http://stackoverflow.com/comment/31350080
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20789369
has text: I added the code. `hashCode()` only exists for `file` entity.
score: 0

http://stackoverflow.com/comment/86648718
type: Comment
has text: While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value.
comment on: http://stackoverflow.com/a/49816806
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31213147
score: 1
has text: PLs Add what U tried..??
comment on: http://stackoverflow.com/q/20816349
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20730002
has body: As u r new in android I recommend u to study first How to post status from ur app to facebook u need a library easyfacebookandroidsdk.jar and build it up in ur project use this code : public class MainActivity extends Activity implements LoginListener{ EditText et1; private FBLoginManager fbLoginManager; Button b; //replace it with your own Facebook App ID public final String FacebookTesting="218874471621782"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et1=(EditText)findViewById(R.id.editText1); b=(Button)findViewById(R.id.button1); connectToFacebook(); } public void connectToFacebook(){ //read about Facebook Permissions here: //http://developers.facebook.com/docs/reference/api/permissions/ String permissions[] = { // "user_about_me", // "user_activities", // "user_birthday", // "user_checkins", // "user_education_history", // "user_events", // "user_groups", // "user_hometown", // "user_interests", // "user_likes", // "user_location", // "user_notes", // "user_online_presence", // "user_photo_video_tags", // "user_photos", // "user_relationships", // "user_relationship_details", // "user_religion_politics", // "user_status", // "user_videos", // "user_website", // "user_work_history", // "email", // // "read_friendlists", // "read_insights", // "read_mailbox", // "read_requests", // "read_stream", // "xmpp_login", // "ads_management", // "create_event", // "manage_friendlists", // "manage_notifications", // "offline_access", // "publish_checkins", "publish_stream", // "rsvp_event", // "sms", //"publish_actions", // "manage_pages" }; fbLoginManager = new FBLoginManager(this, R.layout.activity_main, FacebookTesting, permissions); if(fbLoginManager.existsSavedFacebook()){ fbLoginManager.loadFacebook(); } else{ fbLoginManager.login(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenu…
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20728207

http://stackoverflow.com/q/20720955
has comment: http://stackoverflow.com/comment/31041585
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/31041674
has comment: http://stackoverflow.com/comment/31041741
tagged with: restlet
score: 0
has comment: http://stackoverflow.com/comment/31041702
has comment: http://stackoverflow.com/comment/31041767
answer count: 1
has answer: http://stackoverflow.com/a/20721206
has comment: http://stackoverflow.com/comment/31041654
has comment: http://stackoverflow.com/comment/31041680
has comment: http://stackoverflow.com/comment/31041724
has title: Sending JSON by POST using Restlet results in "400 Bad request" error
has body: When trying to send a JSON object to the server using POST method, "400 Bad request" error is returned. Standard Java application (SDK) with Restlet api is used to make this request. Given that the: host address is "http://myhostname.com/api/v1/parts/" access_key is "8QON4KC7BMAYYBCEX" here is how the code so far looks like: ClientResource resource = new ClientResource("http://myhostname.com/api/v1/parts/"); resource.setMethod(Method.POST); resource.getReference().addQueryParameter("format", "json"); resource.getReference().addQueryParameter("access_key", "8QON4KC7BMAYYBCEX"); // create json object and populate it JSONObject obj = new JSONObject(); try { obj.put("partId", "23"); obj.put("carId", "34"); obj.put("name", "chassis"); obj.put("section", "frame"); } catch (JSONException e1) {// handling of exception} StringRepresentation stringRep = new StringRepresentation(obj.toString()); stringRep.setMediaType(MediaType.APPLICATION_JSON); try { resource.post(stringRep).write(System.out); // exception occurs here } catch (Exception e) {// handling of exceptions } Response from server is "400 Bad request". Here is the console output: Bad Request (400) - BAD REQUEST at org.restlet.resource.ClientResource.doError(ClientResource.java:612) at org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1202) at org.restlet.resource.ClientResource.handle(ClientResource.java:1069) at org.restlet.resource.ClientResource.handle(ClientResource.java:1044) at org.restlet.resource.ClientResource.post(ClientResource.java:1453) at tests.RESTTestReceiverPOST.main(RESTTestReceiverPOST.java:39) When using Chrome POSTMAN plugin to send this json object (and it works with POSTMAN), the output of the POST request looks like this: /api/v1/parts/?format=json&amp;access_key=8QON4KC7BMAYYBCEX HTTP/1.1 Host: myhostname.com Content-Type: application/json { "partId": "23", "carId": "34", "name": "chassis", "section": "frame" } Any suggestions on what may be wrong in the code? Thanks.
has comment: http://stackoverflow.com/comment/31041809
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20721206
tagged with: java
has comment: http://stackoverflow.com/comment/31041735
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/31100894
type: Comment
has text: In cases where you have a long running process which the class itself implements, it can also help to ensure data integrity, by denying access to change the values while the process is spinning. It's a sub-set of the validation case, but a very important one.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20753376

http://stackoverflow.com/comment/31140725
type: QuestionComment
type: Comment
has text: You forgot to add the additional supporting code.
comment on: http://stackoverflow.com/q/20773657
score: 0

http://stackoverflow.com/comment/31208568
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20810113
type: QuestionComment
has text: Not just post your code, but can you also explain the logic of your code?

http://stackoverflow.com/comment/31187922
comment on: http://stackoverflow.com/q/20802499
score: 0
type: Comment
type: QuestionComment
has text: I have a locker numbers from 2149 - 2217. I create a text fields to set the numbers. now, if the user wants to rent it, it will be saved in db. my problem is, if the number is rented, the textfield's color will turn to red, if not. it will be back at green

http://stackoverflow.com/a/20702460
has comment: http://stackoverflow.com/comment/31008246
has comment: http://stackoverflow.com/comment/31675557
score: 0
has comment: http://stackoverflow.com/comment/31014345
has comment: http://stackoverflow.com/comment/31008326
answers question: http://stackoverflow.com/q/20702174
has body: I can only give you a general idea since I'm not a java programmer. First distinguish between gate and a tree node. Preperation: 1) Implement each gate as a class/object. It has to have 2 attribures: input A, input B and a way to calculate result; 2) Implement a tree. Each node is a pair (gate, next_node). Root is a node with next_node being null. Leaves are nodes such that no other node points to it. 3) Use a shared (thread safe) queue of nodes. It is initially empty. 4) There is a fixed number (pick one, does not depend on number of gates) of threads which continuously wait for an element from the queue (unless the result is reached in which case they just quit). Loop: 1) Whenever an input occures on a node put the node in a queue (at the begining inputs go to leaves). This can be simply implemented by defining add_input method on a gate. 2) A thread picks up a node from queue: 3.1) If one of the input is missing discard it (it will be there one more time when second input appears). Another idea is to put the node in a queue only when both inputs are there. 3.2) If both inputs are there, then calculate result and pass it to next_node if it is not null (and put next_node in the queue). If next_node is null, then this is your result - break the loop and finalize. I'm saying "loop" although there is no real loop there. Threads waiting for nodes is the loop. So basically this idea is a reverse of yours. In your idea you start with root and recursively calculate inputs. In my idea you start with leaves, calculate values and push it to higher nodes. Since no recursion is done you can easily divide jobs between threads. I'm not sure whether this is what you're interviewer wants but that's the only solution that uses threads I can think of.
accepted answer of: http://stackoverflow.com/q/20702174
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31008272
type: Answer

http://stackoverflow.com/comment/31210164
comment on: http://stackoverflow.com/q/20747138
has text: Are you willing to use a third-party game engine(library), or do you want to solve this problem using only Android library?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23957347
has body: Each biomatric device have normally lAN port or Web interface. Biomatric device sends data on specific port. for example 192.168.1.23:8080 you can make connection to it using java sockets and can read data .. Socket socket = new Socket("192.168.1.23","8080"); keep it up enjoy
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20732928
type: Answer

http://stackoverflow.com/comment/31152175
score: 0
type: AnswerComment
has text: thanks much, but it's now crashing the app when i click on the textview
type: Comment
comment on: http://stackoverflow.com/a/20782626

string
tags question: http://stackoverflow.com/q/20725365
tags question: http://stackoverflow.com/q/20689900
tags question: http://stackoverflow.com/q/20770279
tags question: http://stackoverflow.com/q/20809020
tags question: http://stackoverflow.com/q/20689788
tags question: http://stackoverflow.com/q/20737479
tags question: http://stackoverflow.com/q/20704202
tags question: http://stackoverflow.com/q/20770674
tags question: http://stackoverflow.com/q/20828789
tags question: http://stackoverflow.com/q/20770006
tags question: http://stackoverflow.com/q/20829716
tags question: http://stackoverflow.com/q/20728932
tags question: http://stackoverflow.com/q/20801601
tags question: http://stackoverflow.com/q/20823504
tags question: http://stackoverflow.com/q/20802718
tags question: http://stackoverflow.com/q/20722516
tags question: http://stackoverflow.com/q/20702304
tags question: http://stackoverflow.com/q/20810115
tags question: http://stackoverflow.com/q/20751036
tags question: http://stackoverflow.com/q/20787520
tags question: http://stackoverflow.com/q/20763838
tags question: http://stackoverflow.com/q/20813075
tags question: http://stackoverflow.com/q/20703628
tags question: http://stackoverflow.com/q/20808388
tags question: http://stackoverflow.com/q/20685241
tags question: http://stackoverflow.com/q/20759652
tags question: http://stackoverflow.com/q/20800548
tags question: http://stackoverflow.com/q/20821713
tags question: http://stackoverflow.com/q/20745415
tags question: http://stackoverflow.com/q/20760578
tags question: http://stackoverflow.com/q/20710332
tags question: http://stackoverflow.com/q/20772895
tags question: http://stackoverflow.com/q/20827333
tags question: http://stackoverflow.com/q/20719709
tags question: http://stackoverflow.com/q/20795499
tags question: http://stackoverflow.com/q/20826555
tags question: http://stackoverflow.com/q/20701077
tags question: http://stackoverflow.com/q/20811399
tags question: http://stackoverflow.com/q/20685168
tags question: http://stackoverflow.com/q/20769908
tags question: http://stackoverflow.com/q/20815102
tags question: http://stackoverflow.com/q/20759301
tags question: http://stackoverflow.com/q/20705520
tag name: string
tags question: http://stackoverflow.com/q/20776123
tags question: http://stackoverflow.com/q/20765175
tags question: http://stackoverflow.com/q/20760062
tags question: http://stackoverflow.com/q/20826518
tags question: http://stackoverflow.com/q/20750049
tags question: http://stackoverflow.com/q/20836653
tags question: http://stackoverflow.com/q/20720098
tags question: http://stackoverflow.com/q/20771679
tags question: http://stackoverflow.com/q/20692590
tags question: http://stackoverflow.com/q/20721269
tags question: http://stackoverflow.com/q/20805383
tags question: http://stackoverflow.com/q/20793652
tags question: http://stackoverflow.com/q/20734504
tags question: http://stackoverflow.com/q/20704339
tags question: http://stackoverflow.com/q/20835752
tags question: http://stackoverflow.com/q/20724753
tags question: http://stackoverflow.com/q/20700800
tags question: http://stackoverflow.com/q/20705815
type: Tag
tags question: http://stackoverflow.com/q/20845298
tags question: http://stackoverflow.com/q/20848714
tags question: http://stackoverflow.com/q/20724004
tags question: http://stackoverflow.com/q/20701024
tags question: http://stackoverflow.com/q/20830202
tags question: http://stackoverflow.com/q/20696177
tags question: http://stackoverflow.com/q/20828543
tags question: http://stackoverflow.com/q/20803209
tags question: http://stackoverflow.com/q/20771738
tags question: http://stackoverflow.com/q/20771245
tags question: http://stackoverflow.com/q/20740678
tags question: http://stackoverflow.com/q/20802808
tags question: http://stackoverflow.com/q/20739462
tags question: http://stackoverflow.com/q/20771088
tags question: http://stackoverflow.com/q/20845520
tags question: http://stackoverflow.com/q/20787099
tags question: http://stackoverflow.com/q/20690598

http://stackoverflow.com/comment/31182573
type: QuestionComment
score: 2
has text: There is no FindBugs rule, because FindBugs analyses byte code not source code.
comment on: http://stackoverflow.com/q/20792448
type: Comment

http://stackoverflow.com/a/20815013
downvote count: 1
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/20752734
type: Answer
has body: You can inject the HttpServletRequest using the @Context annotation. This works both for JAX-RS Resource Methods parameters and JAX-RS Resource Fields. Maybe this can help you ?

http://stackoverflow.com/q/20829054
has comment: http://stackoverflow.com/comment/31237147
accepted answer: http://stackoverflow.com/a/20829204
has title: the list is not empty but i can't use elements type ResultSet
has comment: http://stackoverflow.com/comment/31237183
has comment: http://stackoverflow.com/comment/31237239
has comment: http://stackoverflow.com/comment/31237166
type: AnsweredQuestion
tagged with: java
has body: Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/gestion_ecole","root",""); stmt = con.createStatement(); String sql="SELECT * FROM `note_mat` WHERE cin = '"+etd.cin+"'"; ResultSet rt=c.select(sql); List&lt;ResultSet&gt; notes = new ArrayList&lt;&gt;(); while (rt.next()) notes.add(rt); //i have problem only here the first part it's ok for(int i=0;i&lt;notes.size();i++) System.out.println(notes.get(i).getDouble("note")); // the last line generate an exception and notes.size()=5 thanks for your help
has comment: http://stackoverflow.com/comment/31237130
has comment: http://stackoverflow.com/comment/31237133
type: Question
has comment: http://stackoverflow.com/comment/31237117
has answer: http://stackoverflow.com/a/20829204
answer count: 1
has comment: http://stackoverflow.com/comment/31237182
score: 0

http://stackoverflow.com/comment/31073490
type: AnswerComment
has text: Only change the error to **The constructor ArrayAdapter<String>(MainActivity, int, String) is undefined**
type: Comment
comment on: http://stackoverflow.com/a/20704372
score: 0

http://stackoverflow.com/comment/31092862
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20749062
has text: What do you mean "it is not working"? You give it a value, and it has another? Have you used the debugger with breakpoints?

http://stackoverflow.com/comment/31260128
score: 0
type: Comment
type: QuestionComment
has text: I can do that, what would change if we do it?
comment on: http://stackoverflow.com/q/20841577

http://stackoverflow.com/a/66276735
answers question: http://stackoverflow.com/q/20762001
downvote count: 0
type: Answer
score: 1
has body: You can use Material design sliders instead of seekbar <com.google.android.material.slider.Slider ... android:valueFrom="60" android:valueTo="180" android:stepSize="10.0" />' for more check here https://material.io/components/sliders/android
upvote count: 1

http://stackoverflow.com/a/20849573
accepted answer of: http://stackoverflow.com/q/20848683
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: change your MoveP2 method to parse the PlayerPos object as an argument public String[][] MoveP2(playerPos pos, String field[][], String trekker, int direction){ Field type = new Field(); int rowT = pos.getRowT(); int colT = pos.getColT(); ... } and in you Home class main method modify the MoveP2 to parse the PlayerPos object you already created as follows first.popField(way.MoveP2(position, start.newField(), input.trekker, input.direction)); then it should work. And please follow java coding standards like methods name should start with a lower case letter
has comment: http://stackoverflow.com/comment/31275844
answers question: http://stackoverflow.com/q/20848683

http://stackoverflow.com/a/20689929
score: 3
downvote count: 0
has body: Split the string via split() method and space delimiter. It will return the array of the words in the string, then reverse the array and concatenate elements via space character. That's all.
type: Answer
answers question: http://stackoverflow.com/q/20689900
upvote count: 3

http://stackoverflow.com/comment/31195086
score: 0
has text: Please, add tag `java`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20806539

http://stackoverflow.com/comment/31085100
score: 0
comment on: http://stackoverflow.com/q/20744691
type: QuestionComment
type: Comment
has text: possible duplicate of [Any Java libraries out there that validate SQL syntax?](http://stackoverflow.com/questions/141499/any-java-libraries-out-there-that-validate-sql-syntax)

http://stackoverflow.com/q/20797108
downvote count: 0
has comment: http://stackoverflow.com/comment/31178805
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31206385
type: UnansweredQuestion
tagged with: soap
upvote count: 1
has answer: http://stackoverflow.com/a/20798246
score: 1
tagged with: java
tagged with: integration-testing
has comment: http://stackoverflow.com/comment/67845716
has title: How test soap based application with mock?
has body: I have 2 web applications which have web services. Suppose application One have 3 web methods and application Second app have only 1 web method which can return different results. Also all webmethods from app One call web method in app Second. The goal is creation integration test for application One. I can create soapui tests for each webmethod in app One and also add mock of Second app. But when tests for each method executes in parallel I must "tell" to mock "now you return that data, but now thow an Exception". I need that mock be able to recognize when it receive request for Second app from 1,2 or 3 web method in app One. When I create request for app One I cannot control it sub-request to app Second. So to distinguish them I must (somehow) mark entire requst chain: Request1 -&gt; App One (WebMethod1) -&gt; SubRequest1 -&gt; Mock For example if I can add Http header in Request1 which also can be retranslated to SubRequest1 the Mock will analyze this header and return/throw what I want. But actually HttpHeader do not retranslated. I can add java code for this, but code only for test is not very good. Is there any approach or way to do that testing? This is simplified example, in real situation there are more that 2 communicated applications and more web methods. IMPORTANT This question is not about Unit tests or EasyMock, PowerMock and Mockito. These frameworks related to unit tests, but I want integration testing.
type: Question

http://stackoverflow.com/q/20783941
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31164198
favorite count: 0
has comment: http://stackoverflow.com/comment/31154223
has answer: http://stackoverflow.com/a/20784187
type: UnansweredQuestion
has title: LockManager - idea and API
upvote count: 1
tagged with: design-patterns
has body: I want to develop a LockManager which can lock many variables atones and avoid deadlocks. For example the following piece of code: long amount = … //two bank accounts final BankAccount ba1 = ... final BankAccount ba2 = ... synchronized(ba1, ba2){ ba1.transfer(amount , ba2); } can be replaced by: &lt;!-- language: java --&gt; //two bank accounts final BankAccount ba1 = ... final BankAccount ba2 = ... //synchronize bank accounts final LockManager&lt;Object&gt; lockManager = … synchronizer.synchronize( ba1, LockMode.Write, ba2, LockMode.Write, new Transaction&lt;Object&gt;(){ @Override public void execute() { ... ba1.transfer(amount , ba2); } } ); I need your opinion about the idea and proposed API.
has comment: http://stackoverflow.com/comment/31154164
tagged with: algorithm
score: 1
tagged with: java
tagged with: concurrency
type: Question
tagged with: locking

http://stackoverflow.com/a/20744223
answers question: http://stackoverflow.com/q/20744054
has comment: http://stackoverflow.com/comment/31087996
type: Answer
has comment: http://stackoverflow.com/comment/31085390
has comment: http://stackoverflow.com/comment/31092012
has comment: http://stackoverflow.com/comment/31084291
has comment: http://stackoverflow.com/comment/31086159
has comment: http://stackoverflow.com/comment/31091292
has body: The errors from the first function suggest that you're using a JNDI named resource to get the connection, not one from DriverManager. Are you sure that the device can see that host and port? Does the device have permission to connect? What does the GRANT in the MySQL database look like? Your method to get name from categories table isn't good, either. You don't close any resources in finally blocks. You should. Those // end of while and // end of if comments are heinous. They don't add information, only clutter. Expunge those from your code.
score: 0

http://stackoverflow.com/a/20767083
answers question: http://stackoverflow.com/q/20767066
has comment: http://stackoverflow.com/comment/31125523
upvote count: 7
has comment: http://stackoverflow.com/comment/31125269
has body: The right side is a one dimensional array that is the first (0th) element of the two-dimensional array new int[][]{{1}} To show it out more clearly lets add parenthesis int[] array = (new int[][]{{1}}) [0];// [0] is returning first row of 2D array // which is 1D array so it can be assigned to `array`
has comment: http://stackoverflow.com/comment/31124951
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31125309
score: 7
accepted answer of: http://stackoverflow.com/q/20767066
type: AcceptedAnswer

http://stackoverflow.com/comment/31265969
score: 0
has text: no no I'm doing a research and at the last moment my supervisor decided to do some testings in this semester which is about to end , so I have to finish coding for the test in one day .
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20844734

http://stackoverflow.com/comment/31066758
score: 0
type: Comment
has text: they are actually ImageViews but yes
comment on: http://stackoverflow.com/a/20734353
type: AnswerComment

http://stackoverflow.com/comment/31161824
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20787800
has text: @camickr that _does_ make those quotes above more clear.
score: 0

http://stackoverflow.com/q/20688281
has answer: http://stackoverflow.com/a/20688783
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/20688330
has comment: http://stackoverflow.com/comment/30982308
has answer: http://stackoverflow.com/a/20688330
tagged with: append
has answer: http://stackoverflow.com/a/20688323
has body: I am trying to figure out another way other than using String.valueOf() and then using Integer.parseInt()to turn an array of numbers into one type long number, not adding the values up, just like appending a String. Example: Let's say you have an ArrayList&lt;Integer&gt; of 5 elements and the numbers are (e = element) -> e0(1), e1(4), e2(3), e3(6), e4(7) So I want to turn this into one type long number -> 14367. I need this to find a so called Miraculous number in java. I am to use lists, and print a miraculous number. (also any tips about that miraculous number?)
score: 1
has comment: http://stackoverflow.com/comment/30982282
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Turn ArrayList<Integer> into one number?
accepted answer: http://stackoverflow.com/a/20688323
tagged with: arraylist
answer count: 3

http://stackoverflow.com/q/20752725
type: Question
has comment: http://stackoverflow.com/comment/31099697
upvote count: 0
has answer: http://stackoverflow.com/a/20752755
score: -2
accepted answer: http://stackoverflow.com/a/20752755
tagged with: unicode
has title: Why does Java convert my characters into weird question marks?
has comment: http://stackoverflow.com/comment/31099716
answer count: 1
has comment: http://stackoverflow.com/comment/31099820
has comment: http://stackoverflow.com/comment/31099610
has comment: http://stackoverflow.com/comment/31099598
has comment: http://stackoverflow.com/comment/31099597
has comment: http://stackoverflow.com/comment/31099831
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/31099685
has body: Let me explain. I have a string which is JoaquÃ­n Torres GarcÃ­a and then when I parse it using the above code, the txt file generated has the same name in form of Joa???? Torres Garc????a. I am writing the strings composed in this fashion to the text file using this code: java.util.Iterator&lt;String&gt; itr = set.iterator(); int occur = 0; File w = new File("newnodes.txt"); try (BufferedWriter wr = new BufferedWriter(new FileWriter(w))) { //String def = "nodedef&gt;name VARCHAR,label VARCHAR"; //wr.write(def); wr.newLine(); while (itr.hasNext()) { occur++; String str = (String.valueOf(occur))+","+ (itr.next()); wr.write(str); wr.newLine(); } System.out.println("Node file Created");
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31099644
tagged with: java
has comment: http://stackoverflow.com/comment/31099802
has comment: http://stackoverflow.com/comment/31099747
has comment: http://stackoverflow.com/comment/31099813

http://stackoverflow.com/q/20740767
upvote count: 1
has title: Regular expression in Java with spaces
type: Question
has comment: http://stackoverflow.com/comment/31077599
has body: Please help make regular expression that converts following string: A [B C] "D E F" into 3 strings A B C D E F where A, B, C, D, E, F are a set of alphanumeric characters and may or may not include special characters such as +:/._- etc. I tried something like: [[a-zA-Z0-9/: +]+]\s"[a-zA-Z0-9._/?&amp;=-]+"\s[a-zA-Z0-9-]+. But this returns single recognized pattern when I use Java's Pattern and Matcher classes. I want to get 3 distinct groups.
has comment: http://stackoverflow.com/comment/31077496
downvote count: 4
has comment: http://stackoverflow.com/comment/31077561
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20741304
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/31083409
tagged with: regex
has comment: http://stackoverflow.com/comment/31078029
tagged with: java

http://stackoverflow.com/comment/31179523
type: Comment
has text: Try to ping the host in the same machine. Does it work? Maybe DNS failure / HOST file configuration failure. @ChrisHayes good try!
comment on: http://stackoverflow.com/q/20797928
score: 0
type: QuestionComment

http://stackoverflow.com/a/20783887
answers question: http://stackoverflow.com/q/20767486
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Yet another possible workaround is to declare a non-static @Rule, and have it act on static collaborators: if the collaborator isn't initialised yet, the @Rule knows it's running for the first time (so it can set up its collaborators, e.g. starting an external resource); if they are initialised, the @Rule can do it's per-test work (e.g. reseting an external resource). This has the drawback that the @Rule doesn't know when it's processed the last test, so can't perform any after-class actions (e.g. tidying up the external resource); an @AfterClass method can be used to do so, instead, however.

http://stackoverflow.com/comment/31731995
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20839242
has text: I find a site like json2csharp but for java http://www.jsonschema2pojo.org/
type: Comment

http://stackoverflow.com/comment/31239652
score: 0
comment on: http://stackoverflow.com/q/20829813
type: Comment
has text: @delnan But I think your point stands for the "classic" generational GCs. In that framework there is no room for "flying" heap regions and it would be impossible to reclaim an empty Eden without copying.
type: QuestionComment

http://stackoverflow.com/q/20681616
favorite count: 0
type: UnansweredQuestion
score: 2
has title: JAVA: Creating a Menu Loop
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/20682015
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/30970275
tagged with: infinite-loop
has body: My program contains a few options that the user can select via the input of a number which allows them to complete a specific task. Currently, my code is set up with if and else if loops to complete task if a certain number of input. However, at the minute the program terminates after one task. I want the user to be able to input another number to complete another task. I have tried surrounding the code with a while loop and an exit option to allow the user to escape the loop and end the program, but this is not working and results in a "java.util.NoSuchElementException". The program works fine without the while loop. This is an example of the current code which hopefully conveys what I mean: System.out.println("Enter one of the following commands:"); System.out.println("1 - something.."); System.out.println("2 - something else.."); System.out.println("3 - exit"); Scanner scanchoice = new Scanner(System.in); System.out.println(); System.out.println("Enter \"1\", \"2\" or \"3\""); int choiceentry = scanchoice.nextInt(); while (choiceentry != 3) { if (choiceentry &lt; 1 || choiceentry &gt; 3) { System.out.println("Enter \"1\", \"2\", \"3\" or \"4\""); choiceentry = scanchoice.nextInt(); } else if(choiceentry == 1) { // ..do something } else if(choiceentry == 2) { //..something else } else if(choiceentry == 3) { //...exit program } } So I want to get into this loop, and only exit to terminate the program. I'm hoping that the while loop would take the user back to a menu, allowing you to select another option, however this is not working. What is wrong with this code? And how can I implement this idea? Thanks in advance!
tagged with: nested-loops
has answer: http://stackoverflow.com/a/20681715
answer count: 3
has answer: http://stackoverflow.com/a/20681686

http://stackoverflow.com/q/20715733
has comment: http://stackoverflow.com/comment/31032421
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20715874
tagged with: jcomponent
has body: I didn't attach any code because I didn't think it was necessary if you just follow along. I have a main class with a JComponent (component) and JFrame (frame) as fields. This class also implements runnable and once the thread is started, a game loop runs and currently the only line in that loop is component.repaint(); usually paintComponent() is constantly called and my window continues to update smoothly. I also added a keylistener to the JFrame using frame.addKeyListener(new MoveListener()); (I made MoveListener and it implements KeyListener) The only problem is that when I hit say the "right" key and key pressed is called. Instead of having my sprite jump from one tile to the next im having him smoothly move one pixel at a time very quickly(my animation). To keep the sprite centered on the screen, when he "moves right", then I have the map move left. In key pressed, I have a for loop that subtracts 1 from the coordinates of the map each time until it reached the next tile in which case it would stop moving and everything's coordinates would be updated to the next tile. I figured the keylistener and my thread would run independently, but when keypressed is called... the thread keeps running, but the component isn't repainting. The screen pauses for a moment as the for loop runs through and then the sprite jumps to the next tile. I've tested and im sure the thread is running and attempting to call repaint() but paintComponent() doesn't run untill after keypressed is finished. I assumed that since they were separate threads that the component could keep painting as the listener moved the map around. Is there a reason it won't paint while the keylistener is running or did I do something else wrong because obviiously I'm not a profesional so I don't know everything about this stuff? also what is the best way to get around this...if need be Ill upload my code so you can take a look, but i think i explained pretty thoroughly. thanks for all help in advance!!
type: Question
linked to: http://stackoverflow.com/q/11918605
tagged with: keylistener
score: 0
accepted answer: http://stackoverflow.com/a/20715874
answer count: 1
tagged with: multithreading
has title: Allowing my JComponent to repaint() while key listener is running
tagged with: animation

http://stackoverflow.com/q/20705424
score: 2
has comment: http://stackoverflow.com/comment/31012989
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20705509
tagged with: java
has title: How can I output the hundred and teens numbers in words in my program
tagged with: methods
has answer: http://stackoverflow.com/a/20705597
type: Question
tagged with: do-while
has answer: http://stackoverflow.com/a/20705532
has comment: http://stackoverflow.com/comment/31012899
downvote count: 0
answer count: 7
linked to: http://stackoverflow.com/q/794663
has answer: http://stackoverflow.com/a/20705813
favorite count: 0
has answer: http://stackoverflow.com/a/20711059
has answer: http://stackoverflow.com/a/20705523
has body: I need help to display my hundred and teens number in words. For example if I enter 116. My program will output One hundred and Six, instead of One hundred and sixteen. All the other numbers that I input work except for the teens numbers.
possible better answer: http://stackoverflow.com/a/20705523
upvote count: 2
accepted answer: http://stackoverflow.com/a/20705813
has answer: http://stackoverflow.com/a/20705554

http://stackoverflow.com/comment/31240827
has text: I believe the separation can be done with markers in logback without the hack you describe. The slf4j project has the necessary glue.
comment on: http://stackoverflow.com/q/20830673
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20816542
has comment: http://stackoverflow.com/comment/31213703
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31213644
tagged with: android
tagged with: android-fragments
tagged with: java
has body: Not able to import into eclipse sample from here: http://developer.android.com/training/basics/fragments/communicating.html Here is what i tried: right click - NEW - OTHER - Existing Projects into Workspace import - general - existing project into workspace NEW - project - chose "Android Sample Project" Yet, none of these worked.
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/31213653
has answer: http://stackoverflow.com/a/20816661
has title: New to android - not able to import sample project into eclipse
has comment: http://stackoverflow.com/comment/31213724
score: 0
answer count: 1

http://stackoverflow.com/a/20696135
type: Answer
downvote count: 0
has body: That works, although I would recommend db.delete(TABLE, "column_name=?", new String[] { String.valueOf(custname) }); or use String query = "DELETE FROM " +TABLE_NAME+ " WHERE " + COLUM_NAME+ " = " + "'"+VALUE +"'" ; db.execSQL(query);
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20692123

http://stackoverflow.com/comment/31185079
score: 15
type: Comment
comment on: http://stackoverflow.com/a/20796420
has text: @santosh +1 for mentioning the `-verbose:class` option.
type: AnswerComment

http://stackoverflow.com/comment/30995100
comment on: http://stackoverflow.com/q/20695014
score: 1
type: Comment
type: QuestionComment
has text: -1, Quit multiposting. You already have a topic on this and you got good advice (http://stackoverflow.com/q/20693744/131872). Keep the conversation in one posting so everybody know what has been suggested. Did you look at the tutorial? There is also a section on `Custom Painting` that will show you how to better structure your program. Start with a working example and then customize the painting.

http://stackoverflow.com/a/20686184
upvote count: 1
answers question: http://stackoverflow.com/q/20685827
score: 1
downvote count: 0
has body: Access: class instance (i.e variables that declared by static/final) and static methods can work together without explicit need of object reference. Whereas to access member variable (aka instance variables) you need to access via object reference. class Test { static String str = "asdf"; int num = 10; static void methodA() { System.out.println("Static variable direct access: " + str); System.out.println("Member variable access : " + new Test().num); } } Concurrency: Other difference is during concurrent access or thread-safety logic, class-level-lock can be taken via class-variables in static-methods and object-level-lock can be taken via member-variables in member-methods though you can mix-n-match ofcourse. class Test { static Object CLASS_LOCK = new Object(); Object MEMBER_LOCK = new Object(); Test sharedTest = new Test(); // or created in different manner static void methodA() { synchronized (CLASS_LOCK) { // .. thread-safe code } synchronized (sharedTest.MEMBER_LOCK) { // .. thread-safe code } } }
type: Answer

http://stackoverflow.com/q/20723013
upvote count: 12
possible better answer: http://stackoverflow.com/a/39065497
accepted answer: http://stackoverflow.com/a/20723071
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/20723071
answer count: 2
has answer: http://stackoverflow.com/a/39065497
has title: Using inverse true in hibernate
score: 12
has body: I am going through the hibernate documentation and came across the concept of inverse attribute. I am new to Hibernate so I am feeling difficulty in understanding the concept properly. http://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/collections.html#collections-bidirectional &lt;class name="Category"&gt; &lt;id name="id" column="CATEGORY_ID"/&gt; ... &lt;bag name="items" table="CATEGORY_ITEM"&gt; &lt;key column="CATEGORY_ID"/&gt; &lt;many-to-many class="Item" column="ITEM_ID"/&gt; &lt;/bag&gt; &lt;/class&gt; &lt;class name="Item"&gt; &lt;id name="id" column="ITEM_ID"/&gt; ... &lt;!-- inverse end --&gt; &lt;bag name="categories" table="CATEGORY_ITEM" inverse="true"&gt; &lt;key column="ITEM_ID"/&gt; &lt;many-to-many class="Category" column="CATEGORY_ID"/&gt; &lt;/bag&gt; &lt;/class&gt; From above code, the inverse="true" is applied to categories, so I understood that categories is the inverse end. But I am seeing some contradiction to my understanding: Changes made only to the inverse end of the association are not persisted. category.getItems().add(item); // The category now "knows" about the relationship item.getCategories().add(category); // The item now "knows" about the relationship session.persist(item); // The relationship won't be saved! session.persist(category); // The relationship will be saved If categories is on inverse end then how the relationship is saved here? The non-inverse side is used to save the in-memory representation to the database. After looking at the example and reading above statement I came to know that categories is on non-inverse end. Please help me in knowing how to interpret this inverse="true" attribute. After searching in net and looking at answers in SO, I came to know the usefulness of this attribute but still I have this confusion.
favorite count: 0

http://stackoverflow.com/comment/31100950
score: 1
has text: Ha! So it is. That's what I get for stackoverflowing on my iPhone whilst drinking.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20753402

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/20772164

http://stackoverflow.com/comment/31244115
score: 0
type: AnswerComment
has text: ok, it's normal now after i changed the code as `JPA.em() .createQuery("from ServerModel where machineId="+mc.getId()) .getResultList();`. it's odd to me. anyway thank you.
type: Comment
comment on: http://stackoverflow.com/a/20799296

http://stackoverflow.com/q/20846756
downvote count: 0
tagged with: jar
favorite count: 0
answer count: 3
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20957744
has title: The import com.wordnik cannot be resolved
score: 2
has answer: http://stackoverflow.com/a/20846840
type: Question
tagged with: java
has body: I'm very new to Android apps, and am learning as I go. So, please be specific if you give an answer. I build a simple Android test app using eclipse Juno ADT. It works beautifully! So the next step was to add a call to the WordNik API. I installed the WordNik Java API which installed the following libraries: target&gt;wordnik-java-client-1.0.0.jar target&gt;wordnik-java-client-1.0.0-tests.jar target&gt;lib&gt;jackson-annotation-2.1.4.jar target&gt;lib&gt;... 7 more jar files I added the libraries to the Build Path via Project &gt; Properties &gt; Add External Jars Now, when the add the import to my code: import com.wordnik.client.api.*; import com.wordnik.client.model.*; I get errors &quot;The import com.wordnik cannot be resolved. I have tried recommendations I've seen for other such errors such as Project &gt; clean Double checking my build path includes all the WordNik jar files What am I missing?
tagged with: eclipse
upvote count: 2
has answer: http://stackoverflow.com/a/20846918

http://stackoverflow.com/q/20680111
has body: How do you call getIntExtra from the override of onResume()? Code that errors is as follows: @Override protected void onResume() { super.onResume(); setDDL_Selected(0); setDDL_Selected(Intent.getIntExtra("DDL_ID", 0)); } The compiler throws the following error: Non-static method getIntExtra(java.lang.String, int) cannot be referenced from a static context?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20680160
has title: Non-static method getIntExtra(java.lang.String, int) cannot be referenced from a static context?
tagged with: android
possible better answer: http://stackoverflow.com/a/20680185
tagged with: android-intent
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20680686
accepted answer: http://stackoverflow.com/a/20680160
has answer: http://stackoverflow.com/a/20680185

http://stackoverflow.com/q/20703974
answer count: 0
type: UnansweredQuestion
tagged with: openjpa
tagged with: columnmappings
has body: I have the following problem, I have the folowing classes: class C(){ ... @ManyToOne @JoinColumns({ @JoinColumn(name = "B_FK", referencedColumnName = "B_ID"), @JoinColumn(name = "A_FK", referencedColumnName = "A_ID")}) private B b = null; @ManyToOne @JoinColumn(name = "A_FK") private A a = null; } EDIT: @Embeddable class bPK(){ @Column(name = "B_ID") private String bId; @Column(name = "A_ID") private String aId; } class B(){ @EmbeddedId private bPK b_Pk = null; @ManyToOne @MapsId(value = "aId") @JoinColumn(name = "A_ID") public A a; } class A(){ @Id @Column(name = "A_ID") public String aId; } Class B has a composite key and we created the database scheme first, so we have to define the column names for mapping. The problem now is that if we persist an instance of class C as like this: C c = new C(); A a = new A(); a.setId("TEST_ID"); c.setA(a); em.persist(c); Then we get the following error: Caused by: &lt;openjpa-2.2.0-r422266:1244990 fatal user error&gt; org.apache.openjpa.persistence.InvalidStateException: Attempt to set column "C.A_FK" to two different values: (null)"null", (class java.lang.String)"TEST_ID" This can occur when you fail to set both sides of a two-sided relation between objects, or when you map different fields to the same column, but you do not keep the values of these fields in synch. As the attribute b is null and the value for a is set, jpa tries to set A_FK to null for b and to "TEST_ID" for a. It works fine if a and b are set or if both are null, but not if only one of them is set. Is there a solution to fix this problem? We expected that in case b is null the JoinColumns are ignored or that there is any option to disable them in case the annotated attribute is null. We use OpenJPA 2.2.0.
type: Question
has comment: http://stackoverflow.com/comment/31075324
tagged with: java
has comment: http://stackoverflow.com/comment/31038185
has comment: http://stackoverflow.com/comment/31067418
upvote count: 2
tagged with: jpa
has title: JPA issue 2 attributes mapped to same column InvalidStateException: Attempt to set column to two different values
favorite count: 0
has comment: http://stackoverflow.com/comment/31020495
tagged with: joincolumn
score: 2
downvote count: 0

http://stackoverflow.com/comment/31012109
has text: How does this code prevents data races, when no locking mechanism is used? Why dont you want to use a lock?
score: 0
comment on: http://stackoverflow.com/q/20704797
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31259613
type: Comment
type: QuestionComment
score: 3
has text: Shoouldn't `root.left = sub(num, 0, indexRoot-1);` be `root.left = sub(num, start, indexRoot-1); `?
comment on: http://stackoverflow.com/q/20841300

http://stackoverflow.com/comment/31012327
type: AnswerComment
comment on: http://stackoverflow.com/a/20705085
score: 0
type: Comment
has text: No. Your Mapfragment class is inheriting the wrong version of MapFragment

http://stackoverflow.com/comment/31245503
has text: `myClass.toString()` (I assume you mean the default [`Object#toString`](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#toString())) does *not* show you the reference. It shows you an arbitrary string built from the class name and the instance hash code. That's *all* that data is, nothing more.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20833402

http://stackoverflow.com/comment/31174088
type: AnswerComment
comment on: http://stackoverflow.com/a/20794717
type: Comment
has text: i couldn't understand your question
score: 0

http://stackoverflow.com/a/20735534
answers question: http://stackoverflow.com/q/20735000
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20735000
score: 0
has body: This error occurs because you haven't registered a texture named selection. TextFieldStyle requires the selection field to hold the texture that should be drawn when the user selects some text. To register such texture(s) just do so: skin.addRegions(someAtlasTexture) Obviously, the atlas should contain such region(s). Also, you should define background field of TextFieldStyle (usually, 9-patch region) to see text field corners.
type: Answer
has comment: http://stackoverflow.com/comment/47939251

http://stackoverflow.com/q/20711579
tagged with: junit
has comment: http://stackoverflow.com/comment/31024408
answer count: 4
accepted answer: http://stackoverflow.com/a/20711650
favorite count: 0
score: -1
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31033878
downvote count: 1
possible better answer: http://stackoverflow.com/a/20711624
type: AnsweredQuestion
has title: A test should fail on throwing exception
has answer: http://stackoverflow.com/a/20711624
has comment: http://stackoverflow.com/comment/31049076
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20711637
has answer: http://stackoverflow.com/a/20711650
upvote count: 0
has answer: http://stackoverflow.com/a/20711639
has body: @Test public void testA() throws Exception { } Is above a good style to code ? Because the test is allowed to throw exceptions and if the code throws exception, then Netbeans consider that as a successful test case. If yes, then I want to make the test fail if it throws any exception, how can I do that ?

http://stackoverflow.com/a/20732528
has comment: http://stackoverflow.com/comment/31062990
type: Answer
score: 0
has body: I did not get your question completely. But your repeater code only executes the BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); String s = ""; try{ s = buf.readLine(); System.out.println("Input is: "+s); } catch(IOException e){System.out.println("MyThreadRepeater - readLine() method error");} } code only once. Run it inside a loop to run it continuously.
answers question: http://stackoverflow.com/q/20732385

http://stackoverflow.com/comment/31050562
type: Comment
has text: @ELMEKKIAnouar Have you checked your typos? And I assume you have used the correct `class` for the class reference.
comment on: http://stackoverflow.com/a/20725543
type: AnswerComment
score: 0

http://stackoverflow.com/a/21029845
type: Answer
has body: I would suggest to first transform the input XML using XSLT and then process the transformed XML using XStream: Input XML -> XSLT -> Transformed XML -> XStream -> Java object(s)
score: 0
answers question: http://stackoverflow.com/q/20798905

http://stackoverflow.com/a/20772999
has body: The short answer for your problem is, put an empty file named beans.xml into the WEB-INF folder. Alternatively, you can annotate your service with @EJB instead. See this answer for a longer explanation: Should I use @EJB or @Inject
accepted answer of: http://stackoverflow.com/q/20772810
has comment: http://stackoverflow.com/comment/31135575
has comment: http://stackoverflow.com/comment/31135786
answers question: http://stackoverflow.com/q/20772810
has comment: http://stackoverflow.com/comment/31135664
type: Answer
has comment: http://stackoverflow.com/comment/31135610
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31135828
has comment: http://stackoverflow.com/comment/31135617
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/20740977
type: Answer
has body: You can try this code in if clause if (x &lt; 80) { velX = velX; x = x + velX; }
has comment: http://stackoverflow.com/comment/31078006
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20739836
upvote count: 1

http://stackoverflow.com/q/20707150
score: 0
possible better answer: http://stackoverflow.com/a/20707206
has answer: http://stackoverflow.com/a/20707206
tagged with: textview
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20707826
accepted answer: http://stackoverflow.com/a/20707826
tagged with: android
has title: Preventing TextView and ImageView Overlap In Relative Layout
has body: I have a textView (titleTv) and an imageView (buyButton) which are sometimes have an overlap if the titleTv has a somewhat long name. How might this be prevented? I understand this can be done using an external library - but it seems strange there isn't a simple way to accomplish this. &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="7dip" android:paddingTop="7dip" &gt; &lt;TextView android:id="@+id/titleTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/white" android:paddingLeft="5dp" android:text="" android:textSize="20sp" /&gt; &lt;TextView android:id="@+id/uploaderTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/titleTv" android:paddingLeft="5dip" android:paddingTop="5dp" android:textColor="@color/verylightgrey" android:textSize="16sp" /&gt; &lt;TextView android:id="@+id/viewCountTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/titleTv" android:layout_toRightOf="@id/uploaderTv" android:paddingTop="5dp" android:textColor="@android:color/black" android:textSize="16sp" /&gt; &lt;ImageView android:id="@+id/buyButton" android:layout_width="45dp" android:layout_height="45dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:adjustViewBounds="true" android:paddingTop="7dip" android:src="@drawable/buy_a_up_btn" /&gt; &lt;/RelativeLayout&gt; Example: (the overlapping fields are the video's title and the $ button) https://i.sstatic.net/clpNv.png
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/20776497
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31142887
type: Answer
has comment: http://stackoverflow.com/comment/31141789
has comment: http://stackoverflow.com/comment/31141941
has comment: http://stackoverflow.com/comment/31141594
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/31142662
has body: I'm not sure how much this will help, but you may convert a signed byte to its unsigned value by running a binary AND operation with 0xFF. Taking this logic further, you could check for overflows after the cast by running a similar AND on the int, with the appropriate operand. This of course assumes that you're always expecting positive or zero valued numbers, or in other words unsigned numbers. (short)(((IV[i &lt;&lt; 1] &amp; 0xFF) &lt;&lt; 8) | (IV[(2 &lt;&lt; 1) + 1] &amp; 0xFF)) The above is the result of putting it all together, courtesy of Radiodef.
accepted answer of: http://stackoverflow.com/q/20776371
has comment: http://stackoverflow.com/comment/31143550
has comment: http://stackoverflow.com/comment/31142172
answers question: http://stackoverflow.com/q/20776371

http://stackoverflow.com/comment/44991260
score: 0
type: Comment
has text: My fault! Updated answer. Try the application plugin mentioned by Peter
comment on: http://stackoverflow.com/a/20728827
type: AnswerComment

http://stackoverflow.com/a/20784584
type: Answer
has body: Resolved using Comparator : static final Comparator&lt;RootObject&gt; ROOTELEMENT_ORDER = new Comparator&lt;RootObject&gt;() { final List&lt;Class&lt;? extends RootObject&gt;&gt; classList = Arrays.asList( House.class,Error.class, Message.class, Animal.class ); public int compare(RootObject r1, RootObject r2) { int i1 = classList.indexOf(r1.getClass()); int i2 = classList.indexOf(r2.getClass()); return i1-i2 ; } }; void beforeMarshal(Marshaller marshaller ) { Collections.sort(root, ROOTELEMENT_ORDER); }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20782283
downvote count: 0

http://stackoverflow.com/a/20681564
score: 0
has comment: http://stackoverflow.com/comment/30970048
has comment: http://stackoverflow.com/comment/30970222
has body: Generally we use setter for set value for class variables. That is a common use. But If you want to parse two value(two parameters) you can parse since setter is also a method. public int[] getXY() { return new int[]{x,y}; // return both x and y } public void setXY(int x, int y) { // set both x and y this.x = x; this.y = y; }
answers question: http://stackoverflow.com/q/20681489
type: Answer
has comment: http://stackoverflow.com/comment/30969929

http://stackoverflow.com/a/22076469
has comment: http://stackoverflow.com/comment/134894484
type: Answer
answers question: http://stackoverflow.com/q/20715143
downvote count: 1
has body: I would also recommend using Guava's immutable collections, e.g., import com.google.common.collect.ImmutableList; // ... @OneToMany(mappedBy="order") List&lt;LineItem&gt; lineItems = ImmutableList.of(); This idiom never creates a new empty list, but reuses a single instance representing an empty list (the type does not matter). This is a very common practice of functional programming languages (Scala does this too) and reduces to zero the overhead of having empty objects instead of null values, making any efficiency argument against the idiom moot.
has comment: http://stackoverflow.com/comment/75292900
upvote count: 3
has comment: http://stackoverflow.com/comment/77742645
score: 2

http://stackoverflow.com/q/20823690
has answer: http://stackoverflow.com/a/20823708
score: 1
tagged with: java
downvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/20823715
linked to: http://stackoverflow.com/q/9693124
has title: Manipulate or edit System.out (java)
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/31226923
duplicate of: http://stackoverflow.com/q/9693124
favorite count: 0
has body: Is this possible to do in Java, like using System.out.println(...) and then somehow edit the text that was written? For example, I have a basic application doing some tasks, and I want to keep the user updated, like showing the percentage before until it's done. So it would show something like this in the System.out stream when the task starts Doing x task ... 0% Then update the % shown when progresses are being made. Whenever the task is done, change it to say "Done!" instead of showing 100% or some random percentage. Sorry if this is a bad and hard to understand question, I really have no idea how to put it and English is not my native language. Feel free to edit the question to make it more clear
has answer: http://stackoverflow.com/a/20823715
possible better answer: http://stackoverflow.com/a/20823708
tagged with: system.out
type: AnsweredQuestion

http://stackoverflow.com/q/20836776
type: Question
accepted answer: http://stackoverflow.com/a/20836857
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/20836857
answer count: 1
has title: How to give hint for jEditorPane?
favorite count: 0
tagged with: swing
type: AnsweredQuestion
tagged with: netbeans
tagged with: jeditorpane
tagged with: java
has body: How can I give hint for jEditorPane in Java, I am using NetBeans ide? I don't see any property in the jEditorPane, what can be done in this respect?
downvote count: 1

http://stackoverflow.com/a/20821590
has body: First, you should use the appropriate generic with your moves Collection (which I assume is a list) - List&lt;MoveLog&gt; moves; // &lt;-- something like that. Second, you can use a ternary (I kept the casts, but if you do step 1 you don't need them) - MoveLog end = (inc &gt;= moves.size()) ? (MoveLog) moves.get(moves.size() - 1) : (MoveLog) moves.get(inc); You cannot have two variables named end in scope at once.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20821481

http://stackoverflow.com/q/20788522
tagged with: http://stackoverflow.com/tag/xml
has title: How to create a detached digital signature for an XML in Java
type: UnansweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21933757
downvote count: 1
type: Question
score: 0
answer count: 1
favorite count: 0
tagged with: digital-signature
has body: I have created a digital signature using PFX file for an XML document with the help of this URL. All I want to know is how to make it a detached digital signature so that it could be passed to XML signature tag? Right now, it is enveloped in my XML file (i.e. Enveloped signature).

http://stackoverflow.com/q/20729048
has answer: http://stackoverflow.com/a/20729065
possible better answer: http://stackoverflow.com/a/20729057
tagged with: java
tagged with: eclipse
has title: What it means "..." in this code?
type: Question
has answer: http://stackoverflow.com/a/20729079
score: 0
answer count: 3
duplicate of: http://stackoverflow.com/q/3158730
favorite count: 0
has answer: http://stackoverflow.com/a/20729057
upvote count: 1
has body: public class AcademGroup implements Serializable { Student[] students; AcademGroup(Student... st) { this.students = st; } What it means "Student... st"? Thank you.
duplicate of: http://stackoverflow.com/q/2367398
downvote count: 1
accepted answer: http://stackoverflow.com/a/20729079
type: AnsweredQuestion

http://stackoverflow.com/comment/31093729
has text: @CB sorry I am responding so late but How is it that it is splitting the String exactly like that
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20748756

http://stackoverflow.com/q/20781987
accepted answer: http://stackoverflow.com/a/20782625
type: AnsweredQuestion
favorite count: 0
type: Question
tagged with: android
answer count: 1
tagged with: installation
score: 0
has answer: http://stackoverflow.com/a/20782625
tagged with: java
has body: Is there any way to find the origin of the current application at runtime, programmatically, to check if the application on device was downloaded from Google Play or installed via any other source?
upvote count: 1
downvote count: 1
has title: Find Android app installed from googleplay or not
has comment: http://stackoverflow.com/comment/31151353

http://stackoverflow.com/a/20742184
accepted answer of: http://stackoverflow.com/q/20742012
answers question: http://stackoverflow.com/q/20742012
has comment: http://stackoverflow.com/comment/31081116
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31080959
has comment: http://stackoverflow.com/comment/31084582
type: Answer
has body: Duplicate local variable exception generally occurs when other included JSPs files already declares the same local variable in the current jsp file. for more info visit : http://www.appperfect.com/support/java-coding-rules/jsp.html#rule1. So please make sure you do not have the same variable in the included jsp files. Note: It is always good to avoid scripting in JSPs(as @duffymo told you use JSTL instead)
has comment: http://stackoverflow.com/comment/31081536
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31079932
has comment: http://stackoverflow.com/comment/31081438

http://stackoverflow.com/q/20729475
has answer: http://stackoverflow.com/a/20729815
has body: I'm currently working on a Java application that reads an Access file and builds a Jtable model using the data that's collected. I've previously done the same with an Excel file but when I tried with Jackcess it was slightly diffrent and I've ran into some questionmarks. My work so far: public class AccessModel{ public DefaultTableModel getAccessModel() throws IOException { Database db = DatabaseBuilder.open(new File("MyFile.accdb")); Vector&lt;String&gt; columnNames = new Vector&lt;String&gt;(); Vector&lt;String&gt; vector = new Vector&lt;String&gt;(); Vector&lt;Vector&lt;String&gt;&gt; data = new Vector&lt;Vector&lt;String&gt;&gt;(); StringBuilder output = new StringBuilder(); Table table = db.getTable("Table1"); for (Column column : table.getColumns()) { // get the table column names output.append(column.getName()); output.append("\n"); columnNames.add(column.getName()); } for (Column column : table.getColumns()) { // get the column rows and values vector.add(column.getRowValue(table.getNextRow()).toString()); } data.add(vector); // return the model to Gui DefaultTableModel accessModel = new DefaultTableModel(data, columnNames); return accessModel; } } As you can see this method will only iterate trough the first row, then exit the loop. I'm either blind to an abvious solution due to 12 hours of straight work, or I'm doing something terribly wrong. I've stumbled across some half-good solutions where an Iterator is used, but I cannot get the hang of it. Any suggestions on this? Or should I stay on lane with my current line of thought?
tagged with: jtable
has title: Reading a Access file using Jackcess and creating a Jtable with the data
accepted answer: http://stackoverflow.com/a/20729815
answer count: 1
downvote count: 0
score: 1
tagged with: ms-access
favorite count: 0
tagged with: jackcess
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/a/20802614
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20802509
has comment: http://stackoverflow.com/comment/31198090
answers question: http://stackoverflow.com/q/20802509
has comment: http://stackoverflow.com/comment/31199634
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31212273
has comment: http://stackoverflow.com/comment/31211755
has body: In similar situations I have done the following: Create an array of strings; as many strings as there are rows+columns+diagonals Traverse the grid in the four possible directions (this does not include every possible diagonal since diagonals must be at least 4 long) and enter a corresponding character in the string: for example 0 (empty), 1, 2 Search the string array for 1111 and 2222. By first organizing the data, the comparison can be done with a built in function. Much faster and cleaner. Here is how it might be done (this is the "slow and careful way"): class c4check { public static void main(String[] args) { char grid[][] = {{'e','e','e','e','a','b','a'}, {'e','a','b','a','b','b','a'}, {'e','b','a','a','b','b','a'}, {'e','a','b','b','a','b','b'}, {'e','b','a','b','b','a','a'}, {'e','a','b','a','b','b','a'}}; int ii, jj, ri, ci, di; String checkGrid[] = new String[25]; // copy rows: for(ri = 0; ri &lt; 6; ri++) { String temp = ""; for(ci = 0; ci &lt; 7; ci++) { temp += grid[ri][ci]; } checkGrid[ri] = temp; } // copy columns: for(ci = 0; ci &lt; 7; ci++) { String temp = ""; for(ri = 0; ri &lt; 6; ri++) { temp += grid[ri][ci]; } checkGrid[ci + 6] = temp; } // copy first diagonals: for(di = 0; di &lt; 6; di++) { String temp = ""; for(ri = 0; ri &lt; 6; ri++) { ci = di - 2; ri = 0; while(ci &lt; 0) { ri++; ci++; } for(; ri &lt; 6; ri++, ci++) { if( ci &gt; 6 ) continue; temp += grid[ri][ci]; } } checkGrid[di+13] = temp; } // diagonals in the other direction: for(di = 0; di &lt; 6; di++) { String temp = ""; for(ri = 0; ri &lt; 6; ri++) { ci = 8 - di; ri = 0; while(ci &gt; 6) { ri++; ci--; } for(; ri &lt; 6; ri++, ci--) { if( ci &lt; 0 ) continue; temp += grid[ri][ci]; } } checkGrid[di+19] = temp; } for(ii = 0; ii &lt; 25; ii++) { System.out.println("Checking '" + checkGrid[ii] + "'"); if (checkGrid[ii].contains("aaaa")) System.out.println("Player A wins!"); if (checkGrid[ii].contains("bbbb")) System.out.println("Player B wins!"); } } } Obviously, instead of copying t…

http://stackoverflow.com/comment/31183424
comment on: http://stackoverflow.com/q/20800140
has text: You want your condition to be `false` for empty strings, don't you? Well, it is not what you are getting...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20710502
tagged with: regex
favorite count: 0
upvote count: 1
has title: Java regular expression empty or my format
has answer: http://stackoverflow.com/a/20710523
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31024668
type: Question
has comment: http://stackoverflow.com/comment/31022580
downvote count: 0
accepted answer: http://stackoverflow.com/a/20710523
has body: Hello i have a regular expression that works [2-5][0-5]:[0-8][0-8] accepts numbers like 20:88, 35:14, 32:54, etc. I use the anotattion javax.validation.constraints.Pattern to validate entities. But I need to accept empty string or the format that I showed. I tried [^.]|[2-5][0-5]:[0-8][0-8] [^.]|([2-5][0-5]:[0-8][0-8]) ^.|[2-5][0-5]:[0-8][0-8] (^.)|[2-5][0-5]:[0-8][0-8] But not works. I tried put empty|myformat
answer count: 1

http://stackoverflow.com/comment/31244647
type: QuestionComment
has text: That is not specified by the Java language. It's up to the JVM implementation.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/20832717

http://stackoverflow.com/comment/31111659
score: 0
type: Comment
type: QuestionComment
has text: No @eatSleepCode, you just left out almost all information related to your question. If you'd actually included all the information at the beginning then it would be fine. There's no need to close the question, just to add the relevant information.
comment on: http://stackoverflow.com/q/20759428

http://stackoverflow.com/q/20704767
tagged with: android
has comment: http://stackoverflow.com/comment/31030072
has comment: http://stackoverflow.com/comment/31012241
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
has title: Data from a MySQL database is not displaying in Android Textview
type: Question
has comment: http://stackoverflow.com/comment/31011880
has comment: http://stackoverflow.com/comment/31012197
answer count: 1
tagged with: textview
has body: I can't display data from a MySQL database. I want to retrieve some data from my database and display it to the textview, but it's not working. Java code: public class Penjualan1 extends Activity { // All xml labels String pid; TextView mejaTv; TextView customerTv; TextView keteranganTv; // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jsonParser = new JSONParser(); // Profile JSON url private static final String url_order_detials = "-my url-/get_penjualan_details.php"; // ALL JSON node names private static final String TAG_PRODUCT = "product"; private static final String TAG_SUCCESS = "success"; private static final String TAG_GET = "get"; private static final String TAG_MEJA = "meja"; private static final String TAG_CUST = "customer"; private static final String TAG_KET = "keterangan"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.f_penjualan1); mejaTv = (TextView) findViewById(R.id.meja); customerTv = (TextView) findViewById(R.id.customer); keteranganTv = (TextView) findViewById(R.id.keterangan); // Loading Profile in Background Thread new GetProductDetails().execute(); } /** * Background Async Task to Get complete product details * */ class GetProductDetails extends AsyncTask&lt;String, String, String&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Penjualan1.this); pDialog.setMessage("Loading product details. Please wait..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } /** * Getting product details in background thread * */ protected String doInBackground(String... params) { // updating UI from Background Thread runOnUiThread(new Runnable() { public void run() { // Check for success tag // TODO Auto-generated method stub int success; try { // Building Parameters List&lt;NameValuePair&gt; params…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21762734

http://stackoverflow.com/a/20714850
downvote count: 0
has comment: http://stackoverflow.com/comment/31031033
has comment: http://stackoverflow.com/comment/31030940
has comment: http://stackoverflow.com/comment/31031022
score: 5
type: Answer
answers question: http://stackoverflow.com/q/20714804
has comment: http://stackoverflow.com/comment/31031007
has body: java -Xms4096m -Xmx4096m [YourAppHere] This command will allocate 4GB (or 4096 MB) of heap memory at the start (the -Xms4096m option), and will have a maximum heap memory size of 4GB (the -Xmx4096m option). Obviously you can change the number to whatever sizes you want to. There is overhead if the computer has to increase the size of memory (Every time it increases the memory size, it doubles the allocation) so if you have that much ram, you might as well just allocate it at the beginning of the app.
upvote count: 5
has comment: http://stackoverflow.com/comment/31030985
has comment: http://stackoverflow.com/comment/31030901
has comment: http://stackoverflow.com/comment/31031010
has comment: http://stackoverflow.com/comment/31030920
has comment: http://stackoverflow.com/comment/31030950

http://stackoverflow.com/comment/31138769
type: QuestionComment
has text: They all require a complete re-write, requiring different methods to loop through the files, create directories, etc. I set my loops up the way I did for a reason, and was really hoping I could adapt the progress bar to work with it, since my code is running as it should.
comment on: http://stackoverflow.com/q/20767241
score: 0
type: Comment

http://stackoverflow.com/comment/31119236
comment on: http://stackoverflow.com/q/20763595
score: 0
has text: @Charlie Oh yes!! I am able to send the message now correctly. Thanks so much, You saved my day!! :)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31202805
type: Comment
type: QuestionComment
has text: Look at my edited answer. Hope that helps you a bit
comment on: http://stackoverflow.com/q/20807941
score: 0

http://stackoverflow.com/comment/31183343
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20785975
has text: Does displaying different kind of data on the same chart makes sense ? Can it be user-comprehensible ? Displaying two stacked charts (one under the other) could be a better solution as their width and X axis are the same.

http://stackoverflow.com/comment/31283500
has text: Top sh*t solution! :)
type: AnswerComment
comment on: http://stackoverflow.com/a/20847868
type: Comment
score: 1

http://stackoverflow.com/comment/31155828
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik: You're right, sadly. Nevertheless, it got a +1 from me!
comment on: http://stackoverflow.com/q/20784493

http://stackoverflow.com/comment/31142472
comment on: http://stackoverflow.com/q/20776835
score: 2
has text: That's 0.1 second by _their_ clock, not yours. How are you so sure they're that much better than you at measuring time?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20759529
has comment: http://stackoverflow.com/comment/31111926
type: Question
has comment: http://stackoverflow.com/comment/31121001
has comment: http://stackoverflow.com/comment/31120407
has comment: http://stackoverflow.com/comment/31111957
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/20760021
has answer: http://stackoverflow.com/a/20760021
has title: How to efficiently manage memory/time in C++?
favorite count: 0
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/31111476
tagged with: c++
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31111448
has comment: http://stackoverflow.com/comment/31111405
has body: The case: I wrote a minimax algorithm in Java, then I ported the code in C++, mantaining the same classes and methods. Then I valgrinded the C++ code until all memory leaks were fixed by putting delete functions in destructors (when possible). When all leaks were fixed, I tested the algorithm on a tic-tac-toe game, which code was then ported identically in C++. I was sure that the C++ version would have been more performant, however I was surprised seeing that 100 (not random) instances of the game were solved in 125 seconds by C++ version while the Java version solved them in 30 seconds! Then, using System Monitor I checked the memory usage of the two programs: the Java code memory usage at the end of the test increased roughly 20% while with the C++ version the memory only increased of 5%. Then, at my eyes, it's clear that this delete policy is memory saving but kills time performance, which is not what I want, at least in this case. Is there another deletion policy to better design softwares which requires small runtime but allow high memory usage?
has comment: http://stackoverflow.com/comment/31111452
has answer: http://stackoverflow.com/a/20759649
tagged with: memory
accepted answer: http://stackoverflow.com/a/20759649

http://stackoverflow.com/a/20717069
score: 1
has comment: http://stackoverflow.com/comment/31034935
has comment: http://stackoverflow.com/comment/31034654
has comment: http://stackoverflow.com/comment/31034622
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31034951
type: Answer
has comment: http://stackoverflow.com/comment/31034794
has body: Straight from the javadoc: Creates an ObjectInputStream that reads from the specified InputStream. A serialization stream header is read from the stream and verified. This constructor will block until the corresponding ObjectOutputStream has written and flushed the header.
accepted answer of: http://stackoverflow.com/q/20716993
answers question: http://stackoverflow.com/q/20716993
upvote count: 1

http://stackoverflow.com/comment/31101336
score: 1
has text: KD Gregory doesn't understand what direct buffers are for. They are for use when copying between channels, when you don't actually need the data in the Java code at all. They *save* JNI-style operations, by not moving the data between the JNI side and the JVM side. If you're manipulating the data in Java, of course they are pointless and costly.
comment on: http://stackoverflow.com/q/20753058
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20765924
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20765900
score: 2
has comment: http://stackoverflow.com/comment/31122856
answers question: http://stackoverflow.com/q/20765900
has comment: http://stackoverflow.com/comment/31122869
type: AcceptedAnswer
downvote count: 0
has body: When you have a local variable it is on the stack. This stack is allocated when you enter a method, and freed when you return from a method. This stack is created when you start the thread and freed when you end the thread. The main thread you start with might not be freed until you exit the program. In many ways C++ and Java are the same as they both are compiled to machine code and this machine works the same as there is a single CPU architecture.
has comment: http://stackoverflow.com/comment/31122900
type: Answer

http://stackoverflow.com/comment/31180774
score: 0
type: QuestionComment
has text: PathVariable is spring's feature. not accessible in HttpServletRequest
comment on: http://stackoverflow.com/q/20798654
type: Comment

http://stackoverflow.com/comment/31009202
has text: Please post your code as an [SSCCE](http://www.sscce.org) that demonstrates your problem. This allows users to copy/paste and reproduce your issue.
score: 1
comment on: http://stackoverflow.com/q/20703336
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20826771
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31233015
has comment: http://stackoverflow.com/comment/67777770
has body: This can optimize a loop that is always executed at least once. A regular while loop will then always jump back to the start at least once and jump to the end once at the end. An example of a simple loop running once: int i = 0; while (i++ &lt; 1) { //do something } A do-while loop on the other hand will skip the first and last jump. Here is an equivalent loop to the one above, that will run without jumps: int i = 0; if (i++ &lt; 1) { do { //do something } while (i++ &lt; 1); }
has comment: http://stackoverflow.com/comment/31232967
answers question: http://stackoverflow.com/q/20826718
has comment: http://stackoverflow.com/comment/31233073
upvote count: 24
has comment: http://stackoverflow.com/comment/31232681
score: 24

http://stackoverflow.com/comment/31235374
type: QuestionComment
comment on: http://stackoverflow.com/q/20828143
score: 0
has text: call [`multiply()`](http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#multiply(java.math.BigInteger)) numbers are numbers, regardless of what base they are displayed in
type: Comment

http://stackoverflow.com/comment/31305215
has text: OK~Thanks for your patience and kindness . I've been using Play for serveral months.During this period I've reinstalled my operating systems for serveral times , too , including windows and Ubuntu.And I also clear my whole hard disk and reinstalled all my operating systems once just a week ago.And All my software were also been reinstalled again .
comment on: http://stackoverflow.com/a/20785844
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20793293
tagged with: join
tagged with: java
tagged with: hibernate
has title: Hibernate JoinTable multiple types
type: Question
upvote count: 2
has body: I'm trying to set up a many to many relationship between two entities, where there are multiple relationship types. For example, lets say we have a table "course", a table "person", and a mapping table "course_person". Any given course can have instructors, graders, and students, each of which are collections from the person table. Each person can be affiliated with multiple courses in different roles. The table "course_person" has columns "course_id", "person_id", and "type", where type is "INSTRUCTOR", "GRADER", or "STUDENT". The Course class would have three different Set members, each one listing the people in the given role. It would look something like this: @Entity @Table(name = "course") public class Course{ private Set&lt;Person&gt; instructors; private Set&lt;Person&gt; graders; private Set&lt;Person&gt; students; @ManyToMany( targetEntity=Person.class, cascade={CascadeType.PERSIST, CascadeType.MERGE} ) @JoinTable( name="course_person", joinColumns=@JoinColumn(name="course_id"), inverseJoinColumns=@JoinColumn(name="person_id") ) @WhereJoinTable(clause="type='INSTRUCTORS'") public Set&lt;Person&gt; getInstructors() { return this.instructors; } @ManyToMany( targetEntity=Person.class, cascade={CascadeType.PERSIST, CascadeType.MERGE} ) @JoinTable( name="course_person", joinColumns=@JoinColumn(name="course_id"), inverseJoinColumns=@JoinColumn(name="person_id") ) @WhereJoinTable(clause="type='GRADER'") public Set&lt;Person&gt; getGraders() { return this.graders; } @ManyToMany( targetEntity=Person.class, cascade={CascadeType.PERSIST, CascadeType.MERGE} ) @JoinTable( name="course_person", joinColumns=@JoinColumn(name="course_id"), inverseJoinColumns=@JoinColumn(name="person_id") ) @WhereJoinTable(clause="type='STUDENT'") public Set&lt;Person&gt; getStudents() { return this.students; } } This works fine for reading the data from the database. However, it doesn't work for creating new entries in the map table, because hibernate doesn't know what to set "type" to. I …
favorite count: 0
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31171441
has comment: http://stackoverflow.com/comment/31172231

http://stackoverflow.com/q/20717270
has answer: http://stackoverflow.com/a/20717399
tagged with: java
has title: I get exception message using log4j
has comment: http://stackoverflow.com/comment/31034944
answer count: 2
possible better answer: http://stackoverflow.com/a/20717294
has answer: http://stackoverflow.com/a/20717294
score: 0
accepted answer: http://stackoverflow.com/a/20717399
tagged with: exception
has comment: http://stackoverflow.com/comment/31035104
tagged with: log4j
type: Question
type: AnsweredQuestion
has body: I am using log4j to log errors to a file, however, I keep getting the following error when ever I run my program, although the log file gets created and the error is logged in the file, but only when I quit the program Error log4j:ERROR Could not read configuration file [log4j.properties]. java.io.FileNotFoundException: log4j.properties (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:131) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:87) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:372) at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:403) at javafxapplication4.JavaFXApplication4.init(JavaFXApplication4.java:227) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:788) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:724) log4j:ERROR Ignoring configuration file [log4j.properties]. Code: PropertyConfigurator.configure("log4j.properties"); ... catch(SQLException e) { System.out.println("Error on Database connection"); System.out.print(e.getMessage()); logger.error("Your log message", e); } Configuration file: log4j.rootLogger=debug, stdout, R log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=/log/example.log log4j.appender.R.MaxFileSize=100KB # Keep one backup file log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

http://stackoverflow.com/a/20809744
upvote count: 1
has body: In C#, you can have generic methods: class Foo&lt;X&gt; { public T DoSomethingFunky&lt;T&gt;( ... ) { ... } } But there's no way to have a wildcard type &mdash; a big fail in C#. It would be very useful in a lot of situations where you that it is a Widget&lt;T&gt; but you don't care about the particulars of T. For instance, WCF throws FaultException&lt;T&gt;, where the various flavors of T are service specific. There's no way to catch something like FaultException&lt;*&gt; without simply catching the base Exception class and using reflection to inspect the caught exception to see if it's an interesting T. This prevents handling service faults in a generic way. I believe the reason is that a concrete generic class (Widget&lt;int&gt;) are not really subtypes of the generic class (Widget&lt;T&gt;) it "inherits" from. The generic class is simply used as a template to compile a new specific class. The one thing you could do, is have your generic template (Widget&lt;T&gt;) inherit from a non-generic base class (Widget) and have your method return that: class AbstractWidget { ... } class Widget&lt;T&gt; : AbstractWidget { ... } . . . public Widget GetGeneric Widget() { /* flavor determinated at runtime */ } It's incumbent upon the caller to decide what to do with its Widget.
answers question: http://stackoverflow.com/q/20809171
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31277364
accepted answer of: http://stackoverflow.com/q/20809171
downvote count: 0
type: Answer

http://stackoverflow.com/q/20814314
tagged with: java
has comment: http://stackoverflow.com/comment/31212060
tagged with: sax
type: Question
linked to: http://stackoverflow.com/q/373833
has comment: http://stackoverflow.com/comment/31219858
has answer: http://stackoverflow.com/a/20818918
has comment: http://stackoverflow.com/comment/31211850
score: 0
has title: Read parent and child at the same time using SAX Parser in Java
answer count: 1
has body: I have a very small xml file, which I just want to read in Java. After referring this post, I decided to go with SAX parser. My xml file looks like below- &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;catalog&gt; &lt;library name="Central Library"&gt; &lt;read&gt; &lt;book id="001" lang="ENG" title="Operating System Concepts" author="Silberschatz" /&gt; &lt;book id="002" lang="ENG" title="Design Patterns: Elements of Reusable Object-Oriented Software" author="Gangs of Four" /&gt; &lt;/read&gt; &lt;unread&gt; &lt;book id="003" lang="ENG" title="Introduction to Algorithms" author="Cormen" /&gt; &lt;book id="004" lang="ENG" title="Computer networks" author="Tanenbaum" /&gt; &lt;/unread&gt; &lt;/library&gt; &lt;/catalog&gt; While reading this xml, I am unable to identify read and unread books. Below is the parser code- import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ParseXML extends DefaultHandler { private Library lib; public ParseXML(String file) throws ParserConfigurationException, SAXException, IOException { parse(file); } private void parse(String file) throws ParserConfigurationException, SAXException, IOException { final SAXParserFactory factory = SAXParserFactory.newInstance(); final SAXParser parser = factory.newSAXParser(); parser.parse(file, this); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals("library")) { String name = attributes.getValue("name"); lib = new Library(name); } if (qName.equals("book")) { String id = attributes.getValue("id"); String lang = attributes.getValue("lang"); String title = attributes.getValue("title"); String author = attributes.getValue("author"); Book book = new Book(id, lang, title, author); // How to d…
accepted answer: http://stackoverflow.com/a/20818918
has comment: http://stackoverflow.com/comment/31210334
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/31117556
comment on: http://stackoverflow.com/a/20762924
type: Comment
has text: why do you include all the libs besides resteasy-jaxrs-3.0.6.Final? Do you need them for parts of your application? Did you follow a tutorial? If so, could you point me to its URL?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/30982125
comment on: http://stackoverflow.com/q/20688085
type: QuestionComment
score: 2
has text: There is a good discussion on this entire topic here: <http://programmers.stackexchange.com/questions/118703/where-did-the-notion-of-one-return-only-come-from>
type: Comment

http://stackoverflow.com/a/20804603
has comment: http://stackoverflow.com/comment/31191937
has comment: http://stackoverflow.com/comment/31191497
has body: " what is happening is I go to open file.." You don't want to open the file. You want to open the project Click on File menu Click on import Click on General Select on Existing Projects into Workspace. CLlick Next Click Browse to search from your project Select the Project, Click OK Click Finish The project should now show in your package explorer and you can then run it.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20803960
has comment: http://stackoverflow.com/comment/31191711
accepted answer of: http://stackoverflow.com/q/20803960
has comment: http://stackoverflow.com/comment/31192014
has comment: http://stackoverflow.com/comment/31191488
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20778494
has body: Consider using a JToolBar instead of a JPanel, as it has it's own layout manager, which, basically, does this any way. Images from following tutorial... Check out How to use Tool Bars for more details
upvote count: 12
score: 12
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20778470
answers question: http://stackoverflow.com/q/20778470
type: Answer

http://stackoverflow.com/comment/31160882
type: Comment
score: 0
type: AnswerComment
has text: ok, thanks :D i will accept your answer after the limit is gone ("You can accept an answer in 3 minutes")
comment on: http://stackoverflow.com/a/20787588

http://stackoverflow.com/q/20716169
has comment: http://stackoverflow.com/comment/31113817
possible better answer: http://stackoverflow.com/a/20725753
tagged with: java
tagged with: query-performance
has comment: http://stackoverflow.com/comment/31038944
has answer: http://stackoverflow.com/a/20725753
has comment: http://stackoverflow.com/comment/31036527
type: Question
has comment: http://stackoverflow.com/comment/31036091
has answer: http://stackoverflow.com/a/20816215
downvote count: 0
has comment: http://stackoverflow.com/comment/31039054
answer count: 3
has comment: http://stackoverflow.com/comment/31036699
tagged with: jdbc
upvote count: 6
has body: I am using singleton database connection inside my java application, here is code of my connection manager class: public abstract class DatabaseManager { //Static instance of connection, only one will ever exist private static Connection connection = null; private static String dbName="SNfinal"; //Returns single instance of connection public static Connection getConnection(){ //If instance has not been created yet, create it if(DatabaseManager.connection == null){ initConnection(); } return DatabaseManager.connection; } //Gets JDBC connection instance private static void initConnection(){ try{ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName="+dbName+";integratedSecurity=true"; DatabaseManager.connection = DriverManager.getConnection(connectionUrl); } catch (ClassNotFoundException e){ System.out.println(e.getMessage()); System.exit(0); } catch (SQLException e){ System.out.println(e.getMessage()); System.exit(0); } catch (Exception e){ } } public static ResultSet executeQuery(String SQL, String dbName) { ResultSet rset = null ; try { Statement st = DatabaseManager.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); rset = st.executeQuery(SQL); //st.close(); } catch (SQLException e) { System.out.println(e.getMessage()); System.exit(0); } return rset; } public static void executeUpdate(String SQL, String dbName) { try { Statement st = DatabaseManager.getConnection().createStatement(); st.executeUpdate(SQL); st.close(); } catch (SQLException e) { System.out.println(e.getMessage()); System.exit(0); } } } The problem is my code work perfect at the start but when time past it becomes really slow. What caused that problem and how can i fix that? At starting time my application handles around 20 queries per second, after 1 hour of running it reaches to 10 queries per second and after 3 days of running it reaches to 1 query per 10 seconds!! P.S: M…
has title: Traditional DB singleton connection works poorly
accepted answer: http://stackoverflow.com/a/20816215
favorite count: 0
has comment: http://stackoverflow.com/comment/31033070
score: 6
has comment: http://stackoverflow.com/comment/31036956
has comment: http://stackoverflow.com/comment/31037332
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31039222
has comment: http://stackoverflow.com/comment/31039286
has answer: http://stackoverflow.com/a/20725590

http://stackoverflow.com/q/20691344
favorite count: 0
has body: So I have this code for Linked Node Stack (in short Linked Stack) and It confuses me very much! I have an exam tomorrow on that and it confuses me a lot! So take a look: class Node&lt;T&gt; { T item; // data in node Node&lt;T&gt; next = null; // successor node Node(T item0, Node&lt;T&gt; next0) { item = item0; next = next0; } } That is easy to understand no problem, we create a class called Node (it's a data structure) which contains an item of type T (can be String, Integer etc..) and another Node called next to indicate the next Node in line. Everything is clear. Off with that! Now's time for the Stack itself, so here's the code: class Stack&lt;T&gt; { private Node&lt;T&gt; head = null; // first node (null if empty) Stack() {} Stack(int n) {} boolean isEmpty() {return(head==null);} boolean push(T t) { head = new Node&lt;&gt;(t,head); return true; // always space available } T pop() { if (head==null) return null; T t = head.item; head = head.next; return t; } } Now here's where I lose my mind! OK so! First off when we initiate the Stack we create a Node with name head okay! Got it and it's null yes! Next, black magic to me is when we use the push(T t) method. So we say head = new Node&lt;&gt;(t, head) okay okay! slow down there fellow! We replace the existing null head with a new Node which contains the data t and as the next node, it carries itself?? so head = data, head(null,null)..? What if we add a 2nd element? it's going to be again head = data, head(data, head(null, null)... ? Please explain this to me in plain english! :(
answer count: 4
possible better answer: http://stackoverflow.com/a/20691559
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20691559
score: 1
tagged with: stack
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/30988720
has title: Java LinkedStack next = head?
has answer: http://stackoverflow.com/a/20691569
has comment: http://stackoverflow.com/comment/30988559
downvote count: 0
accepted answer: http://stackoverflow.com/a/20691569
has answer: http://stackoverflow.com/a/20691580
has answer: http://stackoverflow.com/a/20691623

http://stackoverflow.com/a/20774380
has comment: http://stackoverflow.com/comment/31137865
has comment: http://stackoverflow.com/comment/31138036
has comment: http://stackoverflow.com/comment/31138245
has comment: http://stackoverflow.com/comment/31139980
has comment: http://stackoverflow.com/comment/31139882
has comment: http://stackoverflow.com/comment/31138198
downvote count: 0
has comment: http://stackoverflow.com/comment/31137793
accepted answer of: http://stackoverflow.com/q/20774288
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20774288
has body: Try to run mvn validate in your project root (where project pom.xml is located) via cmd. If succeeded, it will download all your dependencies into your local repository. Then you should search for maven repository configuration in netbeans options and make sure that your local repository is added there.
type: Answer
has comment: http://stackoverflow.com/comment/31137734
has comment: http://stackoverflow.com/comment/31138008
has comment: http://stackoverflow.com/comment/31138777
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31137640

http://stackoverflow.com/comment/31218789
comment on: http://stackoverflow.com/q/20819228
score: 0
has text: Please construct a [minimal test-case](http://sscce.org) that demonstrates this.
type: Comment
type: QuestionComment

websocket
tags question: http://stackoverflow.com/q/20727030
tags question: http://stackoverflow.com/q/20730752
tags question: http://stackoverflow.com/q/20740956
type: Tag
tags question: http://stackoverflow.com/q/20836434
tags question: http://stackoverflow.com/q/20804235
tags question: http://stackoverflow.com/q/20747283
tags question: http://stackoverflow.com/q/20818237
tags question: http://stackoverflow.com/q/20774716
tag name: websocket
tags question: http://stackoverflow.com/q/20723818

http://stackoverflow.com/comment/47762663
comment on: http://stackoverflow.com/a/20823005
type: AnswerComment
has text: Late Comment, but for fuzzyDL you should have consider the README first because it says that you need to install the gurobi tool. If you dont, then you get some `NullPointerException`. Bad software engineering I know, since fuzzyDL could warn you about the missing dependency, but its free code.
score: 0
type: Comment

http://stackoverflow.com/a/20720503
has comment: http://stackoverflow.com/comment/31040952
has comment: http://stackoverflow.com/comment/31040804
has comment: http://stackoverflow.com/comment/31040920
has comment: http://stackoverflow.com/comment/31040903
has comment: http://stackoverflow.com/comment/31040748
downvote count: 2
has comment: http://stackoverflow.com/comment/31040713
has comment: http://stackoverflow.com/comment/31040775
has comment: http://stackoverflow.com/comment/31041094
has comment: http://stackoverflow.com/comment/31040881
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/31040741
has comment: http://stackoverflow.com/comment/31040829
has comment: http://stackoverflow.com/comment/31040868
answers question: http://stackoverflow.com/q/20720341
has body: All the code that was showed here is invalid because the user can enter 0 and 0 should be printed out. The valid code will look the following way do { System.out.print( number % 10 ); number = number / 10; if ( number != 0 ) System.out.print( "," ); } while ( number != 0 );
has comment: http://stackoverflow.com/comment/31040822
type: Answer

http://stackoverflow.com/q/20840860
accepted answer: http://stackoverflow.com/a/20841653
favorite count: 0
tagged with: netbeans
tagged with: maven
upvote count: 1
has title: How to open a Apache Maven project on NetBeans 7.0.1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20842401
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20842401
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20841653
downvote count: 0
has body: I'm trying to open a project created with Apache Maven in NetBeans, with no success. I followed the directions given by this link: http://wiki.netbeans.org/MavenBestPractices but the Open Project dialog does not recognizes the project in the folder. When I point to the folder that contains the pom.xml file, it shows as if the folder is empty, except for the sub-folders. Apparently Apache Maven is disabled, but I can't find how to enable it. Could someone point what is the mistake that I'm doing?

http://stackoverflow.com/comment/31267964
has text: I solved the issue myself. But thanks for an example.
type: Comment
comment on: http://stackoverflow.com/a/20845740
score: 1
type: AnswerComment

http://stackoverflow.com/comment/30981688
has text: You could create a class that represents the dealership. This class could contain a list of Vehicles and other class you have.
comment on: http://stackoverflow.com/a/20686353
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31075260
type: Comment
has text: I would like to fix the bugs from APP, however, the IOS development team there can't reproduce such problems. There is a dialog to ask user to confirm if they want subscribe or not.When clicked, then user can't do anything until the process behind is done. So it should be OK in this case.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20738740

http://stackoverflow.com/comment/31208850
score: 0
has text: Here you go, thanks for helping, http://privatepaste.com/35743e3326, its a bit of a mess at the moment sorry, I kind of stopped trying to figure out your way, and was trying to do the same thing except using a scrollbarchange event
type: Comment
comment on: http://stackoverflow.com/a/20812648
type: AnswerComment

http://stackoverflow.com/comment/31221693
comment on: http://stackoverflow.com/q/20820769
type: QuestionComment
type: Comment
score: 1
has text: There will be a dead process somewhere in the background, kill it via task manager. It will be named java or javaw, you may want to close your IDE first, to avoid killing it inadvertently. That being said, you should ***really*** improve your error handling, as right now you don't do anything with errors except write them on screen, and then continue just to see the next line crash and burn.

http://stackoverflow.com/comment/31084127
has text: Try JD-Gui java decompiler.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20744456

http://stackoverflow.com/comment/31240061
type: QuestionComment
score: 1
has text: You can just `return itemPricRule` from within the for-loop. That takes away four lines of code.
comment on: http://stackoverflow.com/q/20830480
type: Comment

http://stackoverflow.com/q/20808388
tagged with: replace
has title: Replace a character specific number of times in String Java
has comment: http://stackoverflow.com/comment/31198460
upvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/31198550
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31198465
has body: I want to have a string with matched number of parentheses. So, I count the number of open and close parentheses. Then, I want to replace the extra ones with empty char but actually I'm not able to use replace method in java since it does not accept any limitations in numbers unless you just want the first one. Any ideas? For example: ((A) -> (A) or (A)) -> (A) Here is a code I have but currently using replace() method, replaces all the open or close parentheses not specific number of times. int count1 = str.length() - str.replace("(", "").length(); int count2 = str.length() - str.replace(")", "").length(); if (count1 == count2) return str; else if (count1 &gt; count2){ str = str.replace("(", ""); return str; } else if (count2 &gt; count1){ str = str.replace(")", ""); return str; }
answer count: 1
has answer: http://stackoverflow.com/a/20808920
downvote count: 6
score: -6
tagged with: java
has comment: http://stackoverflow.com/comment/31198461

http://stackoverflow.com/comment/31258229
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20839579
has text: @ Vinoth I have been using this root folder: CLASSPATH: C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib but just found out one that is:C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\WEB-INF\lib which I guess could be the right folder. Let me add the .jar file and re-run the project. I will post my verdict immediately.
score: 0

http://stackoverflow.com/comment/30992646
score: 0
has text: Thanks. I'm trying to use [Kohsuke's GitHub API For Java](http://github-api.kohsuke.org/index.html) from the list of libraries mentioned in [developer.github.com/libraries]. I'm able to connect to a public repository and get [GHBranch](http://github-api.kohsuke.org/apidocs/index.html) object. However, I can't find any clue to pull the file/directory listings. I've sent an email to the author of the API.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20692974

http://stackoverflow.com/comment/31054828
type: Comment
comment on: http://stackoverflow.com/a/20701027
score: 0
type: AnswerComment
has text: +1 for counts.put(str[0] + "#" + str[1], Integer.parseInt(str[2])); this line... saved the day! :)

http://stackoverflow.com/comment/31242918
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20831411
has text: @camickr It didn't work for me. I added more info.
score: 0

http://stackoverflow.com/a/20819508
type: Answer
answers question: http://stackoverflow.com/q/20819453
has comment: http://stackoverflow.com/comment/31220818
accepted answer of: http://stackoverflow.com/q/20819453
has comment: http://stackoverflow.com/comment/31219482
type: AcceptedAnswer
score: 2
has body: You seem to be suffering from a lot of confusion as to classes, interfaces, etc so it's actually hard to know where to begin! First up your Listener class needs to implement ActionListener. Then you need to add it inside your HangmanView class the same way you already are: public class Listener implements ActionListener { @Override public void actionPerformed(ActionEvent e) {// right click key JOptionPane.showMessageDialog(dialogFrame, "Developer: Joe" , "Developer", JOptionPane.INFORMATION_MESSAGE); }// end actionPerformed method }); And that's it, you are done...
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/31245635
type: QuestionComment
type: Comment
has text: @Craig In the Oracle site itself. If you're not familiar with the concept, read about it here: http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html
comment on: http://stackoverflow.com/q/20833433
score: 0

http://stackoverflow.com/a/22213615
has comment: http://stackoverflow.com/comment/41201026
score: 100
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/105717027
has comment: http://stackoverflow.com/comment/124726348
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/59966641
accepted answer of: http://stackoverflow.com/q/20714058
has body: For those with this problem, add this to AndroidManifest.xml: &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; Problem solved :D EDIT: If this does not work just make sure if path is correct
answers question: http://stackoverflow.com/q/20714058
upvote count: 101

http://stackoverflow.com/q/20729603
has answer: http://stackoverflow.com/a/20729644
answer count: 1
tagged with: classloader
tagged with: urlclassloader
tagged with: annotations
has title: java.net.URLClassLoader doesn't add class annotations
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20729644
tagged with: java
type: Question
has body: While developing a ant - task to autogenerate some gui - code for a project using annotations as I prefer a declarative approach I am using the java.net.URLClassLoader to dynamically add the classes to my class path. When scanning the classes for class - level - annotations none of them is found though they exists. e.g. @AutoGenerateGUI class LoginBean Has anyone else experienced this problem and can provide a solution? (Subclassing the URLClassLoader to make the call to loadClass internally be treated as loadClass(Class clazz, true) didn't work neither) Thanks to https://stackoverflow.com/users/1103872/marko-topolnik In Addition: Retrieving the annotations of the dynamically loaded classes always returned com.sun.proxy.$Proxy[x], so to get to the original annotation type I had to use the construct URLClassLoader loads Annotation as com.sun.$Proxy$27 iterating over the interfaces the proxy object implements. Though this should not be necessary, indeed other solutions e.g. using instanceof failed.
linked to: http://stackoverflow.com/q/18282337
score: 0

http://stackoverflow.com/a/20720782
type: Answer
accepted answer of: http://stackoverflow.com/q/20720638
score: 3
downvote count: 0
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20720638
has body: Guava supplies an inversion method for Multimap. See Multimaps.invertFrom. This might do fine for you if you don't frequently need the inversion, or if your multimap is small. But this inversion is an expensive process. You can likely gain some efficiency by simply maintaining both forward and reverse as suggested by JB Nizet in comments. Both however can be multimaps to allow for non-uniqueness.

http://stackoverflow.com/comment/31069358
score: 1
comment on: http://stackoverflow.com/q/20735743
has text: You didn't update the format, you broke it again. I have reversed it for that reason. You can see the results of your changes realtime in the box underneath your editing field. Writing uncompilable code doesn't break your computer, just start trying.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20830673
has comment: http://stackoverflow.com/comment/31241275
tagged with: log4cxx
has comment: http://stackoverflow.com/comment/31241105
has comment: http://stackoverflow.com/comment/31387756
possible better answer: http://stackoverflow.com/a/20941952
has body: My problem concerns logging of library classes (classes that are used inside libraries), We are currently using log4cxx but the log4j library implements the same concepts. Say i have a process that have several entities, A,B and C. Each of them use many different classes and functions, clearly separated in the code. A,B and C use many library classes, functions, objects, resources and sometimes even globals (legacy code, nothing i can do about it...) - let us call them all foo Logging A,B and C turned out to be a performance issue, the log gets blasted when we set the log level to debug. After viewing our system we came to these conclusions: We want to be able to change debug level for only one of the classes at a time (or all of them, using root) When all kind of foo print to log, we need to see which entity called it, A, B or C. As there are many foo we want to be able to change the debug level separately for each foo A foo should be treated as a common library, it can not depend directly on A,B or C. A,B and C might use the same instance of foo (for example, the same instance of our resource handling class is used A,B and C), in the log we would like to see which class used foo. A could use B (or C), but we dont have to see it in the log... This is what we came up with so far - A, B and C will have separate loggers. A global variable(kept in a different library with all of our logging helpers and wrappers) will always keep the current log reporting. Every time an entity starts handling it's logic, it sets the global variable to the proper logger. When a foo wants to report to the log, it reports through the global variable and adding it's name (and context) to the log message. Problem is, it feels like there must be something that does this already, the solution does not feel clean, holding a global variable like that... Are we doing something wrong here? Is there a better solution to this?
tagged with: log4j
score: 8
tagged with: c++
has comment: http://stackoverflow.com/comment/31241518
has comment: http://stackoverflow.com/comment/31240827
downvote count: 0
tagged with: logging
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31241217
tagged with: java
has answer: http://stackoverflow.com/a/20941952
has answer: http://stackoverflow.com/a/20990878
has comment: http://stackoverflow.com/comment/31241393
accepted answer: http://stackoverflow.com/a/20990878
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/31382286
has comment: http://stackoverflow.com/comment/31241368
answer count: 2
has title: different loggers used with libraries
has comment: http://stackoverflow.com/comment/31241164
has comment: http://stackoverflow.com/comment/31240574
has comment: http://stackoverflow.com/comment/31241487
has comment: http://stackoverflow.com/comment/31382394
has comment: http://stackoverflow.com/comment/31241199
has comment: http://stackoverflow.com/comment/31240661
has comment: http://stackoverflow.com/comment/31387705
favorite count: 0

http://stackoverflow.com/a/20797112
accepted answer of: http://stackoverflow.com/q/20692053
upvote count: 4
has comment: http://stackoverflow.com/comment/31768305
has comment: http://stackoverflow.com/comment/32052779
has comment: http://stackoverflow.com/comment/32046371
has comment: http://stackoverflow.com/comment/31723237
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31771116
downvote count: 0
has comment: http://stackoverflow.com/comment/31944759
type: Answer
has comment: http://stackoverflow.com/comment/31792453
score: 4
has body: Not SWIG, but the following works with JavaCPP (which does not come with the kind of overhead JNA has, and works wherever JNI works): // items.h typedef struct { int id; const char* name; } Item; typedef int (*Items_Callback)(const Item *item, void *context); typedef struct { int value; Items_Callback callback; void *context; } Items_Call; int Items_create(const Item *item, Items_Call *call) { // ... call-&gt;callback(item, call-&gt;context); // ... return 0; } And in Java: import com.googlecode.javacpp.*; import com.googlecode.javacpp.annotation.*; @Platform(include="items.h") public class Items { static { Loader.load(); } public static class Item extends Pointer { public Item() { allocate(); } private native void allocate(); public native int id(); public native Item id(int id); @Cast("const char*") public native BytePointer name(); public native Item name(BytePointer name); } public static class Items_Callback extends FunctionPointer { protected Items_Callback() { allocate(); } private native void allocate(); public native int call(@Const Item item, Pointer context); } public static class Items_Call extends Pointer { public Items_Call() { allocate(); } private native void allocate(); public native int value(); public native Items_Call value(int value); public native Pointer context(); public native Items_Call context(Pointer context); public native Items_Callback callback(); public native Items_Call callback(Items_Callback value); public void setInterface(Items_Callback i) { callback(i); } } public static native void Items_create(Item item, Items_Call call); public static void main(String[] args) { BytePointer s = new BytePointer("Hello"); Item i = new Item(); i.id(42); i.name(s); Items_Callback cb = new Items_Callback() { public int call(Item item, Pointer context) { System.out.println(item.id() + " " + item.name().getString()); return 0; } }; Items_Call ic = new Items_Call(); ic.callback(cb); Items_create(i, ic); // if we remove these references, the GC may pre…
has comment: http://stackoverflow.com/comment/31767851
answers question: http://stackoverflow.com/q/20692053
has comment: http://stackoverflow.com/comment/32054541
has comment: http://stackoverflow.com/comment/31928078

http://stackoverflow.com/comment/31199708
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20808490
type: QuestionComment
has text: I've now done so, and compared the results using textdiff.com, which reports that they're equal (and an eyeball check agrees). I've added the XML to the question.

http://stackoverflow.com/q/20738079
tagged with: algorithm
has title: Why should we copy an ArrayList in some recursive alogrithms?
has answer: http://stackoverflow.com/a/20738390
tagged with: arraylist
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20738430
has body: http://oj.leetcode.com/problems/subsets-ii/ Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: * Elements in a subset must be in non-descending order. * The solution set must not contain duplicate subsets. For example, If S = [1,2,2], a solution is: [ [2], [1], [1,2,2], [2,2], [1,2], [] ] The answer is: public class Solution { public ArrayList&lt;ArrayList&lt;Integer&gt;&gt; subsetsWithDup(int[] num) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; ans = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); ArrayList&lt;Integer&gt; tmp = new ArrayList&lt;Integer&gt;(); Arrays.sort(num); sub(num, 0, tmp, ans); return ans; } public void sub(int[] num, int k, ArrayList&lt;Integer&gt; tmp, ArrayList&lt;ArrayList&lt;Integer&gt;&gt; ans) { ArrayList&lt;Integer&gt; arr = new ArrayList&lt;Integer&gt;(tmp); ans.add(arr); for (int i = k; i &lt; num.length; i++) { if (i != k &amp;&amp; num[i] == num[i-1]) continue; tmp.add(num[i]); sub(num, i+1, tmp, ans); tmp.remove(tmp.size()-1); } } } I don't know why ArrayList&lt;Integer&gt; arr = new ArrayList&lt;Integer&gt;(tmp); ans.add(arr); But not directly: ans.add(tmp);
accepted answer: http://stackoverflow.com/a/20738390
possible better answer: http://stackoverflow.com/a/20738279
has answer: http://stackoverflow.com/a/20738279
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31073408
type: Question

http://stackoverflow.com/q/20782820
tagged with: java
tagged with: windows-services
has body: I'm have a java application. Thi application run as windows service (with procrun wrapper) on Windows Server 2008 r2. Application install as windows service via install.bat file with this text: set "APPLICATION_SERVICE_HOME=%cd%" set SERVICE_NAME=CollectDO set PR_DESCRIPTION= Обеспечивает прием сведений по ДО и запись их в БД set PR_DISPLAYNAME=Сбор данных по ДО set EXECUTABLE_NAME=prunsrv.exe set PR_INSTALL=%APPLICATION_SERVICE_HOME%\%EXECUTABLE_NAME% REM Service log configuration set PR_LOGPREFIX=%SERVICE_NAME% set PR_LOGPATH=%APPLICATION_SERVICE_HOME%\Servicelog set PR_LOGLEVEL=Info REM Path to java installation set PR_JVM=..\..\jre\bin\server\jvm.dll set PR_CLASSPATH=..\dist\SvhWinService.jar REM Startup configuration set PR_STARTUP=auto set PR_STARTMODE=jvm set PR_STARTCLASS=svhwinservice.SvhWinServWrapper set PR_STARTMETHOD=start REM Shutdown configuration set PR_STOPMODE=jvm set PR_STOPCLASS=%PR_STARTCLASS% set PR_STOPMETHOD=stop REM JVM configuration set PR_JVMMS=256 set PR_JVMMX=1024 set PR_JVMSS=4000 set PR_JVMOPTIONS=-Duser.language=EN;-Duser.region=en :remove ::---- Remove the service ------- %EXECUTABLE_NAME% //DS//%SERVICE_NAME% echo The service '%SERVICE_NAME%' has been removed REM goto end REM Install service %EXECUTABLE_NAME% //IS//%SERVICE_NAME% When I'm start this file from console (cmd.exe) as administrator - then service deploy normal. But if i'm create shortcut to install.bat and try start as administratot - then service not deploy. I'm think that this is because user control account (because on Windows XS and Windows Server 2003 deploy from shortcut work fine), but I can not change these settings. How resoved this trouble on Windows server 2008 r2?
type: Question
tagged with: procrun
has title: Can't deploy application as windows service from shortcut in Windows Server 2008 r2
score: 0
answer count: 1
tagged with: windows-server-2008
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20836186

http://stackoverflow.com/q/20686686
upvote count: 1
has body: I am taking questions from user input which is being scanned for information and i am saving the information and the original question. What is the best way to save the question+information so that it can be recalled so that i am able to read X questions before the question just asked and get the information/variables on it? An example: [User]"what is 1+1?" [Reply]"two" save information: "what is 1+1","two" [User]"how is the dog?" [Reply]"fine" save information:"how is the dog?",subject = "dog", condition = "fine" getQuestion(1) -&gt; "what is 1+1?" getInformation(current) -&gt; subject = "dog" condition = "fine" Also what would be better to call the information for each question using, an int (question X), string (question) or other? Code so far: Map&lt;String,String&gt; variable = new HashMap&lt;&gt;(); public QuestionInfo(String name,String variable) { this.variable.put(name, variable); } public String get(String name){ if(variable.containsKey(name)) { return variable.get(name); } else { return ""; } } I though about using: Map&lt;String,QuestionInfo&gt; Questions = new HashMap&lt;&gt;(); first but then if i wanted to call i cant use an int so instead: Map&lt;Integer,QuestionInfo&gt; Questions = new HashMap&lt;&gt;(); then i can add the question as the first piece of information.
favorite count: 0
has answer: http://stackoverflow.com/a/20686968
tagged with: io
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/30982414
tagged with: java
tagged with: save
tagged with: file
has title: Java reading past saved variables
type: Question
possible better answer: http://stackoverflow.com/a/20686968
tagged with: stanford-nlp
has comment: http://stackoverflow.com/comment/30979777
has comment: http://stackoverflow.com/comment/30979651
has answer: http://stackoverflow.com/a/20687016
accepted answer: http://stackoverflow.com/a/20687016
answer count: 2

http://stackoverflow.com/a/20760128
has body: Replace while with if if(str.length()&gt;0) Update: The reason while fails is, after str.length() becomes 0, it hits the bottom of recursion, and control returns to the "higher" level, where str.length() is still 1. So it again calls itself. So with while ,after it reaches 0, it will keep looping continuously between 1 and 0.
score: 4
answers question: http://stackoverflow.com/q/20760062
has comment: http://stackoverflow.com/comment/31112820
type: Answer
has comment: http://stackoverflow.com/comment/31113015
upvote count: 4
has comment: http://stackoverflow.com/comment/31112734
downvote count: 0
has comment: http://stackoverflow.com/comment/31112415
has comment: http://stackoverflow.com/comment/31113108
has comment: http://stackoverflow.com/comment/31112755

http://stackoverflow.com/a/20713288
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20713160
downvote count: 0
has body: Iterate just once! define a static Map and fill it in a static block at load time. final static Map&lt;Integer, VideoBandwidth&gt; cache = new HashMap&lt;&gt;(); static { for(VideoBandwidth e: VideoBandwidth.values()) { cache.put(e.getValue(), e); } } public static VideoBandwidth fromValue(int value) { VideoBandwidth videoBandwidth = cache.get(value); if(videoBandwidth == null) { throw new RuntimeException("No such enum for value: " + value); } return videoBandwidth; }
score: 1

http://stackoverflow.com/a/71751397
score: -1
downvote count: 1
type: Answer
has body: import com.jayway.jsonpath.JsonPath; JsonPath.parse(data).read("start");
upvote count: 0
answers question: http://stackoverflow.com/q/20749167

http://stackoverflow.com/a/20784931
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20784872
has body: Use the method keySet() to get a set of the keys of the outermost map. Then iterate over the that.
answers question: http://stackoverflow.com/q/20784872
score: 4
upvote count: 4

http://stackoverflow.com/comment/31273714
type: QuestionComment
type: Comment
has text: @arashaga Maybe I should have asked, "where is `isChanged` declared?". I don't see the declaration anywhere, and in particular I wanted to know, is it a member field of `MyServer` or declared somewhere else, and is it declared with the `volatile` keyword.
score: 0
comment on: http://stackoverflow.com/q/20846802

http://stackoverflow.com/a/20773136
type: Answer
has body: start context once and if you would like to use it in your class implement ApplicationContextAware. public Class1 implement ApplicationContextAware{ private ApplicationContext context; private void setApplicationContext(ApplicationContext applicationContext) { this.context = applicationContext; } the method will be automatically called after context is started.
score: 0
answers question: http://stackoverflow.com/q/20772851

http://stackoverflow.com/comment/31030076
comment on: http://stackoverflow.com/q/20714433
type: Comment
type: QuestionComment
has text: Looks like you on Android, java. Perhaps provide proper tags.
score: 1

http://stackoverflow.com/a/20846666
has comment: http://stackoverflow.com/comment/31270735
has comment: http://stackoverflow.com/comment/31270837
upvote count: 2
has comment: http://stackoverflow.com/comment/31270359
type: Answer
has comment: http://stackoverflow.com/comment/31270267
has body: is the JFrame before EXIT_ON_CLOSE necessary? Isn't it already specified with using frame.setDefault...? Yes, because you need to provide correct exit behavior you want when closing the Application frame: There are four such constant available: DO_NOTHING_ON_CLOSE: Don't do anything; Use it if you require the program to handle the closing operation and do some thing on window close event; you can use Window Listeners here HIDE_ON_CLOSE : Automatically hide the frame after invoking any registered WindowListener objects. So register WindowListener to your JFrame if required. DISPOSE_ON_CLOSE : Automatically hide and dispose the frame after invoking any registered WindowListener objects. EXIT_ON_CLOSE: Exit the application using the System exit method. Use this only in applications. All this constants are defined in WindowCOnstants interface. However, as you wanted to know the default value set as the Default close operation: it is HIDE_ON_CLOSE Reference: setDefaultCloseOperation(int operation)
score: 2
has comment: http://stackoverflow.com/comment/31270147
downvote count: 0
answers question: http://stackoverflow.com/q/20846437
has comment: http://stackoverflow.com/comment/31270645
has comment: http://stackoverflow.com/comment/31270475

http://stackoverflow.com/comment/31099563
type: AnswerComment
comment on: http://stackoverflow.com/a/20751504
score: 0
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/43790/discussion-between-user1988876-and-user987339)

http://stackoverflow.com/comment/131310623
type: AnswerComment
comment on: http://stackoverflow.com/a/20845135
type: Comment
score: 1
has text: Just be aware that if the random next int happens to be 255, it will cast to -1 as `byte` which means end of stream.

database
tags question: http://stackoverflow.com/q/20800385
tags question: http://stackoverflow.com/q/20820641
tags question: http://stackoverflow.com/q/20778011
tags question: http://stackoverflow.com/q/20810887
type: Tag
tags question: http://stackoverflow.com/q/20782272
tags question: http://stackoverflow.com/q/20746174
tags question: http://stackoverflow.com/q/20781588
tags question: http://stackoverflow.com/q/20802875
tags question: http://stackoverflow.com/q/20752124
tags question: http://stackoverflow.com/q/20792993
tags question: http://stackoverflow.com/q/20805464
tags question: http://stackoverflow.com/q/20799027
tags question: http://stackoverflow.com/q/20782740
tags question: http://stackoverflow.com/q/20797196
tag name: database
tags question: http://stackoverflow.com/q/20840871
tags question: http://stackoverflow.com/q/20708169
tags question: http://stackoverflow.com/q/20723025
tags question: http://stackoverflow.com/q/20761226
tags question: http://stackoverflow.com/q/20709625
tags question: http://stackoverflow.com/q/20756389
tags question: http://stackoverflow.com/q/20800346
tags question: http://stackoverflow.com/q/20716757
tags question: http://stackoverflow.com/q/20727456
tags question: http://stackoverflow.com/q/20768905
tags question: http://stackoverflow.com/q/20703875
tags question: http://stackoverflow.com/q/20841568
tags question: http://stackoverflow.com/q/20717330
tags question: http://stackoverflow.com/q/20719840
tags question: http://stackoverflow.com/q/20781346
tags question: http://stackoverflow.com/q/20792239
tags question: http://stackoverflow.com/q/20812663

http://stackoverflow.com/comment/31248178
score: 0
type: AnswerComment
has text: @TheLostMind: Because of the *type* of the reference. Again: In `Test`, `this` is of type `Test` (even though it refers to a `Demo` object). `Test` doesn't have `someFunc`, so you can't call it. In classical inheritance, one of the fundamental concepts is that the type of reference you have controls what aspects of an object you're allowed to use. It's the same principal that says if you have a `Map` reference to a `HashMap`, you can't use anything from `HashMap` that isn't defined for `Map`.
type: Comment
comment on: http://stackoverflow.com/a/20834647

http://stackoverflow.com/comment/30989280
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20691801
has text: @Daemon No problem, just wanted to point it out since the way that piece of code is written doesn't make it obvious.

http://stackoverflow.com/comment/30985362
comment on: http://stackoverflow.com/q/20689788
score: 0
type: Comment
type: QuestionComment
has text: Your code returns `" HopperGrace"`

http://stackoverflow.com/comment/31268791
score: 0
comment on: http://stackoverflow.com/a/20845913
type: AnswerComment
has text: Could be the value of ${ka.area} in your filter ! Check is there is any space in it !
type: Comment

http://stackoverflow.com/q/20787657
type: Question
has answer: http://stackoverflow.com/a/20826486
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31227109
has comment: http://stackoverflow.com/comment/31161729
favorite count: 0
has title: java.security.UnrecoverableKeyException: Cannot recover key when executing KeyManagerFactory.init()
has comment: http://stackoverflow.com/comment/31161218
accepted answer: http://stackoverflow.com/a/20826486
tagged with: keystore
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I have the following code that tries to initialize KeyManagerFactory using SHA-256 hash as password. public static KeyManager[] getKeystoreManagers() throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, NoSuchProviderException { KeyStore keystore = getKeyStore(); if (keystore == null) { return null; } KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(keystore, getMachinePassword(SHA_256).toCharArray()); return kmf.getKeyManagers(); } getKeyStore() returns my application keystore. getMachinePassword() returns a password using SHA-256, 64 digits password length. The problem is that I get the exception when init() is called: java.security.UnrecoverableKeyException: Cannot recover key If I am passing smaller password length lets say, 50 digits the init succeeded. What seems to be the problem here?

http://stackoverflow.com/q/20740297
has title: How to poll using IntentService implementation after fixed time interval?
linked to: http://stackoverflow.com/q/8615543
linked to: http://stackoverflow.com/q/9226927
score: 1
has answer: http://stackoverflow.com/a/20740688
tagged with: multithreading
upvote count: 1
tagged with: intentservice
type: Question
tagged with: java
answer count: 1
downvote count: 0
has body: I have a requirement where I need to do polling to a server,fetch some events from the server and perform action over the events.All these have to be done asynchronously and on regular time interval. So I wrote one class extending IntentService and started my thread inside its onHandleIntent method. The code is as below:- MyService.java public class MyService extends IntentService{ private String tag = "MyService"; public MyService() { super("MyService"); } @Override protected void onHandleIntent(Intent intent) { Log.d(tag, "onHandleIntent"); TestThread.startThread(); } } TestThread.java public class TestThread { private static Timer threadTimer = new Timer(); private static long pollingInterval = 5000;//in milliseconds private static boolean pollingStarted = false; public static void startThread() { threadTimer.schedule(new TestTimer(), 0, pollingInterval); pollingStarted= true; } private static class TestTimer extends TimerTask { @Override public void run() { //get event lists //do some work on the even list } } } In TestThread.java, it gets some event lists from server and performs tasks based upon events. At android website they say the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work. So my question is , will the polling continue in the above implementation ? If not what can be a correct implementation for the above requirement .
linked to: http://stackoverflow.com/q/11700288
favorite count: 0
linked to: http://stackoverflow.com/q/11779132
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/20840504
score: 110
upvote count: 110
accepted answer of: http://stackoverflow.com/q/20840256
type: Answer
answers question: http://stackoverflow.com/q/20840256
has body: try this System.out.println(new UUID(0,0)); it prints 00000000-0000-0000-0000-000000000000 this is the right format to use in UUID.fromString
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/30999889
type: Comment
type: QuestionComment
has text: `FizzLinkUsers` class is needed here.
score: 0
comment on: http://stackoverflow.com/q/20697853

http://stackoverflow.com/a/20747111
has body: if (!clientList.contains(username)){ clientList.add(username); }
answers question: http://stackoverflow.com/q/20747068
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31089195
has comment: http://stackoverflow.com/comment/31089100
has comment: http://stackoverflow.com/comment/31089030
has comment: http://stackoverflow.com/comment/31088953

http://stackoverflow.com/q/20718529
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20718941
tagged with: named-query
tagged with: java
has body: Hi to all i'm new in J2EE world. I'm trying to use @Namequery to get a List of String from my model(the class is called Element), in this case the attribute name. Why when I use @NamedQuery(name="Element.findAllNames",query="SELECT e.name FROM Element e") and I use it on my ElementMgrBean using: public List&lt;String&gt; getAllElementsName() { return em.createNamedQuery(Element.FIND_ALLNAMES,Element.class).getResultList(); } the result appears to be a list of elements instead of a list of String as I expected. Someone can explain me why Java says: "Type mismatch: cannot convert from List of Element to List of String"?? PS: I have defined:public static final String FIND_ALLNAMES = "Element.findAllNames";
accepted answer: http://stackoverflow.com/a/20718941
type: AnsweredQuestion
tagged with: jpa
type: Question
has title: Mismatching return of a query with NamedQuery
score: 0
tagged with: mysql
answer count: 1

http://stackoverflow.com/q/20762350
tagged with: eclipse
type: Question
score: 0
answer count: 2
has title: external jar file working with java application but not in android application
tagged with: android
has answer: http://stackoverflow.com/a/20762466
has answer: http://stackoverflow.com/a/21432557
type: UnansweredQuestion
has body: An external jar file when used with normal Java application works fine, but when I use the same .jar file in android after putting in the /libs folder throws exceptions. The jar basically does encryption of values provided in a Map. The error log is as follows: 12-24 20:36:45.441: E/EncryptionUtils(31893): Could not read PublicKey 12-24 20:36:45.441: E/EncryptionUtils(31893): java.security.NoSuchProviderException: SunRsaSign 12-24 20:36:45.441: E/EncryptionUtils(31893): at >java.security.KeyFactory.getInstance(KeyFactory.java:108) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >in.verse.ipayy.crypto.EncryptionUtils.getPublicKey(Unknown Source) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >in.verse.ipayy.crypto.CryptoUtils.loadGlobalPublicKey(Unknown Source) 12-24 20:36:45.441: E/EncryptionUtils(31893): at in.verse.ipayy.crypto.CryptoUtils.(Unknown >Source) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >com.example.testencryption.Encryption.encrypt(Encryption.java:30) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >com.example.testencryption.MainActivity.onCreate(MainActivity.java:16) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.app.Activity.performCreate(Activity.java:5138) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2228) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2314) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.app.ActivityThread.access$600(ActivityThread.java:144) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) 12-24 20:36:45.441: E/EncryptionUtils(31893): at >android.os.Handler.dispatchMessage(Handler.java:99) 12-24 20:36:45.441: E/EncryptionUtils(31893): at android.os.Looper.loop(Lo…
tagged with: java

http://stackoverflow.com/comment/62508763
type: Comment
score: 0
type: AnswerComment
has text: my answer is straight
comment on: http://stackoverflow.com/a/37500244

http://stackoverflow.com/q/20773285
has body: I have an array of line, which is somewhat like below Here's example: A-NUMBER ROUTINF ACO AO L MISCELL 0-0 0 1-20 0-00 0-01 FDS 3-20 0-02 6 7 3-20 0-03 4 3-20 1-0 F=PRE ANT=3 NAPI=1 1-1 F=PRE ANT=3 I need to parse the line according to column by skipping the column which has blank values and create a new line like below ANUM = 0-0, ACO=0, L=1-20; ANUM = 0-00; ANUM = 0-01, ROUTINF=FDS, L=3-20; ANUM = 0-02, ACO=6, AO=7, L=3-20; ANUM = 0-03, AO=4,L=3-20; ANUM = 1-0, F=PRE, ANT=3, NAPI=1; ANUM = 1-1, F=PRE, ANT=3; I can split the line but my code can't remember which column the value belongs to and when to skip the values. String[] splitted = null; for (Integer i = 0; i &lt; lines.size(); i++) { splitted = lines.get(i).split("\\s+"); for(String str : splitted) if(!(splitted.length == 1)){ anum = splitted[0]; routinf = splitted[1]; aco = splitted[2]; ao = splitted[3]; l = splitted[4]; }else { miscell = splitted[0]; } }
possible better answer: http://stackoverflow.com/a/20773466
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20773466
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20773419
tagged with: arrays
has answer: http://stackoverflow.com/a/20773499
has answer: http://stackoverflow.com/a/20773506
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20773419
has title: Splitting a line and filling an array skipping blank values in Java
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/20694450
score: -1
linked to: http://stackoverflow.com/q/3543454
upvote count: 0
has comment: http://stackoverflow.com/comment/30994034
answer count: 1
has body: I'm making a calculator for Android.. and I'd like to see my expressions in a cool format.. example: instead of 2^2 I'd like to see 2². The expression is shown in an Edit Text. how can i achieve that? I've found nothing use full yet on the Internet. thanks a lot!!
favorite count: 0
has answer: http://stackoverflow.com/a/20694503
has title: How to add format in Android Edit Text text
tagged with: android
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20694503

http://stackoverflow.com/a/20765268
upvote count: 2
has comment: http://stackoverflow.com/comment/31121743
answers question: http://stackoverflow.com/q/20764951
type: Answer
has body: You can always check GrepCode. For example, the Open JDK 7 File.createNewFile() source code is shown: public boolean createNewFile() throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) security.checkWrite(path); return fs.createFileExclusively(path); } where fs declared as static private FileSystem fs = FileSystem.getFileSystem(); and getFileSystem() is documented as //Return the FileSystem object representing this platform's local filesystem. public static native FileSystem getFileSystem(); Here, the clue is in the native keyword. It specifies that the implementation of this method lies with the operating system of the machine that is being used. You can also implement your own variants of this functionality by using the Java Native Interface. Note that OpenJDK is the open source version of Java and is intended to be a drop-in replacement of Oracle's closed source implementations. While the actual code may differ slightly, the actual functionality is pretty much equal to Oracle's offerings.
score: 2
downvote count: 0

http://stackoverflow.com/q/20734593
has title: Leaked IntentReceiver
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31066908
tagged with: android
has answer: http://stackoverflow.com/a/20734613
upvote count: 1
tagged with: android-intent
type: Question
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/20734613
tagged with: java
has body: I have the following code in my onCreate(): registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); This line seems to be throwing the following error: Activity has leaked IntentReceiver that was originally registered here. Are you missing a call to unregisterReceiver()?. I just don't see how this is possible though - I completely uninstall my app and then install it again, and this is the only receiver registration in the entire app. Does anyone know what's wrong?
tagged with: broadcastreceiver

http://stackoverflow.com/a/20704444
has body: I found that using Firefox and Selenium (or Webdriver) required a much-older version of Firefox - the driver was simply not up to date with the latest versions of FF. You could try using an older version, or trying to use Chrome/IE instead, to prove the issue is with FF and not your setup?
type: Answer
answers question: http://stackoverflow.com/q/20702930
score: 0
has comment: http://stackoverflow.com/comment/35824525

http://stackoverflow.com/a/20767504
type: Answer
answers question: http://stackoverflow.com/q/20767469
has body: Problem is in your Market details class where : protected String doInBackground(String... params) { Log.d("EEE",""); // updating UI from Background Thread runOnUiThread(new Runnable() { public void run() { // Check for success tag int success; try { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("mname", marketName)); Log.d("FFF",""); // getting product details by making HTTP request // Note that product details url will use GET request JSONObject json = jsonParser.makeHttpRequest( url_market_details, "GET", params); Log.d("GGG",""); ... and so on. the reason you use doInBackground is to make network calls in background thread, however you call runOnUIThread which causes networkonmainthread exception. You cannot do network (which is jsonParser.makeHttpRequest(url_market_details, "GET", params); function call in this case) on UI thread just remove runOnUI part and move all code inside doInBackground
has comment: http://stackoverflow.com/comment/31125915
score: 0

http://stackoverflow.com/q/20819228
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: decimal
answer count: 2
has comment: http://stackoverflow.com/comment/31218813
downvote count: 0
has answer: http://stackoverflow.com/a/20819310
has comment: http://stackoverflow.com/comment/31218828
possible better answer: http://stackoverflow.com/a/20819308
has answer: http://stackoverflow.com/a/20819308
has title: how to find decimal dot
has comment: http://stackoverflow.com/comment/31218789
favorite count: 0
has body: I have problem searching the position of decimal dot in my char array. I transformed double (Price) into char array using: char[] arrayPrice=Double.toString(Ad[i].Price()).toCharArray(); Now I want to find the position of decimal dot. I tried for (int k=0; k&lt;arrayPrice.length; k++) { if (".".equals(arrayPrice[k])) { dotPosition=k; } } but it gives me 0 all the time. Thanks!
has comment: http://stackoverflow.com/comment/31218784
tagged with: double
accepted answer: http://stackoverflow.com/a/20819310
upvote count: 1

http://stackoverflow.com/comment/31025295
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20711796
has text: Yes, it will return 0.0
type: AnswerComment

http://stackoverflow.com/comment/31188063
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/20802794
has text: Please change `catch(Exception e) { System.out.println("opening error."); }` to `catch(Exception e) { e.printStackTrace(); } ` Your current error message isn't very helpful.
type: Comment

http://stackoverflow.com/comment/31203634
comment on: http://stackoverflow.com/a/20809932
score: 0
type: Comment
has text: Is this the best way to do this though? Are there any other options, this seems a bit hack.
type: AnswerComment

http://stackoverflow.com/q/20841961
tagged with: eclipse
has title: com.apple.eawt.Application "access restriction"
linked to: http://stackoverflow.com/q/860187
answer count: 1
downvote count: 1
has body: I'm writing a Java app and am currently working on all of the Apple native LAF stuff. I'm trying to customize the application menu and I've found that I need to use com.apple.eawt.Application in order to do so. However, when I try to import that class, my IDE says: Access restriction: The type Application is not accessible due to restriction on required library /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/rt.jar I'm using JDK 1.7 update 45, on Mac OS X 10.9, using Eclipse. The rt.jar is on the classpath, but something is unhappy. How do I resolve this?
favorite count: 0
tagged with: macos
accepted answer: http://stackoverflow.com/a/20842366
type: AnsweredQuestion
upvote count: 0
duplicate of: http://stackoverflow.com/q/860187
has answer: http://stackoverflow.com/a/20842366
type: Question
tagged with: java
score: -1

http://stackoverflow.com/comment/31323520
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20753058
score: 0
has text: @AleksandrDubinsky Impossible. The buffer is in JNI space, not in JVM space. There has to be a JNI call. That is the whole point of direct buffers.

http://stackoverflow.com/comment/30980228
type: Comment
comment on: http://stackoverflow.com/a/20686772
has text: Right now, there is no log from Jersey in the startup log, only from Tomcat that the war is deployed. I'll check how to get Jersey to log resource mappings.
type: AnswerComment
score: 0

http://stackoverflow.com/a/48945492
has body: You can also do String person1 = "Joe Smith"; // contains "Joe" String person2 = "Jasha Thompson"; // contains "Jasha" String person3 = "Jasha Joesephson"; // contains "Joe" and "Jasha" String person4 = "Steve Smith"; // contains neither public boolean containsJoeOrJasha(String stringToCheck) { return !Collections.disjoint( Arrays.asList(stringToCheck.split(" ")), Arrays.asList("Joe", "Jasha")); } Collections.disjoint returns true if the two collections are disjoint, meaning that they have no elements in common. So... jshell&gt; containsJoeOrJasha(person1) $33 ==&gt; true jshell&gt; containsJoeOrJasha(person2) $34 ==&gt; true jshell&gt; containsJoeOrJasha(person3) $35 ==&gt; true jshell&gt; containsJoeOrJasha(person4) $36 ==&gt; false
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20755432
type: Answer

http://stackoverflow.com/a/24093533
score: 9
has body: It may not have a per-user 'adb install', but it does have a per-user 'start' option when you want actual run the APK for testing. By default the documentation says 'start' will just start for the currently running user, but you can do adb shell am start --user USER activity... to start the APK as someone else. To get a list of users, run adb shell pm list users
upvote count: 9
answers question: http://stackoverflow.com/q/20746422
type: Answer
downvote count: 0

http://stackoverflow.com/comment/78912091
score: 0
type: AnswerComment
has text: @sarang, kindly accept an answer if it solves your purpose.
type: Comment
comment on: http://stackoverflow.com/a/20782746

http://stackoverflow.com/q/20769758
has answer: http://stackoverflow.com/a/20769900
duplicate of: http://stackoverflow.com/q/7533048
has body: If I have a synchronised method in a class then the synchronization is applied only on the class or also on the objects which the method is modifing. For example if I have a class A as below public class A { private int x; public void setX(int x) { this.x = x; } } And there are two classes B and C which are having some method to set the value of x. Like public class B implements Runnable { private A a; public B(A a) { this.a = a; } public synchronized void setX(A a) { int tempX = 0; .... //Some logic to calculate tempX value a.setX(tempX); } @Override public void run() { this.setX(a); } } Class C will also have a synchronised method to set value of x. Now if I create an object of A and pass the same object to B and C, will the synchronization happen on object a also or we need to synchronize setX of class A. Note: Since I am learning threads, so please bear with me if the question sound stupid. I am just trying to understand what all happens if a synchronized method is called.
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20769788
score: 1
has title: Object synchronization in java
favorite count: 0
tagged with: synchronization
type: Question
has comment: http://stackoverflow.com/comment/31133387
possible better answer: http://stackoverflow.com/a/20769794
accepted answer: http://stackoverflow.com/a/20769788
has answer: http://stackoverflow.com/a/20769794
tagged with: java
tagged with: multithreading
answer count: 3
linked to: http://stackoverflow.com/q/7533048
upvote count: 1

http://stackoverflow.com/comment/31189940
comment on: http://stackoverflow.com/q/20803877
has text: You need to import `Plane` in your `Main` class. Since both programs are in different files.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20819507
has body: You should try to seperate the recalculating and the redrawing. That way, your ping-pong balls will always (seem to) move the same speed, regardless of the frames-per-second you can achieve. One thing you will want to do though, is time how long it takes you to calculate te new positions and subtract that amount of time from the time you wait between recalculations.
upvote count: 1
has comment: http://stackoverflow.com/comment/31219327
answers question: http://stackoverflow.com/q/20819436
has comment: http://stackoverflow.com/comment/31219521
score: 1
accepted answer of: http://stackoverflow.com/q/20819436
has comment: http://stackoverflow.com/comment/31219453
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31219636
type: Answer

http://stackoverflow.com/a/20689278
downvote count: 0
score: 1
type: Answer
has body: 2-d array can be used as 1-d array in following way using following formula for index:- Say you need to find kth index in 1-d array then it be element with i= k/n and j = k%n where n is order of the matrix in the 2-d array. Use binary search as in 1-d array with ending index n*n-1. Alternative Approach:- 1.> Do binary search on first elements of each 1-D array that arr[i][0]. 2.> Then using above get the 1-D array which contains the element say k then do binary search on arr[k].
upvote count: 1
answers question: http://stackoverflow.com/q/20686578

http://stackoverflow.com/comment/31004738
type: QuestionComment
has text: Checking your Error log window might also produce some interesting clues. Look for build issues in particular.
comment on: http://stackoverflow.com/q/20699857
score: 0
type: Comment

http://stackoverflow.com/comment/31240089
type: AnswerComment
has text: Okay, forgot the super.paint(g). Thanks a lot :)
type: Comment
comment on: http://stackoverflow.com/a/20830515
score: 0

http://stackoverflow.com/a/20759653
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: It is called an enhanced for loop. It was introduced in Java 5. It is similar in its working to the old for loop which uses an index. Both can be used to iterate over collections and arrays. Old for loop : With this format of the for loop, you have access to the index variable and also can skip index as you wish. for(int i=0;i&lt;size;i++){ //code } Enhanced for loop : This format is quite inflexible as compared to the old for loop. This format is to be used only when you need to iterate through each and every element of the collection and you have no need of knowing the index of any particular element in the collection. for(String string : mCha) // This means that "For each String element in the collection/array mCha" { //code } Read more about enhanced for loops here
answers question: http://stackoverflow.com/q/20759528

http://stackoverflow.com/comment/31227264
score: 2
comment on: http://stackoverflow.com/a/20823715
has text: Great to know, IntelliJ is always a step ahead...
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31005119
score: 0
has text: Looks like the OP wants a java solution.
type: Comment
comment on: http://stackoverflow.com/a/20701161
type: AnswerComment

http://stackoverflow.com/comment/31131168
has text: First thing which catch the eye: you apply bitwise operator to String `myevenvalue.get(0).get("id")) & 1 == 0`.
score: 0
comment on: http://stackoverflow.com/q/20770410
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20836761
accepted answer of: http://stackoverflow.com/q/20836485
upvote count: 1
score: 1
has body: just use %20 for space in your main course like below http://54.218.73.244:7005/RestaurantAtomicListItemType/?Key=Main%20Course
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31251192
answers question: http://stackoverflow.com/q/20836485
type: Answer

eclipse
tags question: http://stackoverflow.com/q/20792835
tags question: http://stackoverflow.com/q/20783653
tags question: http://stackoverflow.com/q/20762720
tags question: http://stackoverflow.com/q/20778916
tag name: eclipse
tags question: http://stackoverflow.com/q/20779971
tags question: http://stackoverflow.com/q/20845954
tags question: http://stackoverflow.com/q/20849419
tags question: http://stackoverflow.com/q/20681540
tags question: http://stackoverflow.com/q/20825747
tags question: http://stackoverflow.com/q/20751119
tags question: http://stackoverflow.com/q/20740882
tags question: http://stackoverflow.com/q/20820306
tags question: http://stackoverflow.com/q/20789835
tags question: http://stackoverflow.com/q/20833842
tags question: http://stackoverflow.com/q/20706854
tags question: http://stackoverflow.com/q/20705527
tags question: http://stackoverflow.com/q/20723437
tags question: http://stackoverflow.com/q/20752638
tags question: http://stackoverflow.com/q/20825271
tags question: http://stackoverflow.com/q/20772783
tags question: http://stackoverflow.com/q/20843571
tags question: http://stackoverflow.com/q/20760357
tags question: http://stackoverflow.com/q/20731243
tags question: http://stackoverflow.com/q/20763583
tags question: http://stackoverflow.com/q/20767984
tags question: http://stackoverflow.com/q/20777401
tags question: http://stackoverflow.com/q/20699857
tags question: http://stackoverflow.com/q/20813052
tags question: http://stackoverflow.com/q/20783574
tags question: http://stackoverflow.com/q/20758427
tags question: http://stackoverflow.com/q/20682355
tags question: http://stackoverflow.com/q/20723080
tags question: http://stackoverflow.com/q/20778284
tags question: http://stackoverflow.com/q/20685286
tags question: http://stackoverflow.com/q/20788303
tags question: http://stackoverflow.com/q/20841693
tags question: http://stackoverflow.com/q/20800438
tags question: http://stackoverflow.com/q/20728731
tags question: http://stackoverflow.com/q/20803960
tags question: http://stackoverflow.com/q/20843431
tags question: http://stackoverflow.com/q/20734698
tags question: http://stackoverflow.com/q/20783808
tags question: http://stackoverflow.com/q/20837908
tags question: http://stackoverflow.com/q/20691492
tags question: http://stackoverflow.com/q/20838290
tags question: http://stackoverflow.com/q/20834786
tags question: http://stackoverflow.com/q/20691673
tags question: http://stackoverflow.com/q/20766629
tags question: http://stackoverflow.com/q/20713054
tags question: http://stackoverflow.com/q/20816044
tags question: http://stackoverflow.com/q/20822652
tags question: http://stackoverflow.com/q/20686225
tags question: http://stackoverflow.com/q/20848291
tags question: http://stackoverflow.com/q/20793269
tags question: http://stackoverflow.com/q/20843519
tags question: http://stackoverflow.com/q/20686055
tags question: http://stackoverflow.com/q/20707780
tags question: http://stackoverflow.com/q/20750774
tags question: http://stackoverflow.com/q/20733408
tags question: http://stackoverflow.com/q/20822395
tags question: http://stackoverflow.com/q/20838386
tags question: http://stackoverflow.com/q/20742371
tags question: http://stackoverflow.com/q/20806428
tags question: http://stackoverflow.com/q/20806709
tags question: http://stackoverflow.com/q/20792867
tags question: http://stackoverflow.com/q/20801772
tags question: http://stackoverflow.com/q/20823514
tags question: http://stackoverflow.com/q/20780085
tags question: http://stackoverflow.com/q/20821799
tags question: http://stackoverflow.com/q/20819240
tags question: http://stackoverflow.com/q/20721666
tags question: http://stackoverflow.com/q/20827638
tags question: http://stackoverflow.com/q/20726033
tags question: http://stackoverflow.com/q/20782690
tags question: http://stackoverflow.com/q/20822233
tags question: http://stackoverflow.com/q/20819890
tags question: http://stackoverflow.com/q/20816809
tags question: http://stackoverflow.com/q/20830834
tags question: http://stackoverflow.com/q/20690858

http://stackoverflow.com/comment/31117813
score: 1
has text: This is definitely in java, not javascript? Can you show the code you currently have?
type: Comment
comment on: http://stackoverflow.com/q/20763234
type: QuestionComment

http://stackoverflow.com/comment/31046965
score: 0
has text: @OliCharlesworth It looks like OP wants to get to a spot by an `id`, and then go prior or next.
comment on: http://stackoverflow.com/q/20723783
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20761305
answer count: 1
tagged with: neo4j
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/31116628
has comment: http://stackoverflow.com/comment/31116112
has answer: http://stackoverflow.com/a/20903843
type: AnsweredQuestion
tagged with: httpbuilder
tagged with: java
accepted answer: http://stackoverflow.com/a/20903843
type: Question
has title: building async httpbuilder similar to httpbuilder
has body: Might be the wrong place to post this but I have been messing around with async http builders trying to get basic cypher queries to work. It works with Http Builders but can't get it to work with the async version. @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.6' ) @Grab(group='net.sf.json-lib', module='json-lib', version='2.4', classifier='jdk15' ) import groovyx.net.http.* import static groovyx.net.http.ContentType.* import static groovyx.net.http.Method.* def query(statement, params,success, error) { def http = new HTTPBuilder( 'http://localhost:7474' ) http.request( POST, JSON ) { uri.path = '/db/data/cypher/' headers.'X-Stream' = 'true' requestContentType = JSON body = [ query : statement , params : params ?: [:] ] // uri.query = [ param : 'value' ] response.success = { resp, json -&gt; if (success) success(json) else { println "Status ${resp.statusLine} Columns ${json.columns}\nData: ${json.data}" } } response.failure = { resp, message -&gt; def result=[status:resp.statusLine.statusCode,statusText:resp.statusLine.reasonPhrase] result.headers = resp.headers.collect { h -&gt; [ (h.name) : h.value ] } result.message = message if (error) { error(result) } else { println "Status: ${result.status} : ${result.statusText} " println 'Headers: ${result.headers}' println 'Message: ${result.message}' } } } } query("MATCH n RETURN n;",[],{ println "Success: ${it}" },{ println "Error: ${it}" }) However I have tried this with the AsyncHttpBuilder. Couldn't get it to work. Now I am trying a simple thing and have been unable to get it to give anytype of useful result. @Test public void testQueue() { def http = new AsyncHTTPBuilder( poolSize : 1 , uri : 'http://localhost:7474/db/data/cypher' ) def responses = [] responses &lt;&lt; http.post(query : [q: "MATCH n RETURN n;"]) {return it} if (!responses.every{it.done}) { println 'waiting...' Thread.sleep(2000) } responses.each { println(it) } http.shutdown() } Any thoughts? Thanks!
has comment: http://stackoverflow.com/comment/31125991
has comment: http://stackoverflow.com/comment/31125077
score: 0
tagged with: groovy

http://stackoverflow.com/comment/31049791
type: Comment
comment on: http://stackoverflow.com/q/20724324
score: 0
has text: like above example sometime just one name will be filled and sometimes it is possible to have more than one filled same-name so the best one or the last one should be chosen by regex engine.
type: QuestionComment

http://stackoverflow.com/q/20700196
score: 0
tagged with: android
downvote count: 1
has comment: http://stackoverflow.com/comment/31003440
has comment: http://stackoverflow.com/comment/31003444
has answer: http://stackoverflow.com/a/20700244
type: UnansweredQuestion
has title: Android crash opening a fragment
has comment: http://stackoverflow.com/comment/31003470
tagged with: togglebutton
tagged with: android-fragments
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31003585
answer count: 2
has body: A user told me that he can't open a fragment in my application because he get a crash. I have the logcat: java.lang.NullPointerException at com.dd.androreboot.devicecontrolfragment.onCreateView(devicecontrolfragment.java:162) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035) at android.app.BackStackRecord.run(BackStackRecord.java:635) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1399) at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426) 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:4921) 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:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(Native Method) at line 162 i have this code: ConnectivityManager connManager = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mobile = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); datatoggle = (ToggleButton)v.findViewById(R.id.datatoggle); datatoggle.setChecked(mobile.isConnectedOrConnecting()); //line 162 This part of code needs to check if the 3g is connected and if it is, the toggle button state become true. It works in in every device i tryied but not in this one: Galaxy Note 10.1 (p4notewifi). Any helps?
upvote count: 1
has comment: http://stackoverflow.com/comment/31003442
has answer: http://stackoverflow.com/a/20700234
favorite count: 0

http://stackoverflow.com/q/20689800
type: Question
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
has body: I'm working with Struts 2 and jQuery. The plugin of timepicker doesn't work. My JSP: <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags" %> TestPicker <sj:head jqueryui="true" locale="es" jquerytheme="redmond" /> It generates this HTML: I think this code ?s2j=3.6.1 gets the problem. Page of TimePicker addon Now, I will try with ama3+anytime plugin.
tagged with: jsp
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/20690601
tagged with: struts2
has title: jQuery timepicker addon not work with struts2-jquery

http://stackoverflow.com/a/20756960
upvote count: 1
has comment: http://stackoverflow.com/comment/31107244
answers question: http://stackoverflow.com/q/20756883
accepted answer of: http://stackoverflow.com/q/20756883
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31107311
has comment: http://stackoverflow.com/comment/31107338
has body: Try to execute query in following way String insertTableSQL = "SELECT T0.\"ID\" AS \"COL0\" FROM STUDENT_TABLE T0 WHERE ( ( ( T0.\"STUDENT_NAME\" = ? ) AND ( T0.\"GRADE\" = ? ) ) AND ( T0.\"STUDENT_NO\" LIKE ? ) )"; PreparedStatement preparedStatement = dbConnection.prepareStatement(insertTableSQL); preparedStatement.setString(1, "John"); preparedStatement.setString(2, "A"); preparedStatement.setString(3, "12%"); preparedStatement.execute();
type: Answer
score: 1

http://stackoverflow.com/q/20785373
score: 2
downvote count: 0
tagged with: persistence
accepted answer: http://stackoverflow.com/a/20800802
has body: In table I am saving integer values for applied, selected, not selected etc... What I thought is to use Enum in Java Domain class. I tried implementing it. While I am calling this domain from DAO, I am getting some weired error. Please find the code(s) below. import java.util.Date; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import static javax.persistence.GenerationType.IDENTITY; @Entity @Table(name="xxxxxx") public class JobApplied{ public enum RSVP { APPLIED_REJECTED(0), APPLIED_SHORTLISTED(1), SHORTLISTED_SELECTED (3), SHORTLISTED_IN_PROGRESS (4), SHORTLISTED_ON_HOLD (5), SHORTLISTED_REJECTED (6); private int value; RSVP(int value) { this.value = value; } public int getValue() { return value; } public static RSVP parse(int id) { RSVP rsvp = null; for (RSVP item : RSVP.values()) { if (item.getValue()==id) { rsvp = item; break; } } return rsvp; } }; @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id",unique = true, nullable = false) private long id; @ManyToOne(fetch= FetchType.LAZY) @JoinColumn(name="job_opportunity_id") @NotFound(action= NotFoundAction.IGNORE) private JobOpportunity jobOpportunity; @ManyToOne(fetch= FetchType.LAZY) @JoinColumn(name="user_id") @NotFound(action= NotFoundAction.IGNORE) private Users users; @Column(name="status") private int RSVP_Status; public long getId() { return id; } public void setId(long id) { this.id = id; } public JobOpportunity getJobOpportunity() { return jobOpportunity; } public void setJobOpportunity(JobOpportunity jobOpportunity) { this.jobOpportunity=jobOpportunity; } public Users getUsers() { return users; } public void setUsers(Users users){ this.users=users; } public RSVP getRSVP_Status () { return RSVP.parse(this.RSVP_Status); } public void setRSVP_Status(RSVP rsvp) { this.RSVP_Status = rsvp.getValue(); } public void setRSVP_Status(int rSVP_Status) { RSVP_Status = RSVP.parse(rSVP_Status).getValue(); } } While calling the above doma…
tagged with: exception
favorite count: 0
has title: Using Enum in Model (domain) Class with hibernate - could not resolve property - exception
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20800802
tagged with: enums
possible better answer: http://stackoverflow.com/a/20786607
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20786607
type: Question
answer count: 2

http://stackoverflow.com/comment/31026389
score: 0
type: Comment
has text: @MenoHochschild I stand corrected; the JSR 310 classes use static factory methods ([`.now()`](http://download.java.net/jdk8/docs/api/java/time/Clock.html)) rather than no-arg constructors. I rewrote my answer accordingly.
type: AnswerComment
comment on: http://stackoverflow.com/a/20702270

http://stackoverflow.com/comment/31087515
type: Comment
comment on: http://stackoverflow.com/a/20732346
score: 0
type: AnswerComment
has text: Ah that's good to know, I was under the impression that it might be different dependending on the size of the register.

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/20814903

http://stackoverflow.com/comment/31191670
comment on: http://stackoverflow.com/q/20804818
has text: You may want to read a book or tutorial about Java. Or maybe just search on Internet...
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20843403
type: Answer
answers question: http://stackoverflow.com/q/20843368
accepted answer of: http://stackoverflow.com/q/20843368
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has body: You can instantiate it in a static block in the same Utils class. static { // init code } Also you may want to look at the Singleton design pattern as an alternative to keeping static things (class, fields) as suggested here. I assume your whole app/project is loaded by a single ClassLoader so you don't need to worry about static block called multiple times or Singleton objects instantiated multiple times (you want it instantiated just once).
score: 5

http://stackoverflow.com/a/20811958
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20811948
has body: constructor declares to throw org.json.JSONException so you must handle it (catch &amp; handle or rethrow to let caller handle it)

http://stackoverflow.com/q/20754675
has body: I am trying to use JNI with C++ but it is not going right I have justified all the steps to call a c++ method from java . but I am getting following error (Java code and C++ code is given below) Java Code is here public class KeyLogger { public native void capture(); static{ System.loadLibrary("KeyLogger"); } public static void main(String[]args){ KeyLogger obj = new KeyLogger(); obj.capture(); } } C++ code here **// All libraries included Fucntion goes here.** JNIEXPORT void JNICALL Java_KeyLogger_capture (JNIEnv *env, jobject obj){ cout&lt;&lt;"Working Fine"&lt;&lt;endl; } void main(){} Error Exception in thread "main" java.lang.UnsatisfiedLinkError: KeyLogger.capture()V at KeyLogger.capture(Native Method) at KeyLogger.main(KeyLogger.java:10) What should i do for this to get solved
has comment: http://stackoverflow.com/comment/31103445
has comment: http://stackoverflow.com/comment/31103216
favorite count: 0
tagged with: c++
type: AnsweredQuestion
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/31104264
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20755167
has comment: http://stackoverflow.com/comment/31103220
has comment: http://stackoverflow.com/comment/31116924
has title: Error with JNI (Java and C++)
score: 0
has comment: http://stackoverflow.com/comment/31103532
has comment: http://stackoverflow.com/comment/31103528
has answer: http://stackoverflow.com/a/20755167
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/q/20785552
tagged with: jsf
score: 1
has title: h:message not displayed in jsf page
tagged with: java
has answer: http://stackoverflow.com/a/20785868
type: Question
has answer: http://stackoverflow.com/a/20786794
has body: I made a simple login page in jsf with a login field. If the login is not correct (no user found in the database) a message should appear on the page but nothing is displayed... ps : If the user enter nothing, the message specified in the "requiredMessage" is displayed. This is the code of my jsf page : <h:body> Identification <h:form prependId="false"> login : <h:inputText id="log" value="#{filesystemCtrl.login}" required="true" requiredMessage="Please enter your username"/> <h:message for="log" style="color:red"/> <h:commandButton action="#{filesystemCtrl.identifier()}" value="Login"/> </h:form> <ui:insert name="footer"> <ui:include src="footer.xhtml" /> </ui:insert > </h:body> And this is a part of the managedBean : public String identifier() { client = filesystemFacade.identifier(login); if (client == null) { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage("log", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "No user found !")); return "failure"; } else { return "success"; } }
downvote count: 0
has answer: http://stackoverflow.com/a/20789191
accepted answer: http://stackoverflow.com/a/20789191
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/20785868
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/20822101
tagged with: ant
has answer: http://stackoverflow.com/a/27387351
accepted answer: http://stackoverflow.com/a/20822150
answer count: 2
score: 2
tagged with: apache
downvote count: 0
tagged with: macos
has body: I want to execute build.xml file using ant. But I am having trouble with recognizing the path for ant and Java. I tried changing the location to the correct location in bashrc as well as tried changing it for current command window using following commands: export path=/usr/local/apache-ant/bin:"$PATH" echo 'export path=/usr/local/apache-ant/bin:"$PATH"' &gt;&gt; ~/.profile export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin:"$PATH" similarly echo to profile for JAVA_HOME But when I check the paths for these they are not changed. Am I missing something? echo $path /usr/local/apache-ant/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin echo $JAVA_HOME /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home Thanks for your help
favorite count: 0
tagged with: linux
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20822150
upvote count: 2
tagged with: java
has title: Setting the JAVA_HOME and PATH on MacOS
type: Question
possible better answer: http://stackoverflow.com/a/27387351

http://stackoverflow.com/a/20792842
type: Answer
answers question: http://stackoverflow.com/q/20791846
score: 0
has body: simply add following lines to beginning of zkServer.sh export JAVA_HOME=/usr/lib/jdk export PATH=$JAVA_HOME/bin:$PATH btw1: you can make the script executable by: sudo chmod a+x zkServer.sh I suppose that first line is: #!/bin/bash so you can start it by: sudo zkServer.sh start BTW2: it is bad practice to run java code as root if it is not rally necessary. good luck. BTW3: are you sure that you jdk is directly in folder :/usr/jib/jdk and not in some subfolder? You can validate it by running the exports and then try: java -version

http://stackoverflow.com/comment/31165439
type: AnswerComment
has text: is javaEE support open source , actually i don't want to work on asp,net cause it is high price , i want open source , java is good or php is better ?
type: Comment
comment on: http://stackoverflow.com/a/20789817
score: 0

http://stackoverflow.com/comment/31556223
has text: What is @SpringApplicationConfiguration ?
type: Comment
comment on: http://stackoverflow.com/a/20921857
score: 0
type: AnswerComment

http://stackoverflow.com/a/20793358
answers question: http://stackoverflow.com/q/20792993
upvote count: 4
downvote count: 0
has body: The term you are looking for is Object-relational mapping Object-relational mapping (ORM or sometimes referred to as O/R Mapping) It maps your Plain old java code to any to RDBMS table. An Example from Hibernate, You have this POJO. @Entity @Table(name = "car") public class Car { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column private String brand; @Column private String model; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } } Now to Persist this with Hibernate all we have to do is . Car car = new Car(); car.setBrand("BRAND"); car.setModel("MODEL"); session.save(car); Please note that I'd remove some code to simplify the example
score: 4
type: Answer

http://stackoverflow.com/comment/31196783
type: Comment
has text: Isn't that exactly what setInstanceFollowRedirects(true) is for? To release the user from worrying about multiple redirections and get the response-code after they are complete? I have previously tried your suggestion, combined with setInstanceFollowRedirects(false). But that solution yielded the wrong result (a "non-final" URL) in certain cases.
comment on: http://stackoverflow.com/a/20807481
score: 0
type: AnswerComment

list
tags question: http://stackoverflow.com/q/20760578
type: Tag
tags question: http://stackoverflow.com/q/20717111
tags question: http://stackoverflow.com/q/20730757
tags question: http://stackoverflow.com/q/20708358
tags question: http://stackoverflow.com/q/20687980
tags question: http://stackoverflow.com/q/20700800
tags question: http://stackoverflow.com/q/20733097
tags question: http://stackoverflow.com/q/20703898
tags question: http://stackoverflow.com/q/20805123
tag name: list
tags question: http://stackoverflow.com/q/20803293
tags question: http://stackoverflow.com/q/20820648
tags question: http://stackoverflow.com/q/20696511
tags question: http://stackoverflow.com/q/20845520
tags question: http://stackoverflow.com/q/20748000
tags question: http://stackoverflow.com/q/20821343
tags question: http://stackoverflow.com/q/20765148
tags question: http://stackoverflow.com/q/20761980
tags question: http://stackoverflow.com/q/20776437
tags question: http://stackoverflow.com/q/20682979
tags question: http://stackoverflow.com/q/20799657
tags question: http://stackoverflow.com/q/20849681
tags question: http://stackoverflow.com/q/20737980
tags question: http://stackoverflow.com/q/20715451
tags question: http://stackoverflow.com/q/20685709
tags question: http://stackoverflow.com/q/20748351
tags question: http://stackoverflow.com/q/20724210
tags question: http://stackoverflow.com/q/20709178

http://stackoverflow.com/comment/31238159
comment on: http://stackoverflow.com/q/20829547
has text: http://stackoverflow.com/questions/338206/switch-statement-with-strings-in-java. I guess android still does not support java 7
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31263024
comment on: http://stackoverflow.com/a/20843064
score: 0
type: Comment
has text: [This](http://pastebin.com/HbdGLAT3) is everything from the end of the build tests to the server shutdown for the last run (the log currently in the question).
type: AnswerComment

http://stackoverflow.com/comment/35699099
has text: Intermediate mode?? You mean immediate mode?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23316336

http://stackoverflow.com/comment/31397133
type: AnswerComment
has text: Anonymus classes are always not only nested classes, but inner classes, as they can't be static according to Java Language Specification. I therefore believe my answer does answer the question and my example gives some intuition about why they must be defined inside other classes (I did not write about them always being static, but this does not change the intuition, I believe). Is my logic incorrect?
type: Comment
comment on: http://stackoverflow.com/a/20778029
score: 0

http://stackoverflow.com/comment/31167467
type: Comment
has text: I see. Thank you so much for explaining it. You rock man you just made my day honestly!
comment on: http://stackoverflow.com/a/20791064
score: 0
type: AnswerComment

http://stackoverflow.com/comment/30971013
score: 1
has text: Works fine. Just an advice: `beerNum=beerNum-1` = `beerNum--`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20682128

http://stackoverflow.com/comment/31273735
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20848214
has text: what is the command you are using to install? is it: mvn install?
score: 0

http://stackoverflow.com/q/20818237
has answer: http://stackoverflow.com/a/29684640
linked to: http://stackoverflow.com/q/28348686
upvote count: 4
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: tomcat7
has body: I'm trying to adopt old code that uses (now deprecated) WebSocketServlet. The old code looks like this: @Singleton ExampleServlet extends WebSocketServlet { @Override protected StreamInbound createWebSocketInbound(String subProtocol, HttpServletRequest request) { // Do something // ... return // StreamInbound impl; } } As I said in the newer version of the tomcat 7 there is WebSocket implementation backported from tomcat 8 (WebSocket 1.0, Tyrus) and class WebSocketServlet is deprecated. What I should use instead to deploy my servlet with newer API?
type: Question
score: 4
tagged with: servlet-3.0
answer count: 2
has comment: http://stackoverflow.com/comment/47702157
tagged with: websocket
has answer: http://stackoverflow.com/a/23447675
favorite count: 0
has title: Websocket 1.0 WebSocketServlet replacement

http://stackoverflow.com/comment/31124055
type: AnswerComment
has text: @user2653179 Refresh your project in Eclipse and check the project's Java Build Path too. See if there are any issues there.
type: Comment
comment on: http://stackoverflow.com/a/20766542
score: 1

http://stackoverflow.com/comment/31083817
type: AnswerComment
comment on: http://stackoverflow.com/a/20729118
type: Comment
has text: Hi Bruno I warmly recommend you to read this post it explains the different between ketstore and trustore: http://stackoverflow.com/questions/318441/truststore-and-keystore-definitions Please read fully, it's a great post...
score: 0

hashset
tags question: http://stackoverflow.com/q/20685718
tags question: http://stackoverflow.com/q/20711185
tags question: http://stackoverflow.com/q/20836595
tags question: http://stackoverflow.com/q/20696001
tags question: http://stackoverflow.com/q/20781605
type: Tag
tag name: hashset

http://stackoverflow.com/a/51017917
score: 17
has body: If you are using Kotlin for Android development then you can add TextChangedListener() using this code: myTextField.addTextChangedListener(object : TextWatcher{ override fun afterTextChanged(s: Editable?) {} override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {} })
upvote count: 17
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20824634

http://stackoverflow.com/q/20735489
accepted answer: http://stackoverflow.com/a/20849620
tagged with: android
has comment: http://stackoverflow.com/comment/31099336
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: rss
tagged with: xmlpullparser
tagged with: java
has body: I'm developing an Android app that fetches an XML from a RSS feed and parses it. Some entries are empty, so I have to exclude those. The issue is that comparing things like result == "" or result.length() == 0 are not working. I tried appending a .toString() to the end of the result, but it doesn't work too. Hours of Googling and no solution. Does anyone know what I'm doing wrong? It must be something foolish as I'm quite new to Android development. Thanks! XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser parser = factory.newPullParser(); parser.setInput(new StringReader(XML)); int eventType = parser.getEventType(); News news = new News(); String tagName = ""; newsList = new ArrayList&lt;News&gt;(); while (eventType != XmlPullParser.END_DOCUMENT){ if(eventType == XmlPullParser.START_TAG) { if(parser.getName().contains("item")){ news = new News(); } tagName = parser.getName(); } else if(eventType == XmlPullParser.END_TAG) { if(parser.getName().contains("item")){ if(news.pubDate.length() &gt; 0){ newsList.add(news); Log.e("TITLE", news.title); } } } else if(eventType == XmlPullParser.TEXT) { if(tagName.contains("description")){ news.description = parser.getText(); } else if(tagName.contains("title")){ news.title = parser.getText(); } else if(tagName.contains("link")){ news.link = parser.getText(); } else if(tagName.contains("pubDate")){ news.pubDate = parser.getText(); } } eventType = parser.next(); }
has comment: http://stackoverflow.com/comment/31070488
type: Question
has title: XmlPullParser text comparison
has answer: http://stackoverflow.com/a/20849620
score: 0
answer count: 1

http://stackoverflow.com/q/20755063
type: Question
tagged with: hadoop
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31103985
favorite count: 0
has title: Executing java program on Hadoop
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20755743
score: 1
tagged with: java
has body: I need to execute a java program that creates a JFrame and do some operations on hadoop cluster. I exported the JAR and executed it using hadoop jar MyFile.jar MainClass , but the problem is that whatever is written via System.out.println are being printed on console , but the Frame is not opening whereas when I run the same program through Eclipse (via "Run on Hadoop") option the whole program is running absolutely fine. InShort:- JFrame is not executing on hadoop whereas rest of output on console is executing" Need some help in this regard. Thanks in Advance
upvote count: 1
tagged with: eclipse

http://stackoverflow.com/q/20699182
has comment: http://stackoverflow.com/comment/37424816
has body: I want to create Oracle UCP using this code: import oracle.ucp.jdbc.PoolDataSource; import oracle.ucp.jdbc.PoolDataSourceFactory; System.out.println("***** OracleDS_UCP -> start init of PoolDataSource"); PoolDataSource pool = PoolDataSourceFactory.getPoolDataSource(); pool.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource"); pool.setURL("jdbc:oracle:thin:@localhost:1521:XE"); pool.setUser("test"); pool.setPassword("test"); pool.setMaxStatements(10); // the maximum number of statements that may be pooled or cached on a connection. pool.setInitialPoolSize(2); pool.setMinPoolSize(1); pool.setMaxPoolSize(50); pool.setLoginTimeout(60); // one minute pool.setConnectionWaitTimeout(60); // one minute pool.setAbandonedConnectionTimeout(30 * 60); // thirty minutes pool.setMaxIdleTime(60 * 60); // one hour and kill inactive or idle connections pool.setInactiveConnectionTimeout(60 * 60); // one hour and kill inactive or idle connections pool.setConnectionWaitTimeout(0); // do not wait for a used connection to be released by a client. pool.setConnectionHarvestTriggerCount(40); pool.setConnectionHarvestMaxCount(10); I'm using org.apache.felix maven-bundle-plugin 2.4.0 true ucp,ojdbc6 org.osgi.framework, javax.sql, javax.naming, oracle.jdbc.pool.OracleDataSource, oracle.ucp.jdbc.PoolDataSourceFactory, oracle.ucp.jdbc.PoolDataSourceImpl, javax.naming.spi, javax.management, javax.management.modelmbean, oracle.jdbc.pool ucp-11.2.0.3.jar, ojdbc6-11.2.0.3.jar ucp-11.2.0.3.jar, ojdbc6-11.2.0.3.jar, . ${project.artifactId} org.test.ucp.activator.Activator But when I start the code in a standalone bundle I get this error message: Test Oracle UCP ERROR: Bundle ucpTest [21] Error starting inputstream:ucpTest-1.0.jar (org.osgi.framework.BundleExce ption: Activator start error in bundle ucpTest [21].) java.lang.IllegalArgumentException: interface oracle.ucp.jdbc.LabelableConnection is not visible fro m class loader at java.lang.reflect.Proxy$ProxyClassFactory.apply(Unknown Sour…
has comment: http://stackoverflow.com/comment/37544156
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37559323
has comment: http://stackoverflow.com/comment/37440952
type: Question
has comment: http://stackoverflow.com/comment/37445567
tagged with: pool
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/37424573
has title: Cannot find oracle.ucp.jdbc.PoolDataSourceFactory in Oracle ucp
tagged with: oracle-database
favorite count: 0
tagged with: ucp
tagged with: connection-pooling
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/37608523
has answer: http://stackoverflow.com/a/24278301
accepted answer: http://stackoverflow.com/a/24278301

http://stackoverflow.com/comment/31204036
type: QuestionComment
type: Comment
score: 1
has text: Maybe take a look at [Java Native Access](https://github.com/twall/jna).
comment on: http://stackoverflow.com/q/20811213

android-ksoap2
tags question: http://stackoverflow.com/q/20801611
type: Tag
tag name: android-ksoap2

http://stackoverflow.com/a/20734624
score: 1
answers question: http://stackoverflow.com/q/20734235
upvote count: 1
type: Answer
has body: It's only a hypothesis, but it seems like you get a spin-lock with update() method, which is optimized by JVM after several iterations so that genComplete is cached and spinlocking thread never determines genComplete's value changed. When your method x() is empty method run() finishs fast and JVM havent optimize your code yet (by default Oracle HotSpot JIT turns on optimizatons after 1500 method calls in client mode), but I/O operations are 1) blocking (which means more CPU time for other threads) 2) not very fast, so optimizations gets involved when x() contains System.out.println(). The volatile will fix issue in ths case. I'd better recommend you to use Executors and callbacks. For instance: button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { button.setEnabled(false); label.setText("busy"); backgroundExec.execute(new Runnable() { public void run() { try { doBigComputation(); } finally { GuiExecutor.instance().execute(new Runnable() { public void run() { button.setEnabled(true); label.setText("idle"); } }); } } }); } }); More on that you can learn from Java Concurrency in Practice.
downvote count: 0

http://stackoverflow.com/a/20770704
has body: I am afraid that the answers was not my solution. in javadoc documentation there is option for documenting multiple packages, http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html I first extracted android source.zip file and then I used javadoc command in command-prompt. like so: javadoc -J-Xmx1024m -d [DESTINATION] -sourcpath [SOURCE OF PACKAGES] -subpackages [PACKAGES] -J-Xmx1024m is allocation of memory to VM and for multiple packages under src/ folder should be used like this, -subpackages android:androidx:java and so
accepted answer of: http://stackoverflow.com/q/20763907
answers question: http://stackoverflow.com/q/20763907
type: AcceptedAnswer
score: 0
type: Answer

tablecellrenderer
tags question: http://stackoverflow.com/q/20754474
tag name: tablecellrenderer
tags question: http://stackoverflow.com/q/20739558
tags question: http://stackoverflow.com/q/20721798
type: Tag
tags question: http://stackoverflow.com/q/20847467

mapping
tags question: http://stackoverflow.com/q/20839046
tags question: http://stackoverflow.com/q/20704104
tags question: http://stackoverflow.com/q/20693711
tags question: http://stackoverflow.com/q/20824814
tag name: mapping
type: Tag

http://stackoverflow.com/a/24696034
upvote count: 1
has body: To update the view, you need to update it from the main thread. Clearly, you are doing it wrong. You can throw the information to the main thread and update it. Perhaps, you could try updating the view using Android built threads (AsyncTasks), compute the results on doInBackGround(), and publish the results on onPostExecute() method.
answers question: http://stackoverflow.com/q/20734268
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/20786670
has comment: http://stackoverflow.com/comment/31159507
score: 0
has comment: http://stackoverflow.com/comment/31163293
answers question: http://stackoverflow.com/q/20785977
has comment: http://stackoverflow.com/comment/31159297
type: Answer
has body: Try to use relative path instead of absolute path. xmlhttp.open("POST", "TestJSF/" + servlet + "?fileType="+fileType , true); or xmlhttp.open("POST", "" + servlet + "?fileType="+fileType , true); Update: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } xmlhttp.open("GET", "TestJSF/" + servlet + "?fileType="+fileType , true); or xmlhttp.open("GET", "" + servlet + "?fileType="+fileType , true);

http://stackoverflow.com/q/20815582
has body: i want to retrieve data from sqllite data base when i click on category my app freez and show error your content must have listView whose id is R.id.list here is my logcat report first i click on category report button it display listview in list view i click on category name like "Food" and that food string text is pass by intent to another activity where it save to cursor and pass an argumnt to method to call 12-28 18:48:26.168: E/AndroidRuntime(325): FATAL EXCEPTION: main 12-28 18:48:26.168: E/AndroidRuntime(325): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.exmang/com.exmang.ShowCat}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 12-28 18:48:26.168: E/AndroidRuntime(325): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 12-28 18:48:26.168: E/AndroidRuntime(325): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 12-28 18:48:26.168: E/AndroidRuntime(325): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 12-28 18:48:26.168: E/AndroidRuntime(325): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 12-28 18:48:26.168: E/AndroidRuntime(325): at android.os.Handler.dispatchMessage(Handler.java:99) 12-28 18:48:26.168: E/AndroidRuntime(325): at android.os.Looper.loop(Looper.java:123) 12-28 18:48:26.168: E/AndroidRuntime(325): at android.app.ActivityThread.main(ActivityThread.java:4627) 12-28 18:48:26.168: E/AndroidRuntime(325): at java.lang.reflect.Method.invokeNative(Native Method) 12-28 18:48:26.168: E/AndroidRuntime(325): at java.lang.reflect.Method.invoke(Method.java:521) 12-28 18:48:26.168: E/AndroidRuntime(325): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) here is my database table declaration public static final String EX_RowID = "_id"; public static final String EX_Cattype = "Ecattype"; public static final String EX_Date = "Ecdate"; public static fina…
answer count: 1
has comment: http://stackoverflow.com/comment/31211877
favorite count: 0
has title: my app freez and show error your Content Must have listview
tagged with: android
type: AnsweredQuestion
upvote count: 0
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/31213400
has comment: http://stackoverflow.com/comment/31213580
type: Question
has answer: http://stackoverflow.com/a/20816003
has comment: http://stackoverflow.com/comment/31211743
accepted answer: http://stackoverflow.com/a/20816003
tagged with: java

http://stackoverflow.com/comment/31003720
comment on: http://stackoverflow.com/q/20699688
score: 0
type: Comment
type: QuestionComment
has text: @Scooter to add teams I red from the file in to Team[] array

http://stackoverflow.com/a/20713198
upvote count: 4
downvote count: 0
score: 4
type: Answer
has body: public static VideoBandwidth withValue(int value) { for (VideoBandwidth v : values()) { if (v.bandwidth == value) { return v; } } throw new IllegalArgumentException("no VideoBandwidth with value " + value); } Of course, you can also store the enum values in an internal Map, for example, if you want to avoid the iteration and the array creation.
answers question: http://stackoverflow.com/q/20713160

http://stackoverflow.com/comment/31147916
has text: @SotiriosDelimanolis then why should that location is mentioned in eclipse?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20779738
score: 0

http://stackoverflow.com/comment/31202921
has text: i'm pretty sure the default **is** using an anonymous temporary profile. You sure it's opening the same profile? How can you tell?
comment on: http://stackoverflow.com/q/20810600
score: 0
type: Comment
type: QuestionComment

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/20775017
tag name: bytecode-manipulation

http://stackoverflow.com/q/20798709
type: Question
has title: Socket read takes lot of time
score: -1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/20798914
upvote count: 0
tagged with: java
has body: Below is my client code where I am doing Socket write &amp; read operations. Here I am interacting with server with which the protocol is already defined. Accordingly we are sending code messages to it and reading the responses. However in below code: message_id = din.readInt(); This line runs for a long time and returns data after 15 mins. I am not sure why it takes that much time please let me know if anyone faced this issue before. import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class ConnectSaS { public static final int REQ_SESOPEN = 128; /** * @param args */ public static void main(String[] args) { Socket socket; DataOutputStream out; int message_id; int persist_session_id; int session_id; int data_length; String connectionString; try { socket = new Socket("infasas", 11080); socket.setSoTimeout(0); socket.setTcpNoDelay(true); socket.isOutputShutdown(); System.out.println("Connection accepted " + socket.getInetAddress() + ":" + socket.getPort() + ":" + socket.getLocalPort()); out = new DataOutputStream(socket.getOutputStream()); out.writeInt(REQ_SESOPEN); out.writeInt(6); out.writeInt(40); connectionString = "sasuser sasuser SAS_Connection IS_ps7153"; out.write(connectionString.getBytes()); DataInputStream din = new DataInputStream(socket.getInputStream()); message_id = din.readInt(); persist_session_id = din.readInt(); data_length = din.readInt(); din.readByte(); System.out.println("message_id:----" + message_id); System.out.println("session_id:----" + persist_session_id); System.out.println("data_length:----" + data_length); } catch (Exception e) { System.out.println("Problem reading back from server: " + e); } } }

http://stackoverflow.com/q/20784495
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20784694
tagged with: java
has title: how to do searching from a bulk amount of data in java
has comment: http://stackoverflow.com/comment/31155102
type: Question
has comment: http://stackoverflow.com/comment/31155430
answer count: 2
has answer: http://stackoverflow.com/a/20784677
has comment: http://stackoverflow.com/comment/31155126
accepted answer: http://stackoverflow.com/a/20784677
score: 0
has body: Actually there is more than 12000 records getting fetched from database and displayed pagewise using pagination. And now I have a search box in UI which will search from all the records(near about 12000) across all pages. But this is taking sometimes to search from this huge record. Could you please help me how can I make this search faster.
possible better answer: http://stackoverflow.com/a/20784694

http://stackoverflow.com/a/20763269
has comment: http://stackoverflow.com/comment/31117890
has comment: http://stackoverflow.com/comment/31117921
has comment: http://stackoverflow.com/comment/31118383
downvote count: 0
has comment: http://stackoverflow.com/comment/31117860
score: 3
has comment: http://stackoverflow.com/comment/31118042
has comment: http://stackoverflow.com/comment/31118014
accepted answer of: http://stackoverflow.com/q/20763250
upvote count: 3
answers question: http://stackoverflow.com/q/20763250
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31117851
has comment: http://stackoverflow.com/comment/31117833
has comment: http://stackoverflow.com/comment/31117790
has comment: http://stackoverflow.com/comment/31117880
has body: It looks like GRID_DATA is never given a value, hence the NullPointerException when you try to access it's member (gridValues.length) at QGFragment.java:74. You are setting an item in the array at GRID_DATA[i] = name; but never actually creating the array with something like GRID_DATA = new String[]; Array Initiliazation An array is just a list of objects (in this case Strings). Each object has an address that can be accessed with [location] in that list. But if you never create that list in the first place then accessing [location] of that list that doesn't exist isn't going to work.
type: Answer

http://stackoverflow.com/q/20844913
downvote count: 0
has answer: http://stackoverflow.com/a/20868962
tagged with: eclipse-plugin
favorite count: 0
answer count: 1
type: UnansweredQuestion
has body: I have a multi-module project (java and js modules). I'm trying to use the Eclipse Sonar plugin. Is this supported? If so, how? I can link my project to a Sonar project, but I cannot link it to the specific module of interest. When I run, I get the following error: Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://myserver:9000/api/sources?resource=myProjectKey:com.MyClass&amp;amp;format=txt]. Response code: 500 The above error happens because the project key should be myProjectKey:java. Modifying sonar.projectKey in the Eclipse plugin has no effect. If I try to set sonar.modules=java and then set all the other settings for Java, then nothing gets analyzed by Sonar because a multi-module project cannot have sources.
upvote count: 1
has title: How to analyze a multi-module project with Eclipse SonarQube plugin?
score: 1
tagged with: java
tagged with: sonarqube
type: Question

http://stackoverflow.com/q/20757414
type: Question
has comment: http://stackoverflow.com/comment/31107769
has body: I have a url for examle: http://www.abc.com/ABC/ABC-Boots-in-Leather/Prod/product.aspx?iid=34487 i have to convert it into: http://www.abc.com/product.aspx?iid=34487 I am using a regex expression as : String u = url.replaceAll("/.*?/",""); But it doesn't remove the text but just removes the slashes.? How should i correct it?
answer count: 3
possible better answer: http://stackoverflow.com/a/20757449
has answer: http://stackoverflow.com/a/20757456
accepted answer: http://stackoverflow.com/a/20757456
has title: remove all characters between slashes in a URL in java
favorite count: 0
has answer: http://stackoverflow.com/a/20757475
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20757449
upvote count: 2
score: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/31215066
comment on: http://stackoverflow.com/q/20817019
score: 0
type: QuestionComment
type: Comment
has text: @MGorgon is xslt availble for xml to xml transform?

http://stackoverflow.com/comment/31131288
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20770410
has text: @AmulyaKhare, the problem is i want to Filter "myfullvalue" array and get only values with odd "id" and put it in new array. same happen to even "id" too.

http://stackoverflow.com/q/20811960
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31205247
has body: Custom ContextLoaderListener class is not working in Websphere and it is throwing the below error. The same is working fine in Tomcat, JBoss, Weblogic. java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? My custom context loader class looks like below: public class CustomContextListener extends ContextLoaderListener { //implemented contextInitized() and contextDestroyed() methods } In web.xml, added as below: com.comp.app.context.CustomContextListener Can anybody help me to resolve this error? Update: Found the below error in logs. 00000026 DispatcherSer E org.springframework.web.servlet.FrameworkServlet initServletBean Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name configMgr: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: xxxx; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [xxxxxx] 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)}
accepted answer: http://stackoverflow.com/a/20838328
score: 0
possible better answer: http://stackoverflow.com/a/20816278
tagged with: websphere
answer count: 2
has answer: http://stackoverflow.com/a/20816278
has comment: http://stackoverflow.com/comment/31231273
has comment: http://stackoverflow.com/comment/31206900
tagged with: web.xml
has comment: http://stackoverflow.com/comment/31231127
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20838328
has title: Custom ContextLoaderListener class is not working in Websphere

http://stackoverflow.com/comment/31033124
type: AnswerComment
comment on: http://stackoverflow.com/a/20715927
type: Comment
has text: Right, that's a sane way to do it. That means the only time `equals()` is being called is on a hash collision, which means rarely given a decent `hashcode()` method (depending on the number of buckets). And if you're overriding `hashcode()` ... you need to be overriding `equals()` ... for the same purpose in other maps (::confused::)
score: 0

http://stackoverflow.com/comment/31114066
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20761179
has text: I just want to know the package or api to import or to attach in my code to solve my problem

http://stackoverflow.com/a/20825316
has body: A char explicitly requires one character. It can't take two, nor zero, and not even a null. This increases type safety where this requirement is appropriate. Also, using char is slightly faster than using String, in Java.
accepted answer of: http://stackoverflow.com/q/20825275
score: 6
type: Answer
answers question: http://stackoverflow.com/q/20825275
has comment: http://stackoverflow.com/comment/31229940
downvote count: 0
upvote count: 6
type: AcceptedAnswer

http://stackoverflow.com/comment/31142866
type: Comment
type: QuestionComment
has text: I guess what I mean is, should the a monster attack another monster or should a monster tell the world it wants to attack another monster.
comment on: http://stackoverflow.com/q/20777166
score: 0

http://stackoverflow.com/q/20840003
type: UnansweredQuestion
has title: Error in paypal express checkout integration
tagged with: paypal-sandbox
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31257269
type: Question
has comment: http://stackoverflow.com/comment/31257210
tagged with: payment-gateway
has comment: http://stackoverflow.com/comment/31258878
has comment: http://stackoverflow.com/comment/31258863
downvote count: 0
has body: I am trying to integrate Paypal in my website. But when i try to invoke the setExpressCheckout from the paypal api the program throws no such method error exception. setExpressCheckoutResponse = service.setExpressCheckout(setExpressCheckoutReq); stack Trace java.lang.NoSuchMethodError: urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService.setExpressCheckout(Lurn/‌ ​ebay/api/PayPalAPI/SetExpressCheckoutReq;)Lurn/ebay/api/PayPalAPI/SetExpressCheck‌ ​outResponseType; controller.SetExpressCheckout.setExpressCheck(SetExpressCheckout.java:111) controller.SetExpressCheckout.execute(SetExpressCheckout.java:52)
favorite count: 0

http://stackoverflow.com/comment/31187111
has text: There are lots of embedded devices running MIPS and co. That's actually one of the originally intended places for java and I've heard people programming microcontrollers in java to some degree. (Sounds awkward)
score: 0
comment on: http://stackoverflow.com/a/20782362
type: Comment
type: AnswerComment

http://stackoverflow.com/a/20836397
answers question: http://stackoverflow.com/q/20836369
upvote count: 10
has body: Write a small helper method. private int getIndexByProperty(String yourString) { for (int i = 0; i &lt; objList.size(); i++) { if (object1 !=null &amp;&amp; object1.getIdNum().equals(yourString)) { return i; } } return -1;// not there is list } Do not forget to return -1 if not found.
score: 10
has comment: http://stackoverflow.com/comment/31250934
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31250813
type: Answer
accepted answer of: http://stackoverflow.com/q/20836369
has comment: http://stackoverflow.com/comment/31250759

http://stackoverflow.com/comment/31080770
type: Comment
has text: "How to convert key as value and value as key with out any data loss" I think it cannot be done according to example. While keyset is unique (no one key is present more than once), value set is duplicate (for keys 1 and 3). So swapping keys and values will result in HashTable with only two records.
comment on: http://stackoverflow.com/q/20742438
score: 0
type: QuestionComment

http://stackoverflow.com/q/20830202
has title: How to convert the byte offset from sqlite FTS query into a character offset in java
tagged with: sqlite
answer count: 1
downvote count: 0
tagged with: string
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/20838518
tagged with: android
type: UnansweredQuestion
has body: I have a problem where I am searching my FTS tables in android and I get returned a byte offset for the result : col termno byteoffset size 1 0 111 4 However problem is, when using cursor.getString(colNo) it gives me a UTF-16 string after which I am unable to tally up which character of the text is the start/end of the match. Its a similar problem to : Detect character position in an UTF NSString from a byte offset(was SQLite offsets() and encoding problem) However I cannot fathom the solution in the question. So how can I accurately know the character offsets in my string (for highlight) after I know the byte offsets?
tagged with: java
score: 4
type: Question
upvote count: 4

http://stackoverflow.com/a/20828756
score: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/31236535
has comment: http://stackoverflow.com/comment/31236957
type: Answer
has comment: http://stackoverflow.com/comment/31236621
answers question: http://stackoverflow.com/q/20828687
has comment: http://stackoverflow.com/comment/31237502
has body: When you deal with representations of numbers in base B, the trick to removing leading digits is using remainders of division by powers of the base B; to remove trailing digits, use integer division by powers of the base. Specifically, to remove k leading decimal digits of an n-digit decimal number X, obtain the remainder of the division of X by ten to the power of n-k: int X = 12345678; // n = 8 // Remove 3 leading digits (k=3) // 10 ^ (n-k) = 10 ^ 5 = 100000 int res = X % 100000; // res = 45678 To remove the trailing k decimal digits, use integer division by 10 ^ 3: int X = 12345678; int res = X / 1000; // res = 12345
upvote count: 12
has comment: http://stackoverflow.com/comment/31236977
has comment: http://stackoverflow.com/comment/31236726

http://stackoverflow.com/a/20734375
has comment: http://stackoverflow.com/comment/31066734
answers question: http://stackoverflow.com/q/20734337
downvote count: 0
has body: Hibernate Session.createQuery() returns an instance of org.hibernate.Query. Your code casts this object to javax.persistence.Query, but it's not an instance of javax.persistence.Query. So you get this exception. Don't make this cast, and import the correct Query class: not javax.persistence.Query, but org.hibernate.Query.
type: Answer
has comment: http://stackoverflow.com/comment/31066619
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31066705
has comment: http://stackoverflow.com/comment/31066784

http://stackoverflow.com/q/20795411
accepted answer: http://stackoverflow.com/a/20795494
has title: Java - how to map multiple ArrayLists in a HashMap using a loop
has answer: http://stackoverflow.com/a/20795494
type: AnsweredQuestion
upvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/20795642
has body: I'm working on a homework assignment (CS 106A, Handout #8 ). It is a trip itinerary program where the user selects an origin and gets a list of potential destinations. I'm stuck on the data storage section where I'm reading a text file (2nd page of pdf) and storing it. I chose to store data in a HashMap&lt;String, ArrayList&lt;String&gt;&gt;; where the key would be the trip origin and the value would be an ArrayList with all destinations available from the given origin. This is the code I have so far (https://gist.github.com/cch5ng/8139898) //imports import acm.program.*; import acm.io.*; import acm.graphics.*; import java.util.*; import java.util.HashMap; import java.util.Iterator; import java.awt.event.*; import java.awt.Color; import java.awt.TextField; import java.io.*; import java.nio.file.*; import java.nio.charset.*; import javax.swing.*; import javax.swing.event.MouseInputAdapter; public class handout8 extends ConsoleProgram { public void init() { //read in flights.txt data origin_old = ""; Path file = Paths.get("flights.txt"); Charset charset = Charset.forName("US-ASCII"); try (BufferedReader reader = Files.newBufferedReader(file, charset)) { String line = null; while ((line = reader.readLine()) != null) { origin_new = ""; //System.out.println("origin_old: " + origin_old + "."); dest = ""; //destinations.clear(); int k = 0; while (line.charAt(k) != 0 &amp;&amp; k &lt; line.length() - 1 &amp;&amp; line.charAt(k + 1) != 45) { //45 for - origin_new += Character.toString(line.charAt(k)); k++; } if (line.length() &gt; 1) { System.out.println("k: " + k); System.out.println("origin_old: " + origin_old + "."); System.out.println("origin new: " + origin_new + "."); if (k != 0) { dest = line.substring(k + 3); } //issue here where all the keys end up with the same destinations array list //I know I can correctly get the number of origin cities, so maybe I need to hardcode the array list names somehow? if (origin_old.equals(origin_new)) { destinations.add(dest); System…
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/31175028
score: -1
has comment: http://stackoverflow.com/comment/31175076
has comment: http://stackoverflow.com/comment/31175188
tagged with: arraylist
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/20795642
favorite count: 0
has comment: http://stackoverflow.com/comment/31175068

http://stackoverflow.com/comment/31110202
type: QuestionComment
score: 2
has text: Not related to your problem, but what do you think `String.format("%s", ... )` is doing for you?
comment on: http://stackoverflow.com/q/20758824
type: Comment

autoencoder
tags question: http://stackoverflow.com/q/20818774
tag name: autoencoder
type: Tag

http://stackoverflow.com/comment/30970050
type: Comment
comment on: http://stackoverflow.com/q/20681601
type: QuestionComment
score: 2
has text: Also (but not related to the main problem), don't do `if ( result == true ) { … }`, just do `if ( result ) { … }`.

http://stackoverflow.com/comment/31213331
type: QuestionComment
comment on: http://stackoverflow.com/q/20816405
has text: Are the clubs and members in different dropdowns ? Also, any code to show ?
type: Comment
score: 0

http://stackoverflow.com/q/20787704
tagged with: java
tagged with: eclipse
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20788111
tagged with: eclipse-plugin
accepted answer: http://stackoverflow.com/a/20788111
tagged with: android
possible better answer: http://stackoverflow.com/a/20787863
has body: I face strange problem, Yesterday I was checking my projects and also I created a new project to the work-set. Today when I opened eclipse and loaded my work-set I found that my projects are not loaded into eclipse. I checked the work-set folder I found that all my files exist in the work-set folder but those projects are not visible nor loaded into eclipse as if they are not exist. I have also more than one workset,the one that does not appear in eclipse named workset00. workset00 folder exist one the hard drive but does not appear in eclipse. Unlike others worksets such as workset01 or workset02 they I hope the I explained my problem clearly.thanks.
has answer: http://stackoverflow.com/a/20787863
has title: My projects are not appearing in eclipse
type: AnsweredQuestion

http://stackoverflow.com/a/20848068
answers question: http://stackoverflow.com/q/20831058
score: 1
upvote count: 1
downvote count: 0
has body: Nicolas, You are the Boss : ) and You were right this is proper dependencies,on IVY: &lt;dependency org="org.jooq" name="jooq" rev="3.2.2"/&gt; &lt;dependency org="org.jooq" name="jooq-codegen" rev="3.2.2"/&gt; &lt;dependency org="org.jooq" name="jooq-meta" rev="3.2.2"/&gt; &lt;dependency org="mysql" name="mysql-connector-java" rev="5.1.26"/&gt; &lt;dependency org="log4j" name="log4j" rev="1.2.16"/&gt; &lt;dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.5"/&gt;
type: Answer

http://stackoverflow.com/comment/31061828
has text: I believe it's the JIT that kicked in rather than some reflection optimization.
score: 6
comment on: http://stackoverflow.com/q/20731952
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31098874
comment on: http://stackoverflow.com/a/20751952
type: Comment
type: AnswerComment
has text: Then the second approach should fit your needs. You should use a query like `graph.query().labels("foo").vertices()` and use Reservoire sampling to avoid the extra list to pick a random element from the iterator.
score: 0

http://stackoverflow.com/a/20751602
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31097814
type: Answer
answers question: http://stackoverflow.com/q/20751385
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20751385
has body: The problem is that when you read the menu option with stdin.nextInt(), there is still a newline character waiting in the scanner. When you call stdin.nextLine() some time later, you get the rest of the line - which is just an empty string. The name itself won't be read until the FOLLOWING call to nextLine(). To remedy this, you should call nextLine() immediately after your call to nextInt() in the Menu() method, just to clear out that extra newline character.

http://stackoverflow.com/comment/31140110
has text: Same error. Tried alot of stuff before. Same error. I must have forgotten something about lwjgl loading textures.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20775629

http://stackoverflow.com/comment/31063324
score: 2
comment on: http://stackoverflow.com/a/20713176
type: AnswerComment
has text: @HighCore It allows an interface to both declare an optional method to the contract and define its behavior consistently when the implement or opts to omit it. A good example is `Iterator.remove` whose documentation stipulates that those not supporting removal of elements must throw a specific exception. Using this feature allows the interface to enforce this programmatically.
type: Comment

http://stackoverflow.com/q/20681833
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20698110
has title: Spring-data-solr data import handler call
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/73319690
type: Question
has answer: http://stackoverflow.com/a/73319690
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20698110
favorite count: 0
has body: I'm using spring-data-solr and have data import handler(DIH) in solr. How can I call DIH by repository or SolrTemplate, or some else?
tagged with: solr
tagged with: spring-data
upvote count: 1
tagged with: spring-data-solr

http://stackoverflow.com/comment/31169267
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20792111
has text: If you kept reading your book, you would probably get your answer. Look up `casting`.
score: 4

http://stackoverflow.com/comment/31403759
type: Comment
comment on: http://stackoverflow.com/a/20765942
score: 0
type: AnswerComment
has text: ThankYou! for your answer but i have moved on with another method .. yeah i understand frequent updations in libs .. i'll definitely need the EXI functionality again .. and hence xerces too .. will get back to you for my another project after few weeks .. will report back if your solution works in few days .. thankyou :)

http://stackoverflow.com/q/20769015
score: 4
linked to: http://stackoverflow.com/q/2925153
accepted answer: http://stackoverflow.com/a/20769163
has comment: http://stackoverflow.com/comment/31128692
has body: I just saw someone use this alternate syntax for arrays and was wondering: Is public void fn(Character[]...){} equivalent to public void fn(Character[]){} //(i.e. "..." is redundant) or is it equivalent to public void fn(Character[][]){}
answer count: 1
favorite count: 0
has title: Java array syntax alternative
has comment: http://stackoverflow.com/comment/31128674
type: AnsweredQuestion
tagged with: syntax
tagged with: java
has comment: http://stackoverflow.com/comment/31128741
has answer: http://stackoverflow.com/a/20769163
type: Question
upvote count: 4
tagged with: arrays
downvote count: 0
duplicate of: http://stackoverflow.com/q/20653715

http://stackoverflow.com/a/20743633
has comment: http://stackoverflow.com/comment/31083998
has body: Ext.define('User', { extend: 'Ext.data.Model, fields: [ {name: 'Date', type: 'string'}, ... ] }) var userStore = new Ext.data.JsonStore({ model: 'User', autoLoad: true, proxy: { type: 'ajax', url: 'C:\Users\753734\Desktop\New folder\LogHandlers\WebContent\Json12.json', reader: { type: 'json', root: 'userList', // this is json array name idProperty: 'USER_ID' // you should provide one unique column in JSON, you can hide this column in grid with hidden: true property } } }); Here is the sample JSON Object. Take notice that ctgMains which is root property above! Also make sure one unique colum must be available in the json object, othwerwise you can't see data in the grid is because of the data conflict! {"ctgMains":[{"CUST_ASSORT_SECTION_ID":"1","CTG_SECTION":"HORECA"},{"CUST_ASSORT_SECTION_ID":"7","CTG_SECTION":"SCO"},{"CUST_ASSORT_SECTION_ID":"3","CTG_SECTION":"TRADER"}]}
upvote count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31082659
type: Answer
answers question: http://stackoverflow.com/q/20742558

http://stackoverflow.com/a/20832659
has comment: http://stackoverflow.com/comment/31262407
has comment: http://stackoverflow.com/comment/31245546
has comment: http://stackoverflow.com/comment/31244872
accepted answer of: http://stackoverflow.com/q/20832589
type: Answer
has body: I added the AsyncTask to offload network operations to a background thread.I need to make sure the UI operations are on the UI thread.So i want to Use runOnUiThread() in my Activity. Ugh! No!!! Every method of AsyncTask runs on the UI Thread except for doInBackground(). So do your network operations in doInBackground() and update the UI in onPostExecute() or in onProgressUpdate() by calling publishProgress() from doInBackground(). Do not use runOnUiThread() with AsyncTask. There is no reason, at least known to me, to use that with AsyncTask since it has methods that already run on the UI Thread. I have never seen it do anything but cause trouble. You can either call publishProgress() from your loop and update your TextView in onProgressUpdate() or add the values to an ArrayList and update in onProgressUpdate(). Please read the docs several times. AsyncTask is a bit tricky at first but once you learn what it does then it can be a beautiful thing. Edit Create an instance of your AsyncTask and pass your Activity Context to it Scan myScan = new scan(this); // pass the context to the constructor myScan.execute(); Then create a constructor in your AsyncTask and have it accept a Context. public class scan extends AsyncTask&lt;String, Integer, String&gt; { public Object WIFI_SERVICE; public Context context; // Context variable public scan(Context c) // constructor to take Context { context = c; // intialize your Context variable } Now use that variable @Override protected String doInBackground(String... params) { wifiApManager = new WifiApManager(context); // use the variable here return null; } Another Edit class scan extends AsyncTask&lt;String, Void, Void&gt; { ArrayList&lt;ClientScanResult&gt; clients; Context context; ... then initialize your `clients` in `doInBackground()` clients = wifiApManager.getClientList(false); change onPostExecute() to not accept anything protected void onPostExecute(Void result){ and put your code that updates the TextView in there.
has comment: http://stackoverflow.com/comment/31265027
has comment: http://stackoverflow.com/comment/31244953
has comment: http://stackoverflow.com/comment/31263094
answers question: http://stackoverflow.com/q/20832589
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31277555
has comment: http://stackoverflow.com/comment/31258490
score: 0
has comment: http://stackoverflow.com/comment/31245824
has comment: http://stackoverflow.com/comment/31245692
has comment: http://stackoverflow.com/comment/31261721

http://stackoverflow.com/q/20752240
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20752583
has body: I'm using libgdx' stage to draw a background. The background image should stretch to fit all sizes of phones and tablets. But the image is only displayed as a small image and doesn't stretch. Any ideas why? @Override public void show() { stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); batch = new SpriteBatch(); Assets.load(); Image img = new Image(new TextureRegion(Assets.background)); stage.addActor(img); Table table = new Table(skin); stage.addActor(table); } @Override public void render(float delta) { Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); } @Override public void resize(int width, int height) { stage.setViewport(width, height, true); }
tagged with: libgdx
has answer: http://stackoverflow.com/a/20752583
answer count: 1
has title: libgdx stage doesn't draw stretched image
downvote count: 0

http://stackoverflow.com/comment/30997369
has text: What version of 1.7 are you using, and what platform are you working on? That will be what the answer depends on.
comment on: http://stackoverflow.com/q/20696237
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31051587
type: QuestionComment
type: Comment
has text: The code you have posted does not exhibit the behavior you describe.
score: 0
comment on: http://stackoverflow.com/q/20726118

http://stackoverflow.com/q/20748456
tagged with: comparison
type: Question
accepted answer: http://stackoverflow.com/a/20748472
has comment: http://stackoverflow.com/comment/31091525
upvote count: 3
has title: How can I use more than one comparison with the .equals function or is there another function that I can use to check?
answer count: 3
has answer: http://stackoverflow.com/a/20748583
has answer: http://stackoverflow.com/a/20748472
has body: BTW, this is only a short version of my code, the only problem I have is from .equalsIgnoreCase over. I have tried the pipe operator || and that has not worked for "or" either. Let me know, thanks. Its in Java too. if(sWord.substring(0,sWord.length()).equalsIgnoreCase("ch","sh","s","x","z" { lblPluralOutput.setText(sWord + "es"); } }
has comment: http://stackoverflow.com/comment/31091578
downvote count: 1
possible better answer: http://stackoverflow.com/a/20748473
has answer: http://stackoverflow.com/a/20748473
favorite count: 0
type: AnsweredQuestion
score: 2
tagged with: java

memory-leaks
tags question: http://stackoverflow.com/q/20807499
tags question: http://stackoverflow.com/q/20753407
type: Tag
tags question: http://stackoverflow.com/q/20711565
tag name: memory-leaks

http://stackoverflow.com/a/20737225
has body: Collections gives you an easy way to do this: Declare your button text in a List: List&lt;String&gt; myList = new ArrayList&lt;String&gt;(Arrays.asList("text1", "text2", "text3", "text4")); Every time you want to change the text on the buttons, shuffle List and assign: Collections.shuffle(myList); b1.setText(myList.get(0)); b2.setText(myList.get(1)); b3.setText(myList.get(2)); b4.setText(myList.get(3));
has comment: http://stackoverflow.com/comment/31072006
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31072054
score: 2
has comment: http://stackoverflow.com/comment/31072390
has comment: http://stackoverflow.com/comment/31072254
accepted answer of: http://stackoverflow.com/q/20737099
answers question: http://stackoverflow.com/q/20737099
has comment: http://stackoverflow.com/comment/31072201
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20797060
has title: Why is casting not done after the variable?
possible better answer: http://stackoverflow.com/a/20797221
favorite count: 0
has answer: http://stackoverflow.com/a/20849420
has answer: http://stackoverflow.com/a/20802834
has comment: http://stackoverflow.com/comment/31178086
has body: Isn't it more logical to have animal(Elephant).UseTrunk() ? This way you don't have to clutter your code with all these extra parantheses like in ((Elephant)animal).UseTrunk() Is this for historic reasons? would it interfere with other syntax? or am I missing something else? I have an almost religious respect for the clean and pureness of the C# syntax and language, but the casting syntax always feels a bit like the black sheep to me. PS. I do know about (animal as Elephant).UseTrunk(), but that's not the question :) besides that it is in theory a workaround - breaking the idea of the clean and pureness of the language.
has comment: http://stackoverflow.com/comment/31177914
score: 2
type: AnsweredQuestion
tagged with: language-design
has answer: http://stackoverflow.com/a/20797221
tagged with: java
has answer: http://stackoverflow.com/a/20808486
has answer: http://stackoverflow.com/a/20798738
has answer: http://stackoverflow.com/a/20797349
accepted answer: http://stackoverflow.com/a/20797349
has answer: http://stackoverflow.com/a/20797131
has comment: http://stackoverflow.com/comment/31178055
downvote count: 1
has answer: http://stackoverflow.com/a/20797118
type: Question
tagged with: c#
answer count: 8
has comment: http://stackoverflow.com/comment/31177887
upvote count: 3

http://stackoverflow.com/comment/40810384
score: 1
type: Comment
type: QuestionComment
has text: @MuhammedRefaat Nope :( I dun seem to find anything
comment on: http://stackoverflow.com/q/20702656

http://stackoverflow.com/comment/115184018
type: Comment
comment on: http://stackoverflow.com/a/41294104
score: 0
type: AnswerComment
has text: When I tried this, I get an error: could not parse POM, already seen doctype. This is when I try to run a gradle command.

http://stackoverflow.com/comment/31056767
has text: Do we really need that **return false;** Will this do the samething which is in OP's question
comment on: http://stackoverflow.com/a/20729111
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42984752
type: Comment
comment on: http://stackoverflow.com/a/27255341
score: 1
has text: Welcome to StackOverflow (SO)! It's always good to check the formatting before submitting the post. It's right under the text box. Also, it's always good to have some text accompanying your post. You can edit it to include some more information.
type: AnswerComment

http://stackoverflow.com/comment/31109894
comment on: http://stackoverflow.com/a/20758734
type: Comment
score: 0
type: AnswerComment
has text: i want from xml, not from java

http://stackoverflow.com/comment/31088917
score: 0
type: Comment
has text: Yes, you're right, you don't have to wait for, but let's say i wanted to use threads, how the code will look like?
type: AnswerComment
comment on: http://stackoverflow.com/a/20747008

http://stackoverflow.com/comment/31014369
type: Comment
has text: guy, you really should have used some search before... [http://stackoverflow.com/questions/685521/multiline-text-in-jlabel][1] [1]: http://stackoverflow.com/questions/685521/multiline-text-in-jlabel
score: 1
comment on: http://stackoverflow.com/q/20706206
type: QuestionComment

http://stackoverflow.com/a/20804743
accepted answer of: http://stackoverflow.com/q/20804623
type: Answer
has body: Well you could invoke MyTest with arguments. This would be dependent on your IDE and compiler, but in eclipse you can configure launch configurations (search Google for "eclipse launch configuration"). Or you could just just hack something in like so: public class MyTest { public static void main(String[] args) { args = { "something", "something else", "you get the idea" }; if (args.length &lt; 1) { //HERE, it is always &lt; 1 System.out.println("Usage: java twitter4j.examples.tweets.ShowStatus [status id]"); System.exit(-1); } try {
has comment: http://stackoverflow.com/comment/31191704
has comment: http://stackoverflow.com/comment/31191892
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20804623

http://stackoverflow.com/a/20820995
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20820912
upvote count: 2
has comment: http://stackoverflow.com/comment/31222111
type: Answer
has body: Try java.util.Timer Timer t = new Timer(); t.schedule(new TimerTask(){ @Override public void run(){/*...Your task...*/} }, 1000);

http://stackoverflow.com/q/20697087
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30998578
score: 2
tagged with: valgrind
tagged with: java
has title: JVM not starting up on running java program in Valgrind
type: Question
has comment: http://stackoverflow.com/comment/30999405
downvote count: 0
has comment: http://stackoverflow.com/comment/30998954
has body: I am running a java program under Valgrind to check memory leaks in 32 bit Red hat Linux. While i execute the program using valgrind, JVM is not starting up throwing the below exception. Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. My environment is Red Hat Enterprise Linux Server release 6.2 (Santiago) java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) Server VM (build 24.45-b08, mixed mode) valgrind-3.6.0 I was able to run the same program without Valgrind successfully.The command used is valgrind -v --smc-check=all --tool=memcheck --leak-check=yes --show-reachable=yes --leak-check=full --freelist-vol=100000000 --log-file=log.txt java -d32 -classpath "./bin:./lib/*" -Djava.library.path=/home/jni test.TestMain Am I missing any thing here?
has comment: http://stackoverflow.com/comment/30999504
has comment: http://stackoverflow.com/comment/30999464
has comment: http://stackoverflow.com/comment/30999381
favorite count: 0
answer count: 0

http://stackoverflow.com/q/20799512
has answer: http://stackoverflow.com/a/47955350
has body: I was trying to decode string which in FARSI to UTF-8 but then i checked browser itself convert FARSI string into Decimal NCRs Code How i can convert Decimal NCRs Code into UTF-8 ?? String farMsg = "عتباري"; String finalMsg = new String(farMsg.getBytes(),"UTF-8"); System.out.println("\n Farsi Message \n" + finalMsg); when i am trying convert using above code it is working fine but if i am using same string from an input box of JSP page its is giving me some output like this &amp;#1593;&amp;#1578;&amp;#1576;&amp;#1575;&amp;#1585;&amp;#1610; What modification do I need to do for converting into same. EDIT I entered عتباري in the jsp input box and in used request.getParameter("faMSg") to get the value and here i got &amp;#1593;&amp;#1578;&amp;#1576;&amp;#1575;&amp;#1585;&amp;#1610; but i should get عتباري
tagged with: utf-8
has comment: http://stackoverflow.com/comment/31183941
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31885514
tagged with: java
score: 6
type: Question
has title: Convert Decimal NCRs Code into UTF-8 in java (JSP)
upvote count: 6
has answer: http://stackoverflow.com/a/20800789
answer count: 3
has comment: http://stackoverflow.com/comment/31183122
has answer: http://stackoverflow.com/a/20800583
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/31182878

http://stackoverflow.com/a/20694357
answers question: http://stackoverflow.com/q/20694291
has comment: http://stackoverflow.com/comment/30993827
has comment: http://stackoverflow.com/comment/30993916
score: 0
has comment: http://stackoverflow.com/comment/31019259
has body: I can't find your definition of compareTo. It seems this would be the key part of your program? Properly implement your compareTo and confirm it works properly by printing the results of comparisons using System.out.println Doing your own comparison is "ok" in that it will work if you do it properly. The other thing you could do would be to implement Comparable and then you can get Java to sort a list of words for you.
has comment: http://stackoverflow.com/comment/30993974
type: Answer

http://stackoverflow.com/q/20843236
favorite count: 0
accepted answer: http://stackoverflow.com/a/20912519
score: 6
tagged with: rabbitmq
upvote count: 6
tagged with: celery
linked to: http://stackoverflow.com/q/6933833
type: AnsweredQuestion
has body: I have setup celery + rabbitmq for on a 3 cluster machine. I have also created a task which generates a regular expression based on data from the file and uses the information to parse text. from celery import Celery celery = Celery('tasks', broker='amqp://localhost//') import re @celery.task def add(x, y): return x + y def get_regular_expression(): with open("text") as fp: data = fp.readlines() str_re = "|".join([x.split()[2] for x in data ]) return str_re @celery.task def analyse_json(tw): str_re = get_regular_expression() re.match(str_re,tw.text) I can make the call to this task very easily using the following python code :- from tasks import analyse_tweet_json x = tweet ## load from a file (x is a json) analyse_tweet_json.delay(x) However, now I want to make the same call from Java and not python. I am not sure what's the easiest way of doing the same. I've written this code for sending a message to the AMQP broker. The code runs fine, but the task is not carried out. I am not sure how to specify the name of the task which should be carried out. import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.Connection; import com.rabbitmq.client.Channel; class try1 { public static void main(String[] args) throws Exception { ConnectionFactory factory = new ConnectionFactory(); factory.setUri("amqp://localhost"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); String queueName = channel.queueDeclare().getQueue(); channel.queueBind(queueName, "celery", "celery"); String messageBody = "{\"text\":\"i am good\"}" ; byte[] msgBytes = messageBody.getBytes("ASCII") ; channel.basicPublish(queueName, queueName, new AMQP.BasicProperties ("application/json", null, null, null, null, null, null, null, null, null, null, "guest", null, null),messageBody.getBytes("ASCII")) ; connection.close(); } } this is the output in the errorlog of rabbitMq :- connection &lt;0.14627.0&gt;, channel 1 - er…
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/20851037
answer count: 2
has answer: http://stackoverflow.com/a/20851037
has answer: http://stackoverflow.com/a/20912519
downvote count: 0
has title: How to call a celery task delay function from non-python languages such as Java?
tagged with: celery-task
tagged with: python

http://stackoverflow.com/q/20773307
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/23596235
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/15008150
has body: I was going through Lars Vogel's tutorial on using Fragments and I came across the following code: android:layout_marginTop="?android:attr/actionBarSize" I am not sure what ?android:attr means, especially the question mark.
has answer: http://stackoverflow.com/a/20773463
type: Question
has answer: http://stackoverflow.com/a/20773334
accepted answer: http://stackoverflow.com/a/20773334
tagged with: java
score: 40
has title: New to android need to understand "?android:attr/actionBarSize"
has answer: http://stackoverflow.com/a/23596235
upvote count: 40
favorite count: 0
linked to: http://stackoverflow.com/q/10869184

http://stackoverflow.com/comment/30994609
has text: Obviously you are disagreeing
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20694653
type: Comment

http://stackoverflow.com/comment/31181330
type: AnswerComment
comment on: http://stackoverflow.com/a/20798439
score: 0
type: Comment
has text: no.. its painful and you dont know wt was the exactly code written, where all it got changed. android does some compression kind of things in which it removes code which is not use full or not needed at all. i tried once, everything going over head so didn't tried after that.

http://stackoverflow.com/q/20683620
favorite count: 0
has body: I'm creating an infrastructure for cron jobs in my spring project. All @scheduled annotations exists inside my services beans. I created a generic CronJobService that should create the history of my cron execution and persistence of that history each time a cron job executes. So, I've autowired this cronJobService to all services that use the @scheduled annotation and they call him and do stuff.. My question is: What scope should that cronService be? on the one hand it cant be singleton since lots of crons can call it simultaneously and i don't want to manage the sync in it. On the other hand, i don't want it to live forever and have many beans that will infest my spring container. thanks!
type: Question
upvote count: 2
tagged with: spring
tagged with: java
answer count: 0
tagged with: scheduler
type: UnansweredQuestion
has title: CronJobService - what bean scope should I use?
tagged with: cron
score: 2
downvote count: 0

http://stackoverflow.com/a/20696955
has comment: http://stackoverflow.com/comment/31005005
score: 0
has comment: http://stackoverflow.com/comment/30998843
type: Answer
has body: You can do by using the following code and off course there are many work around too ;) public class MultiThread{ public void insert(){ Runnable runnable = new Runnable(){ public void run() { /*Put your code in run method*/ System.out.println("Inserting values in db"); } }; Thread thread = new Thread(runnable); thread.start(); } public void update(){ Runnable runnable = new Runnable(){ public void run() { /*Put your code in run method*/ System.out.println("Updating values in db"); } }; Thread thread = new Thread(runnable); thread.start(); } public static void main(String[] args) { MultiThread multiThread = new MultiThread(); multiThread.insert(); multiThread.update(); } }
has comment: http://stackoverflow.com/comment/30999449
has comment: http://stackoverflow.com/comment/31010676
has comment: http://stackoverflow.com/comment/30999233
has comment: http://stackoverflow.com/comment/31001016
answers question: http://stackoverflow.com/q/20696242

http://stackoverflow.com/comment/31065714
has text: In the last reference, there is a section that shows how to use such loaded properties. And, also, note that the annotation `@Bean` is Java Config approach alternative to XML configuration and it's **not** a utility class.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20733273
type: Comment

http://stackoverflow.com/comment/31231404
type: QuestionComment
type: Comment
has text: @arbuzz : Thanks for replying.I did that exactly following what the official documentation told me.But it just ... I've post my screenshot to another site that you may access so that you may know what happened to me.Now I just want the list of jars being short.As for "copy all linked jars to sub-directory of that project",I think I should not want that.
score: 1
comment on: http://stackoverflow.com/q/20780568

http://stackoverflow.com/q/20709655
has comment: http://stackoverflow.com/comment/31021441
has comment: http://stackoverflow.com/comment/31022520
has comment: http://stackoverflow.com/comment/31021028
has comment: http://stackoverflow.com/comment/31020823
has comment: http://stackoverflow.com/comment/31024065
score: 0
tagged with: jsp
tagged with: modelandview
type: UnansweredQuestion
tagged with: spring-mvc
answer count: 0
tagged with: java
has body: I need help. Post method is not executed when get method is invoked by ModelAndView from different method. Get method for mapping2 is correctly populated with data(taken from ModelAttribute), but when I'm pressing form Submit button it is not executing post method for mapping2. It's running GET method all the time. Url is mapping1 and it is not changing to mapping2, just jsp for mapping2 is displayed as content of mapping1. Do you have any idea how to run post method? The code from controller below. @RequestMapping(value = "/mapping1", method = RequestMethod.POST) public ModelAndView addItem( @RequestParam(value = "year", required = true) final BigDecimal year, @ModelAttribute("item") final Item item, final HttpServletRequest request) { ModelAndView mav = new ModelAndView("mapping2"); mav.addObject("item", item); return mav; } @RequestMapping(value = "/mapping2", method = RequestMethod.GET) public Item addItemConfirmation( @ModelAttribute("item") final Item item, final HttpServletRequest request) { return item; } @RequestMapping(value = "/mapping2", method = RequestMethod.POST) public String addItemConfirmation( @ModelAttribute("Item") final Item item, final HttpServletRequest request) { operations on item... itemDAO.persist(item); return "redirect:/itemAddSuccess }
type: Question
has title: Post method is not executed when get method is invoked by ModelAndView from different method.

http://stackoverflow.com/q/20847650
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/20847730
has comment: http://stackoverflow.com/comment/31271701
has answer: http://stackoverflow.com/a/20847730
linked to: http://stackoverflow.com/q/13896614
tagged with: java
has comment: http://stackoverflow.com/comment/31271741
upvote count: 1
duplicate of: http://stackoverflow.com/q/13896614
has answer: http://stackoverflow.com/a/20847729
linked to: http://stackoverflow.com/q/16204639
has answer: http://stackoverflow.com/a/20847693
tagged with: math
has answer: http://stackoverflow.com/a/20847933
has comment: http://stackoverflow.com/comment/31271751
accepted answer: http://stackoverflow.com/a/20847693
has body: I am trying to implement RSA algorithm in Java. When you give a look at this page: http://en.wikipedia.org/wiki/RSA_(algorithm)#A_working_example you can see this computation: c = 65 ^ 17 mod 3233 = 2790 And when I use this Java code: double valc = Math.pow(65, 17) % 3233; System.out.println("Expected = 2790, computed = " + valc); the results is: Expected = 2790, computed = 887.0 What am I doing wrong?
answer count: 4
type: AnsweredQuestion
has title: Computation in Java doesn't equals to expected result
downvote count: 0
score: 1

http://stackoverflow.com/comment/30986919
type: QuestionComment
score: 0
has text: Thank you very much for your advice. But I didn't understand all of them, I'm sorry. 1, What do you mean ? 2, You're right. I edited. 3) It was for convenient reason as it was a small example, but you're right. Edited. 4)Not sure I understand why, but ok, I removed the "terminateEditOnFocusLost". 5)Not sure I completely understood your point, but I edited. 6) What am I supposed to fire ? I just notify about the rows, columns or cells that are concerned with a modification, no?
comment on: http://stackoverflow.com/q/20688267
type: Comment

http://stackoverflow.com/q/20736035
tagged with: java
upvote count: 1
type: Question
has title: Difference between using keyword new in constructor and in data portion of a class
has comment: http://stackoverflow.com/comment/31069668
has answer: http://stackoverflow.com/a/20736209
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/1994218
favorite count: 0
has answer: http://stackoverflow.com/a/20736053
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/1994218
has comment: http://stackoverflow.com/comment/31069674
has body: What's the difference between using the keyword new in a constructor and in the data portion of a class? It's easier with an example: Approach1: public class Foo{ RandomClass bar = new RandomClass(); Foo(){} } Approach2: public class Foo{ RandomClass bar; Foo(){ bar = new RandomClass(); } } Can someone please explain the difference between those?
score: 1

http://stackoverflow.com/a/20692801
has body: This is a perfect example of when to use the String resources android provides. http://developer.android.com/guide/topics/resources/string-resource.html I would open your strings.xml file and define each of these options as a string array there: Mercury Venus Earth Mars Then declare your strings[] globally like so: String[] vals; Then in your switch do this: Resources res = getResources(); vals = res.getStringArray(R.array.planets_array);
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20692590
upvote count: 1

http://stackoverflow.com/comment/31276110
has text: Craig, that gets me closer, just get the 32-bit on 64-bit, not sure where that comes from as I have both JVMs installed on my machine. See updated text question.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20849757
type: AnswerComment

http://stackoverflow.com/q/20819890
type: AnsweredQuestion
tagged with: crash
has comment: http://stackoverflow.com/comment/31220234
has comment: http://stackoverflow.com/comment/31220087
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31219948
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31221510
answer count: 2
has answer: http://stackoverflow.com/a/20822081
has comment: http://stackoverflow.com/comment/31220191
has comment: http://stackoverflow.com/comment/31219966
tagged with: android
has title: My android app crashed on startup
possible better answer: http://stackoverflow.com/a/20837154
accepted answer: http://stackoverflow.com/a/20822081
has answer: http://stackoverflow.com/a/20837154
tagged with: java
has body: I have followed this for making my app. When I run it on my android 2.1, the app gets stuck. Can you help me? What can I do to make my app working? MainActivity.java public class MainActivity extends Activity { @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String url = "http://check.be?v=1"; WebView view = (WebView) this.findViewById(R.id.webView1); view.getSettings().setJavaScriptEnabled(true); view.loadUrl(url); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } activity_main.xml <webView android:id="@+id/webView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" /> manifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />

http://stackoverflow.com/q/20724243
tagged with: return
has title: Not printing out full contents of linked list
has comment: http://stackoverflow.com/comment/31048121
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20724403
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/20724392
has comment: http://stackoverflow.com/comment/31062779
has answer: http://stackoverflow.com/a/20724390
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31062752
answer count: 4
has answer: http://stackoverflow.com/a/20724391
has body: I'm having a small bit of bother with the following method. I want to print out the files inside a directory, and call this method from a separate main class. Although this does work, it only prints out the first file then stops. public String viewDir(String user){ LinkedList&lt;String&gt; fileNameList = new LinkedList&lt;&gt;(); File actual = new File("c:\\Server\\" + user + "."); for( File f : actual.listFiles()){ System.out.println(f.getName()); fileNameList.add(f.getName()); }//end of advanced for loop for(int j = 0; j &lt; fileNameList.size(); j++){ return fileNameList.get(j); }//end of for loop return null; } I am calling the method above by using: System.out.println(fileInterface.viewDir(user) + "\n\n");
favorite count: 0
accepted answer: http://stackoverflow.com/a/20724391
possible better answer: http://stackoverflow.com/a/20724392

http://stackoverflow.com/comment/31147565
comment on: http://stackoverflow.com/q/20779743
score: 0
type: Comment
type: QuestionComment
has text: the best way is don't use key event. key event didn't confirmed that new student has been added.

http://stackoverflow.com/comment/31165740
score: 0
type: AnswerComment
type: Comment
has text: So it's not just opening the router port? OK, I'll check that. Thanks.
comment on: http://stackoverflow.com/a/20777219

http://stackoverflow.com/comment/31239644
has text: @DietmarKühl: Ah, whyever did I fall into the evil trap of this language? :-(
comment on: http://stackoverflow.com/a/20829935
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20834397
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20834353
has body: Can someone please explain what is going when a subclass calls super(), but there is no constructor in the parent? If parent class doesn't have any constructor then java compiler will call the default constructor of it. If you don't want to call default constructor then you can create your own empty constructor in that class.
has comment: http://stackoverflow.com/comment/31247314
upvote count: 1
has comment: http://stackoverflow.com/comment/31247371

http://stackoverflow.com/q/20778428
has title: How to export object to xml string without additional data
tagged with: java
has answer: http://stackoverflow.com/a/20778452
type: Question
score: 0
answer count: 2
tagged with: http://stackoverflow.com/tag/xml
has body: I have inside my class inner class with four public fields and I want to export to XML string. I am doing at the moment like (I am using xstream library) XStream xstream = new XStream(); String xml = xstream.toXML(c);// c is instance of inner class This exports but how to export without package name and additional info, I just need field name and value without additional data. How to do that using xstream library ? Or to write manually ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20780072
has comment: http://stackoverflow.com/comment/31145211
tagged with: xstream

http://stackoverflow.com/q/20841160
type: AnsweredQuestion
tagged with: trinidad
type: Question
tagged with: http://stackoverflow.com/tag/html
has body: Using Trinidad selectBooleanCheckbox Component as following: <tr:selectBooleanCheckbox text="FIRST" id="firstType" value="#{bean.type}"/> The render html is : X FIRST My Question is : I'm not using the label , instead I'm using text property(since I want to render the checkbox first and then the text- when I'm using the label the label shows before the checkbox) So what I want is the html that is render will not render the section of the label at all because it take some place that I can't remove.. Please assist.
tagged with: jsf
score: 0
answer count: 1
has title: JSF Trinidad SelectBooleanCheckbox with out Label
tagged with: java
has answer: http://stackoverflow.com/a/20843356
accepted answer: http://stackoverflow.com/a/20843356

http://stackoverflow.com/comment/38065290
comment on: http://stackoverflow.com/a/24573187
has text: Please put some commentary so that answer is better understood.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31064121
has text: *Implementation* is the least of your worries here. Have you asked yourself about the interaction of your proposed semantics with all the rest of the language features?
comment on: http://stackoverflow.com/q/20732995
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20767292
has body: I'm assuming you want a graphical progress bar, and not a console based (tui) solution. Have you read this Swing tutorial? EDIT: If you want one tick of your progress bar per file, you simply need to tell the progress bar constructor how many total ticks there are, something like: progressBar = new JProgressBar(0, allFilesInAllDirectoriesLength); and organize your for loop to work on each file, instead of looping on the directories.
has comment: http://stackoverflow.com/comment/31125366
has comment: http://stackoverflow.com/comment/31125591
has comment: http://stackoverflow.com/comment/31125429
type: Answer
has comment: http://stackoverflow.com/comment/31129040
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31125481
has comment: http://stackoverflow.com/comment/31125396
answers question: http://stackoverflow.com/q/20767241
has comment: http://stackoverflow.com/comment/31125531
has comment: http://stackoverflow.com/comment/31125803
has comment: http://stackoverflow.com/comment/31125329
upvote count: 3

http://stackoverflow.com/q/20684690
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/32321852
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20684763
accepted answer: http://stackoverflow.com/a/20684763
has answer: http://stackoverflow.com/a/46398719
has answer: http://stackoverflow.com/a/35934351
upvote count: 1
possible better answer: http://stackoverflow.com/a/32321852
has body: What I am trying to do is: change the title of an item in Action Bar from onClick method. Code of onCreateOptionsMenu: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.option_menu, menu); return super.onCreateOptionsMenu(menu); } My option_menu.xml of menu: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/state" android:title="@string/title_not_connected" android:showAsAction="ifRoom" /&gt; &lt;/menu&gt; The title should change from onClick method in class below: @SuppressLint("ValidFragment") public class ReceiveSectionFragment extends Fragment { public NotificationCenter mNotificationCenter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.receive, container, false); mNotificationCenter = new NotificationCenter(); rootView.findViewById(R.id.bt_server_start) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { MenuItem item = (MenuItem) menu.findItem(R.id.state); item.setTitle(TAG); } }); } } As you can see I am trying to find this item in menu by Id but I am getting this error: The method findItem(int) is undefined for the type R.menu. I am using fragments and ReceiveSectionFragment uses R.layout.receive layout. How can I deal with this problem? Possibly, I am doing it all wrong by using wrong methods. I am not using ActionBar Sherlock.
favorite count: 0
tagged with: android
tagged with: android-actionbar
has title: Dynamic change of items title in Action Bar
answer count: 4

http://stackoverflow.com/q/20693073
score: 4
upvote count: 4
possible better answer: http://stackoverflow.com/a/21596435
has comment: http://stackoverflow.com/comment/30991834
answer count: 2
has answer: http://stackoverflow.com/a/20693325
has comment: http://stackoverflow.com/comment/30992017
has answer: http://stackoverflow.com/a/21596435
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20693325
tagged with: garbage-collection
type: AnsweredQuestion
has body: I have TabPane with Tabs in it. I'm creating new Tab, adding it to my TabPane. Then I close the tab and remove it from TabPane programmatically. Tab is not set to null. Is it correct behavior? How to clean / destruct this Tab object?
has title: When JavaFX tab should be collected by garbage collector?
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/31001680
has comment: http://stackoverflow.com/comment/30991683

http://stackoverflow.com/comment/31221826
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20820873
has text: You need to show what you have tried so far so we can see what you did wrong
score: 0

http://stackoverflow.com/q/20785137
has comment: http://stackoverflow.com/comment/31156239
has comment: http://stackoverflow.com/comment/31156718
has comment: http://stackoverflow.com/comment/31156311
type: UnansweredQuestion
score: 1
type: Question
has title: Garbage Collection
has comment: http://stackoverflow.com/comment/31156440
favorite count: 0
has body: I found this question in one of the Java dumps and I would like to know how many object would be available after more code here 11 comment in the following code public class Tahiti { Tahiti t; public static void main(String[] args) { Tahiti t = new Tahiti(); Tahiti t2 = t.go(t); t2 = null; // more code here 11 } Tahiti go(Tahiti t) { Tahiti t1 = new Tahiti(); Tahiti t2 = new Tahiti(); t1.t = t2; t2.t = t1; t.t = t2; return t1; } } My answer was one since the object reference by t2 object under main method has been set to null and because of that there isnt any reference pointing to that object but i found out that answer is 0 Could anyone help me on this? thanks
upvote count: 2
has comment: http://stackoverflow.com/comment/31156173
tagged with: garbage-collection
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20785469
tagged with: java

http://stackoverflow.com/q/20796787
tagged with: java
has answer: http://stackoverflow.com/a/20797175
type: Question
has body: In my project, I have converted a string into byte in controller then saved it to database. Now I want to fetch that string to textarea from database. How can I convert that byte into string which was saved in database and what should I write in controller to do the conversion?
upvote count: 0
answer count: 1
has title: Getting byte value from Database and convert it into string for showing it in text area
favorite count: 0
score: -1
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/comment/31090709
comment on: http://stackoverflow.com/q/20746940
type: Comment
type: QuestionComment
has text: @CommonsWare mmm ; in Android ; at the end Im gonno need to use this in textviews; so I guess I have no way out of this; no ?
score: 0

http://stackoverflow.com/comment/31019986
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20708527
has text: The tags should go in their entirety somewhere in your pom - after dependencies is fine. You should then change the main class to the correct one. You will then have two jars in target; one of them will have the "with-dependencies" qualifier. This is the one you need to run. If you read the answer you will see that you need to use the second fragment if you want this to happen automatically.
score: 0

http://stackoverflow.com/comment/101124326
score: 2
comment on: http://stackoverflow.com/a/23016010
type: AnswerComment
has text: You could also use @android:color/white rather than #00000000. I would think that it would be slightly more standard but wouldn't really make any difference otherwise.
type: Comment

http://stackoverflow.com/comment/31195620
type: Comment
has text: Thanks for the quick response and the link.
score: 1
comment on: http://stackoverflow.com/a/20805750
type: AnswerComment

http://stackoverflow.com/q/20769904
tagged with: charsequence
favorite count: 0
has answer: http://stackoverflow.com/a/20770002
tagged with: arraylist
has title: Convert ArrayList<customtype> to CharSequence[]
type: Question
has body: I have a custom ArrayList and want to convert it into CharSequence[]. I tried this List&lt;String&gt; list = Arrays.asList("foo", "bar", "waa"); CharSequence[] cs = list.toArray(new CharSequence[list.size()]); System.out.println(Arrays.toString(cs)); // [foo, bar, waa] but it only works for string type.
tagged with: android
has answer: http://stackoverflow.com/a/20769905
score: -1
answer count: 2
downvote count: 1
accepted answer: http://stackoverflow.com/a/20769905
tagged with: java
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/20770002

http://stackoverflow.com/comment/31203892
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20811197
has text: Please remember to leave comments when you downvote. Otherwise they are relatively useless and annoying. Thanks
score: 0

http://stackoverflow.com/q/20743245
answer count: 1
has body: Thanks Makky for ur help !!! Industrialization Manager &lt;p:column styleClass="columnB" style="width:15%"&gt; &lt;ui:repeat var="input" value="#{bean.inputTexts}"&gt; &lt;p:inputText size="15" value="#{input}" /&gt; &lt;/ui:repeat&gt; &lt;b style="padding: 0px 0px 0px 18px"&gt; &lt;p:commandButton value="Add Manager" actionListener="#{bean.addInput}" update="tbl" style=" margin-bottom:10px;width:auto;height:28px;font-style: normal; font-family:Arial;font-size: 13px; color: #000000; text-align:center;font-weight: normal;text-decoration:none;cursor: pointer" /&gt;&lt;/b&gt; &lt;/p:column&gt; &lt;/p:row&gt;
has comment: http://stackoverflow.com/comment/31084191
has answer: http://stackoverflow.com/a/20744745
has title: how to add multiple empty input Text when clicked on commandbutton in primefaces
has comment: http://stackoverflow.com/comment/31083340
type: AnsweredQuestion
tagged with: jsf
tagged with: java
accepted answer: http://stackoverflow.com/a/20744745
type: Question
tagged with: primefaces
score: 0
has comment: http://stackoverflow.com/comment/31082835

http://stackoverflow.com/comment/31084012
has text: up to the point where my code throws an exception the code is the same - apart from my problem area which is getting the XML from a resource file.
type: Comment
comment on: http://stackoverflow.com/a/20744352
score: 0
type: AnswerComment

http://stackoverflow.com/q/20832165
tagged with: struts2
tagged with: struts-config
score: 0
has body: Been banging my head for quiet sometime now as I don't seem to understand why struts is unable to find my action class. This is my struts.xml <?xml version="1.0" encoding="UTF-8"?> /success.jsp /error.jsp This is my project structure And finally this is the error that I see Clearly the action seem to be present, not sure why it is unable to find it. Another eye ball would be appreciated!
answer count: 1
has answer: http://stackoverflow.com/a/20832187
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/20832187
type: AnsweredQuestion
has title: Struts unable to find action class
tagged with: java
type: Question

http://stackoverflow.com/q/20719350
tagged with: java
type: Question
has body: I am having trouble with my code. This is my first time using a Map and for some reason the Gate that is added in the 2nd try block is null. I cannot spot the error. The error first shows itself in the last try block where i get nullpointer when i try to set the inputgates. The file that is given the to the function has several lines where each line looks like this: starts with a name for the gate, then the type for the gate, then a number of inputgates. (Gates previouse created). There is a type of gate called signalgate that just acts as a startgate. Has no input, just an output. We are talking about NAND, AND, OR gates and such. Thanks in advance! public static String Capital(String s){ String string = s.substring(0,1).toUpperCase() + s.substring(1).toLowerCase(); string = string + "Gate"; return string; } public static Map&lt;String, Gate&gt; createGates(File file){ //variabler. BufferedReader bufferedReader = null; String[] lines = null; String line; Map&lt;String, Gate&gt; map = new LinkedHashMap&lt;String, Gate&gt;(); int index = 0; Gate g; try{ //tests reading the file bufferedReader = new BufferedReader(new FileReader(file)); //As long as there still are lines left while((line = bufferedReader.readLine()) != null){ index++; //as long as the line's not a comment. if(line.trim().charAt(0) == '*' || line.trim().charAt(0) == '/'){ continue; }else{ lines = line.split("\\s+"); } //Gör namnet till att börja med stor bokstav och resten blir små bokstäver. lines[1] = Capital(lines[1]); try{ System.out.println("hej"); //Skapar en instans av en gate med class.metoden g = (Gate) Class.forName(lines[1]).newInstance(); //sätter namnet. Detta använder vi senare g.setName(lines[0]); //För in dom i mapen. map.put(g.getName(), g); }catch (InstantiationException e) { new GateException("Something went wrong instantiating the gate " + lines[0] + " on line " + index + " in the code"); } catch (IllegalAccessException e) { new GateException("Something went wrong in the CreateGates…
score: 0
has title: JAVA: Adding an instace of my class "Gate" to a map is null
answer count: 1
has answer: http://stackoverflow.com/a/20722123
has comment: http://stackoverflow.com/comment/31043847
has comment: http://stackoverflow.com/comment/31041558
tagged with: dictionary
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31041506
tagged with: gate
tagged with: linkedhashmap
has comment: http://stackoverflow.com/comment/31038797
has comment: http://stackoverflow.com/comment/31038779

http://stackoverflow.com/q/20769821
type: Question
has answer: http://stackoverflow.com/a/20773574
score: 0
answer count: 1
has title: LWJGL OpenGL glbegin and stuff deprecated
accepted answer: http://stackoverflow.com/a/20773574
tagged with: java
tagged with: lwjgl
type: AnsweredQuestion
has body: Can I still use those methods in the future? Also, if not, can anyone recommend some good tutorials for modern OpenGL in lwjgl? Thanks

http://stackoverflow.com/q/20785911
has comment: http://stackoverflow.com/comment/31157626
has title: error starting tomcat - no display specified
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31160667
has body: I am trying to install Ganib(project management tool), which make use of tomcat. After setup, I try to execute Start_ganib.sh, which ultimately try to start tomcat and fails with following error: Using CATALINA_BASE: /tmp/download/Ganib-1.3_with_jre/tomcat Using CATALINA_HOME: /tmp/download/Ganib-1.3_with_jre/tomcat Using CATALINA_TMPDIR: /tmp/download/Ganib-1.3_with_jre/tomcat/temp Using JRE_HOME: ../../jre-lin/ Error: no display specified Note: tomcat/bin/startup.sh and tomcat/bin/catalina.sh implicitly executed during this process. Edit: I tried doing: export DISPLAY=localhost:0.0 but its showing another error message: Error: cannot open display: localhost:0.0
has answer: http://stackoverflow.com/a/20788282
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/784404
type: Question
score: 0

http://stackoverflow.com/a/20920792
answers question: http://stackoverflow.com/q/20841645
score: -1
has comment: http://stackoverflow.com/comment/35831895
has body: When mouse moves over a link, then a MouseEvent is generated. Some MouseMotionListener (or maybe MouseListener) consumes this event and then shows hiperlink for you. You can simulate this event: Component source = null; // TODO set up a valid component MouseEvent event = new MouseEvent(source, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), InputEvent.ALT_DOWN_MASK, source.getX(), source.getY(), 0, false); MouseMotionListener[] mouseMotionListeners = source.getMouseMotionListeners(); if (mouseMotionListeners!= null &amp;&amp; mouseMotionListeners.length &gt; 0) { MouseMotionListener mouseMotionListener = mouseMotionListeners[0]; mouseMotionListener.mouseMoved(event); } The InputEvent.ALT_DOWN_MASK in the constructor means that Alt is pressed. Note that you should define what Component responsible for consuming events in your case. You can find more information in the tutorial How to Write a Mouse Listener and MouseEvent API
downvote count: 1
upvote count: 0
type: Answer

http://stackoverflow.com/comment/95020811
has text: Possible duplicate of [How to format a duration in java? (e.g format H:MM:SS)](https://stackoverflow.com/questions/266825/how-to-format-a-duration-in-java-e-g-format-hmmss)
comment on: http://stackoverflow.com/q/20827047
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20765347
has comment: http://stackoverflow.com/comment/31122905
type: UnansweredQuestion
has body: This is my current app, I am able to return the String name of different countries package com.example.autocompletetutorial; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; public class MainActivity extends Activity { String[] countries = {"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Rep…
tagged with: android
upvote count: 1
linked to: http://stackoverflow.com/q/32287402
has comment: http://stackoverflow.com/comment/31130303
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/52452865
has title: How to use autocompleteTextview widget on android to return string from an arraylist
downvote count: 0
score: 1
tagged with: autocompletetextview
favorite count: 0
answer count: 0

http://stackoverflow.com/comment/31221709
type: Comment
comment on: http://stackoverflow.com/q/20819494
has text: I haven't defined context path. I'll check this.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31208591
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20813751
has text: @NaveenPrabhu: That seems pretty broken to me. U+0098 is "start of string" and U+0080 is a control character. Is this your server? If so, I'd start there and try to fix that first...
type: Comment

http://stackoverflow.com/q/20721276
has body: I am trying to implement a secure system for iOS and Android that will transfer encrypted files from a server and decrypt on the device. The challenge I am currently trying to beat is the source code of Android app (also iOS app code decompile is possible) is decompilable. So this system was not be able to pass the penetration test. The penetration test guys actually decompiled the whole Android app code and they managed to decrypt the files. How can I build such system that it will be secure and the files are not going to be decrypted except from the app itself? Currently what I have is: We encrypt bunch of files on the server in a directory. AES-256 with a passkey. We encrypt the whole folder as a ePub file. Using aescrypt.com freeware utility. The file is an e-book. We transfer the ePub file to the device. We unzip the ePub file to a folder on the device. (Note that the unzipped files are still encrypted) We override the webview's fileURLWithPath (on iOS) and before webview renders the content we give webview the decrypted content. But as I said, the encrypted contents on the disk can be decrypted decompiling the code. Also the pass key is in the app source code as well. How should I proceed in order to create a secure system for that process? Thanks.
type: Question
tagged with: ios
downvote count: 0
has title: iOS / Android File Decryption | How To Secure PassKey?
tagged with: security
has comment: http://stackoverflow.com/comment/31043818
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
tagged with: android
has comment: http://stackoverflow.com/comment/31042558
has comment: http://stackoverflow.com/comment/32675993
score: 2
answer count: 0
tagged with: java

http://stackoverflow.com/q/20769537
type: Question
has comment: http://stackoverflow.com/comment/31129669
has title: How to display a colour image using a JPanel?
has comment: http://stackoverflow.com/comment/31129647
score: 0
has body: I have a colour image that is been stored in a 3D array and now I want to display this data or the image on to a JPanel. My code read function is as follows : public void readImage(String filename) throws Exception { String filenameExtension = filename.substring(filename.lastIndexOf('.')+1); File fileImage = FileChosen; Iterator imageReaders = ImageIO.getImageReadersBySuffix(filenameExtension); ImageReader imageReader; if(imageReaders.hasNext()) imageReader = (ImageReader)imageReaders.next(); else throw new IOException("Unsupported image format"); FileImageInputStream imageInputStream = new FileImageInputStream(fileImage); imageReader.setInput(imageInputStream); ImgWidth = imageReader.getWidth(0); ImgHeight = imageReader.getHeight(0); BufferedImage bufImage = imageReader.read(0); imageInputStream.close(); WritableRaster wRaster = bufImage.getRaster(); //int numBands = wRaster.getNumBands(); System.out.println(ImgWidth); System.out.println(ImgHeight); imageArray = (new double[ImgHeight][ImgWidth][ColourLevels]); // get the samples and normalize to between 0 and 1 for(int row = 0; row &lt; ImgHeight; row++) for(int col = 0; col &lt; ImgWidth; col++) for(int level = 0; level &lt; ColourLevels; level++) imageArray[row][col][level] = (wRaster.getSample((col), (row), level) / 255.0); } // end read method` Now I want to print the data stored in the imageArray[][][] in to a panel, how can I do that?
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/31129612
tagged with: java
tagged with: image-processing

http://stackoverflow.com/comment/31037467
score: 0
has text: If you want help, you will need to improve your Question. 1) You dumped a couple of hundred lines of code ... and people are unlikely to plough through that much. 2) You didn't bother to tell us what isn't working. 3) You don't appear to have *attempted* to implement `StockTrackerDb`.
comment on: http://stackoverflow.com/q/20717330
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20795561
has answer: http://stackoverflow.com/a/20797602
accepted answer: http://stackoverflow.com/a/20797602
type: AnsweredQuestion
score: 1
has body: As per the JMS specs for classic APIs The Connection, Session, MessageProducer, MessageConsumer and QueueBrowser interfaces have been modified to extend the java.lang.Autocloseable interface. This means that applications can create these objects using a Java SE 7 try-with-resources statement which removes the need for applications to explicitly call close() when these objects are no longer required. And after JMS2 for classic APIs The new JMSContext and JMSConsumer interfaces also extend the java.lang.Autocloseable interface. Question is why JMSProducer not extend AutoCloseable?
tagged with: java
tagged with: jms2
type: Question
upvote count: 1
answer count: 1
has title: Why JMSProducer interface does not extend java.lang.Autocloseable?
tagged with: jms
favorite count: 0
downvote count: 0

http://stackoverflow.com/a/20820750
upvote count: 1
has comment: http://stackoverflow.com/comment/31221628
type: Answer
downvote count: 0
score: 1
has body: You can not know when your thread was stopped and the system rescheduled another thread. But - you can minimize the number of times this event happens by setting the affinity of your thread to one of the processors, and the affinities of the other threads to the other processors. If you are using Linux, you can use taskset for each thread in the system (get the list by "ps -e") to set the affinities of the other threads to other processors. This will decrease the load on the processor and will cause it to context-switch less times.
answers question: http://stackoverflow.com/q/20820608

http://stackoverflow.com/q/20748173
score: 0
tagged with: java
type: Question
tagged with: graphics
answer count: 2
tagged with: point
tagged with: awt
has body: i am trying to figure out how Java know where to start according to this Graphics code when i run this code it showing ball moving from top to down but i can't understand why from top and why from this place and i know that java use math.random() to set the value but how it set the x and y while when i trying to put any random number by my self it gives number that is bigger than the width it self (i am taking exactly about pos.x and pos.y) this the first class package movingball; import java.awt.Color; import java.awt.Graphics; import java.awt.Point; /** * * @author isslam */ public class Ball { private final int RADIUS = 10; private final Point pos; private final Color ballColor = Color.red; private final int CHANGE = 3; private final int height, width; public Ball(int frameWidth, int frameHight) { width = frameWidth; hight = frameHeight; pos = new Point(); pos.x = (int)(Math.random() * (width - RADIUS)) + RADIUS; pos.y = (int)(Math.random() * (height / 2 - RADIUS)) + RADIUS; } public void paint(Graphics g) { g.setColor(ballColor); g.fillOval(pos.x - RADIUS, pos.y - RADIUS, 2 * RADIUS, 2 * RADIUS); } public void move() { if (pos.y &lt; height - RADIUS) { pos.translate(0, CHANGE); } } } this is the second class package movingball; import java.awt. * ; import javax.swing. * ; /** * * @author isslam */ public class ClassOfMoving extends JFrame { protected final int FRAME_WIDTH = 240; protected final int FRAME_HIGHT = 320; private final Ball myBall = new Ball(FRAME_WIDTH, FRAME_HEIGHT); public ClassOfMoving(String title) { super(title); setSize(FRAME_WIDTH, FRAME_HEIGHT); setDefaultCloseOperation(ClassOfMoving.EXIT_ON_CLOSE); } public void paint(Graphics g) { super.paint(g); myBall.paint(g); } public void move() { while (true) { myBall.move(); repaint(); try { Thread.sleep(50); } catch (InterruptedException e) { System.exit(0); } } } } the main class package movingball; /** * * @author isslam */ public class MovingBall { /** * @param args the command line arguments */…
has answer: http://stackoverflow.com/a/20752409
possible better answer: http://stackoverflow.com/a/20748294
has answer: http://stackoverflow.com/a/20748294
has title: according to this code how java know where to start
accepted answer: http://stackoverflow.com/a/20752409
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/20760062
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20760358
downvote count: 0
upvote count: 3
tagged with: while-loop
answer count: 3
has body: For some reason when the string length is zero, it does not come out of the while loop. Can some one help me on this? static String str1 = ""; public static void reverse(String str) { while (str.length() &gt; 0) { str1 = str1 + str.charAt(str.length() - 1); StringBuffer str_buf = new StringBuffer(str); str = str_buf.deleteCharAt(str.length() - 1).toString(); reverse(str); } System.out.println("String is " + str1); }
tagged with: string
has answer: http://stackoverflow.com/a/20760128
has answer: http://stackoverflow.com/a/20760580
has title: Recursively print the reverse of a String in Java
favorite count: 0
type: UnansweredQuestion
tagged with: recursion

http://stackoverflow.com/comment/31246070
type: QuestionComment
has text: If this is object - it stored on heap, primitive type stored on stack. When object stored on heap, its reference stored on stack. So that when you call that method with parameter of object type passed by value, it is the reference copied and passed, not the object copied and passed. This is it
type: Comment
comment on: http://stackoverflow.com/q/20833147
score: 0

http://stackoverflow.com/a/20810838
has body: First, make timer an instance variable... private static final int SCREEN_WIDTH = 500; private static final int SCREEN_HEIGHT = 500; private static final int OFFSET = 100; private static final int SIZE = 20; private static final int INC = 5; int[] xPoints = new int[5]; // Add me here... private Timer timer; Don't forget to remove the old declaration... Timer timer = new Timer(50, new ActionListener() { Should become timer = new Timer(50, new ActionListener() { Otherwise you will end up with a shadow variable and possible NullPointerException. Next, create a JButton and add an ActionListener to it and within it, call timer.start() JButton btn = new JButton("Start"); btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { timer.start(); } }); Now, don't forget to add it to your UI so the user can click it... Take a look at How to use buttons for more details Updated Based on comments, I would add a start and maybe even a stop method to the GreenRects class. These would call the timer.... public void start() { timer.start(); } From there, when the button's ActionListener is triggered, you would simply call start method of the instance of GreenRects... public void actionPerformed(ActionEvent e) { greenRects.start(); } I would then add the button to some other container, so that it didn't interrupt with what the GreenRects class is painting...
accepted answer of: http://stackoverflow.com/q/20810798
answers question: http://stackoverflow.com/q/20810798
has comment: http://stackoverflow.com/comment/31203241
has comment: http://stackoverflow.com/comment/31203561
score: 4
has comment: http://stackoverflow.com/comment/31203213
has comment: http://stackoverflow.com/comment/31203292
upvote count: 4
has comment: http://stackoverflow.com/comment/31203529
has comment: http://stackoverflow.com/comment/31203514
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31203186
type: Answer

http://stackoverflow.com/comment/31174426
type: AnswerComment
comment on: http://stackoverflow.com/a/20794717
type: Comment
score: 0
has text: public ArrayList<String> getallvegetable() method worked fine but in main class m geting error at vegetableitem[i] = info.getvegetablenames(); saying the method getvegetablenames is undefined for type vegetabledatabase... plz plz help...need to solve dis problem in an hour or early..mind not working

http://stackoverflow.com/q/20687327
tagged with: java
tagged with: eclipse
has title: Howto find interface with specific method?
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/39859931
has comment: http://stackoverflow.com/comment/30980551
score: 0
has body: I look for a tool in eclipse to find a interface's method who implements void detach(). I have tried the "Java Search" but only found declarations in real Classes. Any suggestions?
has comment: http://stackoverflow.com/comment/30980517
has answer: http://stackoverflow.com/a/20687371
type: UnansweredQuestion

http://stackoverflow.com/q/20717432
tagged with: nat
score: 0
answer count: 1
has body: I recently started making a 2D java game, and started making a tcp server 2 days ago, now that all my other issues are fixed, I would like to address the fact that the client can only connect to the server when it is on the same device and using the devices static ip, though it cannot connect using my wan ip address, I have port forwarded and I have checked on many port-checker websites and they all can see my server, my firewall is also disabled, yet the client can't see the server using the wan ip, I made a mine craft server on the same port (Minecraft servers are also tcp) and others were able to connect using my wan ip. When a client does try to connect using my wan ip, it gives a Connection Refused exception. What am i doing wrong? Client (Can't connect to server over nat): package com.diedericksclan.main.network; import java.io.*; import java.net.*; import java.util.Enumeration; public class ClientThread extends Thread { private ClientHandler client; private Socket socket; private InetSocketAddress address; private int megabyte = 1024 * 1024; private DataInputStream in; private DataOutputStream out; public ClientThread(ClientHandler client, InetSocketAddress address) { this.client = client; this.address = address; socket = new Socket(); try { socket.setSendBufferSize(megabyte); socket.setSendBufferSize(megabyte); socket.setTcpNoDelay(true); socket.setReuseAddress(true); socket.bind(new InetSocketAddress(this.getIP(), 0)); System.out.println(socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " is a new client!"); socket.connect(address); in = new DataInputStream(new BufferedInputStream(socket.getInputStream())); out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); } catch (SocketException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private InetAddress getIP() throws SocketException { Enumeration&lt;NetworkInterface&gt; nis = NetworkInterface.getNetworkInterfaces(); NetworkInterfa…
type: UnansweredQuestion
tagged with: client
tagged with: tcp
tagged with: java
type: Question
tagged with: network-programming
has answer: http://stackoverflow.com/a/20717516
has title: Java TCP client-server NAT Connection Refused

http://stackoverflow.com/a/20723652
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/20723568
has body: The problem is not your number generator, it is the config array that you pass to all individuals. Arrays are reference objects, so when you change config in the loop to prepare it for the next individual, the changes become visible in all instances of Individual that you created before. You need to either make a copy of config in the Individual's constructor, or use a new array in each iteration of your for loop: int life= 0; int pos; for (int j = 0; j &lt; 100; j++) { char config[] = new char[10]; // &lt;&lt;== Move the declaration here for (int i = 0; i &lt; 10; i++) { do { pos = rand.nextInt(10); } while (source[pos] == '?'); config[i] = source[pos]; source[pos] = '?'; } life= rand.nextInt((30 + 1) -1); population[j] = new Individual(config, 0, life); } Now each Individual gets his own copy of config, ensuring that each individual is different.
accepted answer of: http://stackoverflow.com/q/20723568
has comment: http://stackoverflow.com/comment/31046739
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20791788
has comment: http://stackoverflow.com/comment/31168596
score: 0
has body: I'm using ModifyListener to get information from Text that changes. Is there a way to get the Text's text in the listener (like a method of Event e)? Thank you!
answer count: 1
tagged with: listener
has answer: http://stackoverflow.com/a/20796277
tagged with: text
type: AnsweredQuestion
tagged with: java
tagged with: swt
type: Question
accepted answer: http://stackoverflow.com/a/20796277
has title: Getting information from Event

http://stackoverflow.com/a/20681177
has body: Yes, block port 8080 on your firewall. Or even better do it at the router level. If your on windows, you can go to the windows firewall in control panel and go to advanced setting, where you can set a rule, to block port 8080 incoming.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30969285
type: Answer
accepted answer of: http://stackoverflow.com/q/20681108
answers question: http://stackoverflow.com/q/20681108
has comment: http://stackoverflow.com/comment/30974028
score: 0

http://stackoverflow.com/q/20828917
score: 2
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has body: I am having an issue with hibernate. the query result is not updating. i have a simple query which checks customertable to see if the 'enabled' column = true. the query works fine. but when i change the colum value from 'true' to 'false' and run the same query... it still gives me 'true' as a result. if i close the application and recompile, and run query again, it THEN shows false, but then again if i change it back to true.. it still shows 'false' result. what am I doing wrong? public void isEnabled(String customer){ Session session = sessionFactory.openSession(); Transaction tx = null; try{ tx=session.beginTransaction(); Query query = session.createQuery("FROM Customer WHERE enabled=true"); List qr = query.list(); boolean check = qr.iterator().hasNext(); boolean enabled; sw = new ServerWriter(writer); if(check){ for(Iterator itr = qr.iterator();itr.hasNext();) { Customer c =(Customer)itr.next(); enabled=c.geEnabled(); sw.sendMessage("Customer is enabled"); } }else{ sw.sendMessage("Customer is not enabled"); } } catch(HibernateException e){ if(tx!=null){tx.rollback();} e.printStackTrace(); }finally{session.close();} }
has answer: http://stackoverflow.com/a/20829589
downvote count: 0
has comment: http://stackoverflow.com/comment/31236873
has comment: http://stackoverflow.com/comment/31257845
has title: hibernate query result not updating after change
answer count: 1
has comment: http://stackoverflow.com/comment/31236909
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/20831931
possible better answer: http://stackoverflow.com/a/20831964
tagged with: imageicon
has answer: http://stackoverflow.com/a/35263437
downvote count: 0
linked to: http://stackoverflow.com/q/11195864
favorite count: 0
score: 8
upvote count: 8
answer count: 5
has answer: http://stackoverflow.com/a/20831966
has body: Icon bug = new ImageIcon( getClass().getResource( "bug1.png" ) ); ImageIcon bug = new ImageIcon( getClass().getResource( "bug1.png" ) ); What's the difference between these two? My book always uses the way in the first line to declare an ImageIcon but wouldn't it be better to declare it the second way because more specifically it is an ImageIcon?
tagged with: swing
type: AnsweredQuestion
has title: Difference between Icon and ImageIcon?
accepted answer: http://stackoverflow.com/a/20831966
has answer: http://stackoverflow.com/a/20831971
has comment: http://stackoverflow.com/comment/31242902
tagged with: java
has comment: http://stackoverflow.com/comment/31242914
has answer: http://stackoverflow.com/a/20831965
type: Question
has answer: http://stackoverflow.com/a/20831964
linked to: http://stackoverflow.com/q/3768869
tagged with: icons
tagged with: awt

http://stackoverflow.com/q/20778916
answer count: 2
has answer: http://stackoverflow.com/a/20778945
favorite count: 0
has body: There is a feature in eclipse that you can enable to automatically insert curly brackets and semicolons into the right location. (More info in the top reply here) Recently I started picking up the habit of adding the curly brace on the next line so that the braces end up lining up. I find that it makes the code nicer to look at. Is it possible to still use this auto positioning feature with curly braces, but instead of inserting the curly brace at the end, insert it on the next line like this: for (int i = 0; i &lt; 10; i++) { I have my eclipse formatter set to use this format, but unfortunately the auto position curly bracket doesn't appear to follow these rules. Anyone know how to fix this or a workaround without having to highlight all the code and format constantly? Edit: I guess I wasn't really clear in my original post. I do have my formatter set to having braces on the next line, but eclipse's awesome insert at correct location feature doesn't seem to follow the formatters rules. I was trying to figure out if there was a way to solve this issue so that (like the link I posted above), typing a brace on the line will bring me to the next line instead of placing the brace at the end of the current line. Maybe eclipse has a macro plugin I can use for this?
linked to: http://stackoverflow.com/q/461255
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
has title: Eclipse - Auto insert braces with different brace style
has answer: http://stackoverflow.com/a/20778927
accepted answer: http://stackoverflow.com/a/20778927
possible better answer: http://stackoverflow.com/a/20778945
upvote count: 3

http://stackoverflow.com/a/20705764
type: Answer
has body: You are initializing ctr as an empty array: int ctr = 0, sum=0; int[] value = new int [ctr]; And then trying to assing values to some of its elements: while(rs.next()){ ctr++; value[ctr]= Integer.parseInt(rs.getString("Payments")); sum+=value[ctr]; } Since you don't know how many results are going to be in the ResultSet, an array is not a good choice for a a datastructure. Instead, use one of the built-in List types (like LinkedList or ArrayList) that can grow on demand: int ctr = 0, sum=0; List&lt;Integer&gt; value = new LinkedList&lt;Integer&gt;(); // snipped while(rs.next()){ value.add(Integer.parseInt(rs.getString("Payments"))); sum += value.get(ctr); ctr++; // Note that the first element in a list is index 0. }
answers question: http://stackoverflow.com/q/20705652
score: 0

http://stackoverflow.com/comment/30979863
has text: I think it depends on what platform you want to use. I searched this and found a CROSS-PLATFORM solution. Pretty cool http://stackoverflow.com/questions/12478075/using-registry-with-java-in-mac-os
comment on: http://stackoverflow.com/q/20686967
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20788186
has body: Use a JOptionPane that contains a JTextArea. Read the section from the Swing tutorial on How to Use Dialogs for more information and examples. The JOptionPane API will allow you do add any Swing component to the dialog.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20787959
score: 2
upvote count: 2

http://stackoverflow.com/comment/41838728
has text: I hate that good questions like this get closed--at least they are still around in some form. Anyway the main difference is the "adds". Without Swingbuilder you create an item then add it to a container, with swingbuilder you indicate that relationship by nesting levels. Also since everything is closure based it's easier to update the screen with the same code (something that can be a continual challenge in Swing). There are quite a few other advantages, enough to make it really annoying to go back to swing.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20807182
type: Comment

http://stackoverflow.com/comment/31041654
type: QuestionComment
comment on: http://stackoverflow.com/q/20720955
type: Comment
has text: I don't see StringRepresentation Constructor taking a String object? if you convert a json object to a string, all the double quotes would be escaped with a backslash. That may create problems
score: 0

http://stackoverflow.com/comment/30995728
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20695373
type: AnswerComment
has text: No, the [discriminant](https://en.wikipedia.org/wiki/Discriminant#Quadratic_formula) "is the quantity under the square root sign in the quadratic formula."

http://stackoverflow.com/comment/31161218
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20787657
type: QuestionComment
has text: I realized that it is not a password length issue. I've increased the password size to 70 (added some digits to the end of the password) and the init succeeded. So it is something to do with the password itself. I forgot to mention that the keystore password uses the same getMachinePassword(SHA-256), so it is the same password for init.

http://stackoverflow.com/q/20688069
has comment: http://stackoverflow.com/comment/30982227
has body: I'm doing small game Tron Bikes. I have MainFrame class Bike bike1, bike2; private void startGameAsServer(){ bike1 = new Bike(); bike2 = new Bike(); communication.sendBike(bike1); communication.sendBike(bike2); } ... public synchronized void receiveBike(Bike receive){ //depends if I'm server or client I save receive to bike1 or bike2 } ... Second class Communication ... ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream()); ObjectInputStream input = new ObjectInputStream(client.getInputStream()); ... public void sendBike(Bike send){ try { output.writeObject(send); output.flush(); System.out.println("Send bike"); } catch (IOException ex) { } } ... private void listen(){ listening = new Thread(new Runnable() { @Override public void run() { while(true){ try { Bike readBike = (Bike)input.readObject(); System.out.println("Receive bike"); MainFrame.getInstance().receiveBike(readBike); } catch (IOException | ClassNotFoundException ex) { break; } } } }); listening.start(); } ... When I start game, it works fine. On server both bikes are created, send to client, and then game start. But when in client I turn to side, I send one bike back to server, and here is problem. In server in method receiveBike bike1 and bike2 is null... And if I write to bike1 or bike2 nothing happend. Even many times in a second, data from bike1 a nd bike2 are loaded to draw game panel. It looks, that data are loaded from old objects. Like in method receiveBike we change completely different objects... I'm so desperate, I don't know what I'm doing wrong...
has comment: http://stackoverflow.com/comment/30982446
has title: Java sending objects by sockets in threads
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/20692350
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20692350
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/30986079
type: Question
tagged with: sockets
tagged with: multithreading

http://stackoverflow.com/q/20800962
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20801408
tagged with: java
has answer: http://stackoverflow.com/a/20801010
has title: Java Need Help To Get Print To All String
has answer: http://stackoverflow.com/a/20801011
tagged with: methods
has answer: http://stackoverflow.com/a/20801041
type: Question
has body: guys i need help with this code i need to print all string by command (PrintAllStudents) i made the command but i didn't make it print all student it just print the lastest student added im learning java here is my test class : package com.tj; public class Student { private int StudentId; private String StudentName; public void AddStudent(int StudentId, String StudentName){ this.StudentId = StudentId; this.StudentName = StudentName; } public void PrintAllStudents() { System.out.println("Id : " + StudentId); System.out.println("StudentName : " + StudentName); } } and my test class : package com.tj; public class Test { public static void main(String[] args) { Student s = new Student(); s.AddStudent(1, "Walied"); s.AddStudent(2, "Ayman"); s.AddStudent(3, "Mostafa"); s.PrintAllStudents(); } }
has comment: http://stackoverflow.com/comment/31184762
answer count: 6
score: 0
has comment: http://stackoverflow.com/comment/31184759
has comment: http://stackoverflow.com/comment/31184790
possible better answer: http://stackoverflow.com/a/20801010
accepted answer: http://stackoverflow.com/a/20801382
has answer: http://stackoverflow.com/a/20801022
has answer: http://stackoverflow.com/a/20801382

http://stackoverflow.com/comment/31244689
type: Comment
type: QuestionComment
has text: Of course you can use `this instanceof MainActivity` in RootActivity. If the actual runtime type of the object is MainActivity, it will return true, even if the code is located in a method that was inherited from RootActivity.
comment on: http://stackoverflow.com/q/20832857
score: 0

http://stackoverflow.com/a/20776654
upvote count: 6
has body: The main issue The main issue is that you use the wrong arguments in ct.setSimpleColumn: ct.setSimpleColumn(10, 10, rectWidth , 70); In contrast to the later cb.rectangle call cb.rectangle(10, 10, rectWidth , 70); which has arguments float x, float y, float w, float h (w and h being width and height) the method ct.setSimpleColumn has arguments float llx, float lly, float urx, float ury (ll being lower left and ur being upper right). Thus your ct.setSimpleColumn should look like this: ct.setSimpleColumn(10, 10, 10 + rectWidth, 10 + 70); A side issue In addition to the main issue your result font size is 0.1 too large; essentially this is an error already pointed out by @David. Your main loop in your getMaxFontSize method is this: while(measureWidth &lt; width){ measureWidth = bf.getWidthPoint(text, fontSize); oldSize = fontSize; fontSize += 0.1f; } This essentially results in oldSize (which eventually is returned) being the first font size which does not fit. You could fix this by instead using while(bf.getWidthPoint(text, fontSize) &lt; width){ oldSize = fontSize; fontSize += 0.1f; } Even better would be an approach only calculating the string width once, not using a loop at all, e.g. private static float getMaxFontSize(BaseFont bf, String text, int width) { int textWidth = bf.getWidth(text); return (1000 * width) / textWidth; } (This method uses integer arithmetic. If you insist on an exact fit, switch to float or double arithmetic.)
score: 6
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20769881
answers question: http://stackoverflow.com/q/20769881
type: Answer
has comment: http://stackoverflow.com/comment/31152971

http://stackoverflow.com/a/20779058
has comment: http://stackoverflow.com/comment/31147526
score: 2
has body: With a declaration like &lt;c:forEach items="${record.attributes.entry}" var="entry"&gt; entry is an object of type Map.Entry. You can therefore simply do &lt;td style="width: 20%; height: 15px;"&gt; &lt;img src="${entry.key}" class="img-responsive" /&gt; &lt;/td&gt; to get the key and ${entry.value} to get the value.
has comment: http://stackoverflow.com/comment/31146813
has comment: http://stackoverflow.com/comment/31147701
accepted answer of: http://stackoverflow.com/q/20778968
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31146906
answers question: http://stackoverflow.com/q/20778968
has comment: http://stackoverflow.com/comment/31146958
has comment: http://stackoverflow.com/comment/31147338
type: Answer
has comment: http://stackoverflow.com/comment/31146838
upvote count: 2
has comment: http://stackoverflow.com/comment/31146654

http://stackoverflow.com/a/20821610
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20821513
has body: Between the element servlet-mapping the element servlet-name is missing MyFirstServlet <url-pattern>/myfirstservlet</url-patter> The servlet name is a kind of id which creates a relationship between url and the guven Servlet class.

http://stackoverflow.com/comment/31161362
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20787858
score: 0
has text: Please give the exact package it belongs to.

http://stackoverflow.com/q/20802627
has comment: http://stackoverflow.com/comment/31187891
has body: I am trying to suppress the JavaScript errors that HTMLunit almost always shows when loading a page. But strangely enough, the following code does not work: import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; import com.gargoylesoftware.htmlunit.html.HtmlTextInput; public class HttpClientLogin { public static void main(String[] args) throws Exception { HttpClientLogin logInNow = new HttpClientLogin(); logInNow.loadPage(); } public void loadPage() throws Exception { WebClient webClient = new WebClient(); HtmlPage currentPage = webClient.getPage("the url link here"); webClient.setThrowExceptionOnFailingStatusCode(false); String textSource = currentPage.asText(); String xmlSource = currentPage.asXml(); System.out.println(xmlSource); } } It gives the following error: The method setThrowExceptionOnFailingStatusCode(boolean) is undefined for the type WebClient Are these methods deprecated or am I using the wrong package?
favorite count: 0
possible better answer: http://stackoverflow.com/a/20956931
has answer: http://stackoverflow.com/a/20956931
has comment: http://stackoverflow.com/comment/31188101
has comment: http://stackoverflow.com/comment/31188178
accepted answer: http://stackoverflow.com/a/20803039
type: AnsweredQuestion
has title: HTMLunit suppress errors: deprecated?
tagged with: java
tagged with: error-handling
has comment: http://stackoverflow.com/comment/31188156
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31188257
has comment: http://stackoverflow.com/comment/31188347
score: -1
has comment: http://stackoverflow.com/comment/31188457
has comment: http://stackoverflow.com/comment/31188378
answer count: 2
has answer: http://stackoverflow.com/a/20803039
tagged with: htmlunit
upvote count: 0

http://stackoverflow.com/comment/30971432
type: QuestionComment
comment on: http://stackoverflow.com/q/20682270
type: Comment
has text: in first exampmle the 2 sequences are divided with a shift enter but the second one is divided with a single space.
score: 0

http://stackoverflow.com/q/20704194
tagged with: apple-push-notifications
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12585858
upvote count: 3
tagged with: java
type: Question
tagged with: jakarta-ee
score: 3
has body: iOS push notification failed due to handshake_failure, but it is working fine in my local machine and it gives error when deployed on server. I am using apns-0.1.5.jar Code : static { service = APNS.newService() .withCert(ClassLoader.class.getResourceAsStream("cert.p12"), "pwd") .withSandboxDestination() .build(); } public static void pushMSG(String msg,String deviceToken) { String payload = APNS.newPayload().alertBody(msg).build(); AppLog.info("Message : "+msg+", deviceToken "+deviceToken); service.push(deviceToken, payload); } ERROR LOG com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure com.notnoop.apns.internal.Utilities.wrapAndThrowAsRuntimeException(Utilities.java:268) com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:173) com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:46) com.notnoop.apns.internal.AbstractApnsService.push(AbstractApnsService.java:52) com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:36) com.gcash.notification.APNSManager.pushMSG(APNSManager.java:35) com.gcash.TestServlet.doGet(TestServlet.java:58) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1720) com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954) com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138) com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:632)
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31014187
has comment: http://stackoverflow.com/comment/31012799
favorite count: 0
has answer: http://stackoverflow.com/a/27861365
accepted answer: http://stackoverflow.com/a/27861365
has title: IOS push notification failed due to handshake_failure

http://stackoverflow.com/q/20710673
favorite count: 0
has answer: http://stackoverflow.com/a/20710710
has comment: http://stackoverflow.com/comment/31022758
has comment: http://stackoverflow.com/comment/31022720
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20710691
has answer: http://stackoverflow.com/a/20710731
accepted answer: http://stackoverflow.com/a/20710731
has body: I'm reading a file line-by-line with Java and parsing the data in each line for a report. Periodically, there will be a URL that's been written to a line, and I want to bypass that line. I need to set up an if...then that tests for the presence of a URL -- in this specific case, I define that as the first four bytes of the line reading http. If the condition is true, read the next line in the file, but if the condition is false, send the current line to the parser for report output. Simple, no? I'm running into issues where I cannot get my if..then statement to accurately recognize a true condition. My only clue is that when my inputString is equal to the test value, it passes as true. Beyond that...I can't spot anything out of the ordinary. public class testClass { public static void main(String args[]) { String inputString1 = "http://www.google.com/r"; String inputString2 = "google"; String inputString3 = "google search"; String inputString4 = "http"; parseInput(inputString1); parseInput(inputString2); parseInput(inputString3); parseInput(inputString4); } // private static void parseInput(String inputString8) { int httpFlag; if (inputString8.substring(0,4) == "http") { httpFlag = 1467; } else { httpFlag = 10644; } System.out.println(inputString8+" "+inputString8.toLowerCase().substring(0,4)+" "+httpFlag); } } Here's my output: http://www.google.com/r http 10644 google goog 10644 google search goog 10644 http http 1467 I am expecting 1467 for both inputString1 and inputString4. The console appears to display my input and substring properly, and nothing in the Java Documentation suggests that my substring would be a char array or anything apart from a string, so I can't figure out why http as the first four bytes of a 4-byte string is "different" from the first four bytes of a (4+x)-byte string. What am I missing?
upvote count: 1
downvote count: 1
type: Question
tagged with: if-statement
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
tagged with: substring
score: 0
possible better answer: http://stackoverflow.com/a/20710691
answer count: 3
has comment: http://stackoverflow.com/comment/31022777
has title: How to properly use a java substring in an if test?
has comment: http://stackoverflow.com/comment/31022857

http://stackoverflow.com/comment/31053599
score: 0
type: Comment
has text: @Octopus:- Is that wrong? I mean I didnt get you very clearly. May be I should have written this:- Period period = new Period(date1, date2, PeriodType.yearMonthDay());
type: AnswerComment
comment on: http://stackoverflow.com/a/20727122

http://stackoverflow.com/q/20797737
has body: I do some network request simultaneously and get the response using HTTPClient in Android. I am using threadsafeclientconnmanager in order to have thread safe connection. In order to do it simultaneously I am using Java ThreadPool. private enum STATE { state1, state2, state3 }; ExecutorService executor = Executors.newFixedThreadPool(nThreads); and submit 3 runnable: executor.submit(new Processor(state1)); executor.submit(new Processor(state2)); executor.submit(new Processor(state3)); And this Processor class which extends runnable: class Processor implements Runnable { private STATE state; public Processor(STATE state) { this.state = state; } @Override public void run() { switch (state) { case state1: // Do something // Call Back to update UI break; case state2: // Do something // Call Back to update UI break; case state3: // Do something // Call Back to update UI break; } latch.countDown(); } } As you see in the run method, for every state, I do some instruction and then I need to update UI using callBack methods. And since that is UI thread every callback method should be : runOnUiThread(new Runnable() { @Override public void run() { //Update UI } }); Is there any better solution to update UI when we are having Java thread pool in Android?
has answer: http://stackoverflow.com/a/20797876
tagged with: java
type: Question
tagged with: threadpool
answer count: 1
has comment: http://stackoverflow.com/comment/31193070
score: 0
has comment: http://stackoverflow.com/comment/31195241
tagged with: android
linked to: http://stackoverflow.com/q/9654148
has title: Update UI in Java ThreadPool
has comment: http://stackoverflow.com/comment/31182089
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31179111

http://stackoverflow.com/comment/31272630
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20846385
score: 0
has text: You should edit as minimal as possible.. there is a lot of noise

http://stackoverflow.com/a/20680239
downvote count: 0
type: Answer
has body: You may preprocess your list: replace any word from it with its sorted anagram (i.e. abacaba becomes aaaabbc). This string uniquely represents any word which is the anagram to the word from the dictionary. Then, when you receive a query, sort letters in it and check if this word is in preprocessed dictionary.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20680145

http://stackoverflow.com/comment/31109811
has text: @SureshkumarPanneerselvan I'm using an annotation processor to generate some code. As i wrote above in case of my project this code generation affects on whole project even if some classes didn't changed
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20757975
type: Comment

http://stackoverflow.com/comment/31006841
comment on: http://stackoverflow.com/a/20702030
type: Comment
has text: Thank you, once I read Excellent Bruce Eckel tutorial, and he pointed to this solution ... but I forgot it :(. Anyway thanks. Also, what can be modified : all values ? all keys ? or nothing at all ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31063601
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20732674
has text: But what if the handling code involves OP's `Client` class more than the `Packet` class? Handing over the code to the `Packet` hierarchy, and having to pass the `Client` instance to `packetReceived`, intimately couples these two types. Depending on the rest of the system, this may be entirely inappropriate.
score: 0

http://stackoverflow.com/q/20844203
tagged with: jformattedtextfield
tagged with: string-formatting
has answer: http://stackoverflow.com/a/20844412
tagged with: propertychangelistener
has comment: http://stackoverflow.com/comment/31265108
has comment: http://stackoverflow.com/comment/31265094
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5233012
tagged with: java
has comment: http://stackoverflow.com/comment/31264817
has comment: http://stackoverflow.com/comment/31265053
has answer: http://stackoverflow.com/a/20844382
type: Question
accepted answer: http://stackoverflow.com/a/20844412
possible better answer: http://stackoverflow.com/a/20844359
score: 4
has answer: http://stackoverflow.com/a/20844359
upvote count: 4
answer count: 3
has body: I'm using italian locale for my program so Float.parseFloat("8,00") must function well. But I have encountered a very bad NFE in the following line: this.cuSurfaceJTextField1.setValue( String.format("%05.2f",info.getCuSurface())); I note that the above code used to work well up to some changes I made to the listeners that don't look to be related to this line of the code.(Now I have a propertyChangeListener that updates the model when the value is changed. this.cuSurfaceJTextField1.addPropertyChangeListener("value", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { info.setCuSurface(Float.parseFloat( (String)cuSurfaceJTextField1.getValue())); updateCuSurface(); } }); The useful part of the exception: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "08,00" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241) at java.lang.Float.parseFloat(Float.java:452) at View.bars.QuadrateJPanel$11.propertyChange(QuadrateJPanel.java:348) at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:328) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263) at java.awt.Component.firePropertyChange(Component.java:8382) at javax.swing.JFormattedTextField.setValue(JFormattedTextField.java:799) at javax.swing.JFormattedTextField.setValue(JFormattedTextField.java:502)
has title: NumberFormatException in String.Format("%05.2f", 8.00)
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/20706599
tagged with: multithreading
has comment: http://stackoverflow.com/comment/31016054
has title: Java: sync method how to synchronized with sync static method?
type: Question
type: AnsweredQuestion
tagged with: java
has body: Code Snippet: public class SyncTest { public static void main(String[] args) { new SyncTest().test(); } private void test() { final Outputer outputer = new Outputer(); // Thread 1 new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } outputer.outPut("一二三四五六七八九"); } } }).start(); // Thread2 new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } Outputer.outPut2("123456789"); } } }).start(); } static class Outputer { public void outPut( String name) { int len = name.length(); synchronized (Outputer.this) { // lock is Outputer.class for (int i = 0; i &lt; len; i++) { System.out.print(name.charAt(i)); } System.out.println(); } } public static synchronized void outPut3( String name) { // lock also is Outputer.class int len = name.length(); for (int i = 0; i &lt; len; i++) { System.out.print(name.charAt(i)); } System.out.println(); } } } Output : 123456789 1一2二三四五六七八九 3456789 obvious no synchronized, please give a hand, thanks
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31015145
has comment: http://stackoverflow.com/comment/31015024
has answer: http://stackoverflow.com/a/20706817
accepted answer: http://stackoverflow.com/a/20706817

http://stackoverflow.com/q/20716556
linked to: http://stackoverflow.com/q/23548097
score: 4
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/20727215
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23407290
tagged with: linux-mint
has title: Aptana crashes on ubuntu linux
answer count: 4
has body: Every time i open Aptana it crashes. A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007f14294b2c91, pid=5722, tid=139727004391168 JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18) Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops) Problematic frame: C [libsoup-2.4.so.1+0x6ac91] soup_session_feature_detach+0x11 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.
has answer: http://stackoverflow.com/a/25005439
type: Question
tagged with: aptana3
tagged with: java
has answer: http://stackoverflow.com/a/24745023

http://stackoverflow.com/a/48972159
has body: public class Creditcard { public static void main(String args[]){ Scanner sc=new Scanner(System.in); String cardno = sc.nextLine(); if(checkType(cardno).equals("U")) //checking for unknown type System.out.println("UNKNOWN"); else checkValid(cardno); //validation } private static String checkType(String S) { int AM=Integer.parseInt(S.substring(0,2)); int D=Integer.parseInt(S.substring(0,4)),d=0; for(int i=S.length()-1;i&gt;=0;i--) { if(S.charAt(i)==' ') continue; else d++; } if((AM==34 || AM==37) &amp;&amp; d==15) System.out.println("AMEX"); else if(D==6011 &amp;&amp; d==16) System.out.println("Discover"); else if(AM&gt;=51 &amp;&amp; AM&lt;=55 &amp;&amp; d==16) System.out.println("MasterCard"); else if(((S.charAt(0)-'0')==4)&amp;&amp;(d==13 || d==16)) System.out.println("Visa"); else return "U"; return ""; } private static void checkValid(String S) // S--&gt; cardno { int i,d=0,sum=0,card[]=new int[S.length()]; for(i=S.length()-1;i&gt;=0;i--) { if(S.charAt(i)==' ') continue; else card[d++]=S.charAt(i)-'0'; } for(i=0;i&lt;d;i++) { if(i%2!=0) { card[i]=card[i]*2; if(card[i]&gt;9) sum+=digSum(card[i]); else sum+=card[i]; } else sum+=card[i]; } if(sum%10==0) System.out.println("Valid"); else System.out.println("Invalid"); } public static int digSum(int n) { int sum=0; while(n&gt;0) { sum+=n%10; n/=10; } return sum; } }
answers question: http://stackoverflow.com/q/20740444
score: 0
type: Answer

http://stackoverflow.com/comment/31131814
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20769847
has text: @SSpoke Do you have a source for that?

http://stackoverflow.com/q/20714947
linked to: http://stackoverflow.com/q/2928253
has body: I'm trying to launch a Java program (a video game, specifically) from the command line. Because of (something) I can't figure out how to get the game to output to Terminal in any way when I launch it with the app bundle. To rectify that, I'm trying to write a .command that I and other users can use to open the file from Terminal, but automatically so less tech-savvy users don't need to deal with typing out paths and such in Terminal (and to save me time trying to explain it day in and day out). I'm hoping for an all in one file that will do it with a simple double click. In my Terminal I can simply type: ~/Library/Application\ Support/Steam/SteamApps/common/GameFolder/Game.app/Contents/MacOS/JavaApplicationStub And that launches it fine, with output. Trying to set this as a .command file: #!/bin/bash ~/Library/Application\ Support/Steam/SteamApps/common/GameFolder/Game.app/Contents/MacOS/JavaApplicationStub Works, but won't run without the user doing chmod +x for it (which brings me back to the original problem, of having to make end users do things on command line that they might not be comfortable with). I'd be open to either being told what I'm doing wrong, or if anyone has a suggestion for a better method I'd be open to that as well. Nota Bene, I haven't done shell script work since I was 14 or so, and that's been… quite a while. Thanks in advance.
tagged with: shell
has comment: http://stackoverflow.com/comment/31064747
has comment: http://stackoverflow.com/comment/31032235
tagged with: command-line
has comment: http://stackoverflow.com/comment/31031177
tagged with: terminal
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31031156
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/31032225
tagged with: java
type: Question
has title: Launch Java program with .command

http://stackoverflow.com/comment/31206704
type: QuestionComment
score: 5
has text: Why don't you try it ? (and please fix the tags to include `java`)
type: Comment
comment on: http://stackoverflow.com/q/20812752

http://stackoverflow.com/comment/31176412
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20796134
has text: as such no errors are shown but how to access this database copying class and make it workable, where should i call this?
score: 0

http://stackoverflow.com/q/20841980
has answer: http://stackoverflow.com/a/20842034
linked to: http://stackoverflow.com/q/101100
upvote count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20318872
has comment: http://stackoverflow.com/comment/31260751
has answer: http://stackoverflow.com/a/20842095
answer count: 4
downvote count: 4
has title: Read a file and split lines in Java.
has comment: http://stackoverflow.com/comment/31260784
score: 1
has body: Hello, I want to read a file, file.txt that contains word pairs like this... mot;word oui;yes utiliser;use comment;how After reading this file.txt , I want to split this text and put the French words in an ArrayList and the English words in an another ArrayList. Thanks in advance...
favorite count: 0
has comment: http://stackoverflow.com/comment/31260806
tagged with: file-io
type: Question
has answer: http://stackoverflow.com/a/20842232
linked to: http://stackoverflow.com/q/820172
tagged with: text
has answer: http://stackoverflow.com/a/20842047
tagged with: java
linked to: http://stackoverflow.com/q/8035981
linked to: http://stackoverflow.com/q/1096621
tagged with: split

http://stackoverflow.com/q/20682007
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/30971762
has answer: http://stackoverflow.com/a/20682557
has comment: http://stackoverflow.com/comment/30972260
has answer: http://stackoverflow.com/a/20682691
score: 0
has comment: http://stackoverflow.com/comment/30977344
answer count: 2
has title: Icon in a JLabel
has comment: http://stackoverflow.com/comment/30971362
tagged with: jlabel
has body: I used the following code: JLabel jLabel = new JLabel(new ImageIcon(someImage)); I don't get it.. sometimes the image appears when I run the code and sometimes not.. I'm not always getting the same output. Anyone can explain why this could happen?!
tagged with: imageicon
has comment: http://stackoverflow.com/comment/30972196
has comment: http://stackoverflow.com/comment/30971404
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/30972291

http://stackoverflow.com/comment/31269133
comment on: http://stackoverflow.com/q/20846205
has text: edit your eclipse.ini with installd version of java
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20691537
has comment: http://stackoverflow.com/comment/30988813
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20691403
downvote count: 0
has body: You have declared those 2 variables: String username = "georges"; String pass = "password"; And then you pass them to SignIn SignIn(username, pass); and compare parameters against the same variables. So obviously they are equal. if (username2 == username &amp;&amp; pass2 == pass) You need to pass what the user entered to SignIn BTW, when you compare strings, you need to use equals() or otherwise you compare references. The line should be (though it will always be true as well in the case above): if (username2.equals(username) &amp;&amp; pass2.equals(pass))
answers question: http://stackoverflow.com/q/20691403
has comment: http://stackoverflow.com/comment/30988830
type: Answer
has comment: http://stackoverflow.com/comment/30988729

http://stackoverflow.com/comment/31201142
score: 0
type: AnswerComment
type: Comment
has text: +1; I didn't know that about Java 8.
comment on: http://stackoverflow.com/a/20809762

http://stackoverflow.com/comment/31170628
comment on: http://stackoverflow.com/a/20792895
has text: Once I leave the 70 mark, I want it to turn white. Same goes for the rest of the values. Only 70 is now highlighted green and no matter where I move it stays green.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20703261
tagged with: parameterized-class
has answer: http://stackoverflow.com/a/20706916
tagged with: wildcard
has body: I had been reading up on Generics in Java. In the Wildcard section in the tutorial below all examples are for parameterized methods. It got me thinking of why is there no example for wildcard parameterized type declaration. http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html Does this make sense? What does it mean? public class MyClass&lt;?&gt;{ ? myVar; }
score: 0
possible better answer: http://stackoverflow.com/a/20706916
tagged with: generics
accepted answer: http://stackoverflow.com/a/20712913
has comment: http://stackoverflow.com/comment/31015345
type: AnsweredQuestion
tagged with: java
type: Question
has title: Wildcard parameterized type in Java
answer count: 2
has answer: http://stackoverflow.com/a/20712913

http://stackoverflow.com/a/20848150
type: Answer
has body: You can call methods by class name followed by the point operator (e.g class.method). This would explain not having instantiated an object. But this is only possible with static methods of a class since static methods can only call static methods inside the same class. To have access to the ordinary (non-static) methods and attributes inside a class, your static method should have a reference to an object of the class. So or you have a static method that calls a static method, or a static method that references an object so you can call non-static methods. This means you must have either have a MyAdapter object which you are using to call the method or the authenticatePrimeMember() is static. Unless the above helps or that you have created an object of the class, you will have to double check your code. EDIT: Too bad you didn't flag answer or solved, I typed all this now :(
answers question: http://stackoverflow.com/q/20847910
score: 0
has comment: http://stackoverflow.com/comment/31273364

http://stackoverflow.com/comment/31110971
type: Comment
has text: `(into-array (repeat 2 (double-array...)))` returns an array of primitive double arrays, not an array of unboxed doubles.
comment on: http://stackoverflow.com/a/20729408
score: 0
type: AnswerComment

http://stackoverflow.com/q/20715798
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/20716021
type: UnansweredQuestion
has body: I've created selenium IDE, RC,WebDriver in total 50+ individual test cases using selenium scripting, all are individual scripts of the same project. So now instead of scripting them separately for each and every test case can we use Java concepts like Inheritance, polymorphism to make it effective, my client don't need the scripts to be effective but it is my personal Interest. Please let me know guys.
tagged with: selenium
type: Question
tagged with: java
has title: Are individual test cases are good to execute or is it required to use Java concepts like Inheritance in selenium scripting?

http://stackoverflow.com/comment/30967619
comment on: http://stackoverflow.com/a/20680022
type: Comment
has text: On build path, there's no option of adding other jdk than 1.6, and installing another JDK system wide is something I would like to avoid.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31146122
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20778927
has text: That is the issue. I have it all set to new line except arrays, but using the auto complete, it adds it at the end of the line instead of following the formatters instructions. It may sound lazy, but having to go back and fix the brackets from having it insert in the right spot really affects my efficiency.
score: 0

http://stackoverflow.com/comment/105751872
has text: but what if you want the jar to be minimal? Can you somehow force include certain files?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20750728
type: AnswerComment

http://stackoverflow.com/comment/45171459
type: AnswerComment
has text: It is late but you do have a point. Thanks. I will test it out.
type: Comment
comment on: http://stackoverflow.com/a/28417952
score: 0

http://stackoverflow.com/comment/31045853
comment on: http://stackoverflow.com/a/20723221
score: 0
type: AnswerComment
type: Comment
has text: I like this solution the best, using a constructor in the enum rather than duplicating the method definitions. Thanks.

http://stackoverflow.com/comment/31247233
comment on: http://stackoverflow.com/a/20833921
type: Comment
score: 0
type: AnswerComment
has text: does it means `*sentinel.next = sentinel;` will totally copy everything of sentinel and store them in another adresse in memory and then store this adresse in sentinel.next? so the difference is `*sentinel.next = sentinel;` will copy another instance, but `sentinel.next = &sentinel;` not?

http://stackoverflow.com/a/20745143
has body: You can create a delete method annotated with @DELETE and call it using delete http method in the rest client passing id.Check the below delete method for reference and you can change it as per your requirement. @DELETE @Path("/{id}") @Produces(MediaType.TEXT_PLAIN) public String deletePerson(@PathParam("id") Integer id) { //Your delete logic goes here return "Successfully deleted person info"; }
score: 0
has comment: http://stackoverflow.com/comment/31086281
answers question: http://stackoverflow.com/q/20744955
type: Answer

http://stackoverflow.com/comment/31071109
type: QuestionComment
score: 0
type: Comment
has text: I found an implementation of gradient descent [here](http://stackoverflow.com/questions/19482842/multi-variable-gradient-descent-in-matlab). I guess it is not possible to "vectorize more"
comment on: http://stackoverflow.com/q/20736460

http://stackoverflow.com/q/20811912
has comment: http://stackoverflow.com/comment/31223113
answer count: 2
has answer: http://stackoverflow.com/a/20822244
has title: AES ECB mode encrypt in java and decrypt in ruby
has comment: http://stackoverflow.com/comment/31205272
has comment: http://stackoverflow.com/comment/31223161
upvote count: 0
has comment: http://stackoverflow.com/comment/31218728
has comment: http://stackoverflow.com/comment/31205326
has body: I have to encryption method which write in java. My encryption java code: public static String encrypt(String content, String sKey) { try { SecretKey secretKey = null; KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(sKey.getBytes()); kgen.init(128, secureRandom); secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded(); SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] byteContent = content.getBytes("utf-8"); byte[] result = cipher.doFinal(byteContent); return ByteUtil.parseByte2HexStr(result); } catch (Exception e) { e.printStackTrace(); } return content; } ## ByteUtil.java ... public static String parseByte2HexStr(byte buf[]) { StringBuffer sb = new StringBuffer(); for (int i = 0; i &lt; buf.length; i++) { String hex = Integer.toHexString(buf[i] &amp; 0xFF); if (hex.length() == 1) { hex = '0' + hex; } sb.append(hex.toUpperCase()); } return sb.toString(); } My ruby decryption code (not work): require "openssl" require 'digest/sha2' require 'base64' def decryption(encrypted, key) decipher = OpenSSL::Cipher::AES.new(128, :ECB) decipher.decrypt decipher.padding = 0 decipher.key = [key].pack('H*') encrypted = [encrypted].pack('H*') plain = decipher.update(encrypted) + decipher.final p plain p plain.unpack('s*') p plain.unpack('m*') p plain.unpack('u*') p plain.unpack('h*') p plain.unpack('a*') end Anyone can help? thanks in advance!!! when I use 'ef3192c8803a47cb829d487dd2f78a3d' as key, and encrypt 'helloworld' with my java code, I get '3CAEF382FB17A045EADDEFC72D3D0362', But when I try use my ruby code to decrypt it, I call decryption('3CAEF382FB17A045EADDEFC72D3D0362', 'ef3192c8803a47cb829d487dd2f78a3d') I can't get 'helloworld', So I think the decryption code is not work. Java decryption code( it's works) public static String decrypt(String content, String sK…
tagged with: cryptography
favorite count: 0
score: -1
accepted answer: http://stackoverflow.com/a/20822244
tagged with: aes
has comment: http://stackoverflow.com/comment/31205314
has comment: http://stackoverflow.com/comment/31224321
tagged with: encryption
has comment: http://stackoverflow.com/comment/31205279
has comment: http://stackoverflow.com/comment/31205117
has comment: http://stackoverflow.com/comment/31205224
tagged with: ruby-on-rails
downvote count: 1
has answer: http://stackoverflow.com/a/20812041
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31205382
tagged with: java
has comment: http://stackoverflow.com/comment/31223016
possible better answer: http://stackoverflow.com/a/20812041
has comment: http://stackoverflow.com/comment/31212819
type: Question

http://stackoverflow.com/a/20718405
has body: You are using apache HttpClient 4.3 library with apache HttpClient 4.2 code. Please notice that getParams() and ConnRoutePNames are not the only deprecated methods in your case. The DefaultHttpClient class itself rely on 4.2 implementation and is also deprecated in 4.3. In regard to the 4.3 documentation here (http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/connmgmt.html#d5e473), you can rewrite it this way: private HttpClient createHttpClientOrProxy() { HttpClientBuilder hcBuilder = HttpClients.custom(); // Set HTTP proxy, if specified in system properties if( isSet(System.getProperty("http.proxyHost")) ) { int port = 80; if( isSet(System.getProperty("http.proxyPort")) ) { port = Integer.parseInt(System.getProperty("http.proxyPort")); } HttpHost proxy = new HttpHost(System.getProperty("http.proxyHost"), port, "http"); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); hcBuilder.setRoutePlanner(routePlanner); } CloseableHttpClient httpClient = hcBuilder.build(); return httpClient; }
answers question: http://stackoverflow.com/q/20716909
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20716909
type: Answer
upvote count: 10
downvote count: 0
score: 10

http://stackoverflow.com/a/20705335
type: Answer
answers question: http://stackoverflow.com/q/20705316
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: Use JDialog instead of a JFrame. A JDialog will not create new items in the task bar. Possibly even make the dialog modal to make it easier on the user. If your first Frame is much smaller than the second frame you want to open, you might want to rethink your GUI and possibly make the first frame larger and use a JDesktop like you mention or just update the content of a single frame.
accepted answer of: http://stackoverflow.com/q/20705316

deployment
tags question: http://stackoverflow.com/q/20797196
tag name: deployment
tags question: http://stackoverflow.com/q/20785943
type: Tag
tags question: http://stackoverflow.com/q/20706076
tags question: http://stackoverflow.com/q/20693009

http://stackoverflow.com/comment/31095258
comment on: http://stackoverflow.com/a/20738975
type: Comment
has text: I deleted them, but hopelessly after reopen project they are recreated
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31258871
has text: @nrathaus - this code is not a homework, it's part of my implementation of RSA algorithm for testing purposes :)
type: Comment
comment on: http://stackoverflow.com/a/20840868
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35395345
comment on: http://stackoverflow.com/a/22524712
score: 9
type: AnswerComment
type: Comment
has text: I ran into this issue, and the given flag (`-Dbuild.compiler=javac1.7`) works when passed directly to `ant` as well.

http://stackoverflow.com/a/20680662
has body: I never used EBS and couldn't find an API specification online. However, the general scheme is that the service will redirect the user to some pingback URL after a successful transaction. This pingback URL contains the transaction ID, and so you need nothing more than a simple servlet that checks against the EBS services that the transaction with the given ID was truly successful. After the check, you can send a message to the user in the HTML response and trigger the needed actions in your system. Regarding the cancelation part, you can schedule a cron job (for example with Quartz scheduler) that periodically checks unpaid appointments and trashes the ones too old. However I think 10 minutes are a very short period because the payment itself may last more than 10 minutes. A better approach is giving the user 10 minutes to finalize the order. A finalized order can still be paid, unpaid or even canceled, but won't be trashed by the periodic job.
has comment: http://stackoverflow.com/comment/30970448
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/30970235
type: Answer
accepted answer of: http://stackoverflow.com/q/20680457
answers question: http://stackoverflow.com/q/20680457
score: 1
has comment: http://stackoverflow.com/comment/30968605
has comment: http://stackoverflow.com/comment/30969226
upvote count: 1

http://stackoverflow.com/comment/31185605
type: Comment
has text: Dec 5, 2013 like this
comment on: http://stackoverflow.com/a/20801279
type: AnswerComment
score: 0

http://stackoverflow.com/q/20723837
accepted answer: http://stackoverflow.com/a/20724512
tagged with: spring-mvc
type: AnsweredQuestion
has title: Spring + JAX.RS - context loaded twice
tagged with: java
upvote count: 1
type: Question
has body: I am developing application that serves REST API for clients, to do this I decided to use JAX-RS implementation Jersey and Spring for some dependency injection. Today I noticed in my logs, that my application context seems to be loaded twice, for example: 2013-12-21 22:18:55 INFO ContextLoader:272 - Root WebApplicationContext: initialization started 2013-12-21 22:18:55 INFO ContextLoader:272 - Root WebApplicationContext: initialization started I looked through similiar posts, but seeing my web.xml file, I can't seem to find the culprit: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> Spring MVC Application RestPowtorkiServlet org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application org.powtorki.spring.PowtorkiApplication 1 RestPowtorkiServlet /rest/* log4jConfigLocation classpath:log4j.properties org.springframework.web.util.Log4jConfigListener springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /rest/* Also I tried running example app from Jersey repository (https://github.com/jersey/jersey/tree/2.4.1/examples/helloworld-spring-webapp) and it seems it is suffering from the same issue. Is it a bug in Spring integration with Jersey? If so is there a way to fix it somehow? EDIT: log4j configuration: # Root logger option log4j.rootLogger=DEBUG, stdout log4j.category.org.springframework.data.document.mongodb=DEBUG,stdout log4j.logger.org.springframework.web.context.ContextLoader=DEBUG,stdout # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
tagged with: jersey
has answer: http://stackoverflow.com/a/20724512
has comment: http://stackoverflow.com/comment/31048275
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31048156
favorite count: 0
tagged with: spring

timer
tag name: timer
tags question: http://stackoverflow.com/q/20819436
tags question: http://stackoverflow.com/q/20820548
tags question: http://stackoverflow.com/q/20765872
tags question: http://stackoverflow.com/q/20823689
tags question: http://stackoverflow.com/q/20739836
tags question: http://stackoverflow.com/q/20734217
type: Tag
tags question: http://stackoverflow.com/q/20767739
tags question: http://stackoverflow.com/q/20758789
tags question: http://stackoverflow.com/q/20811430
tags question: http://stackoverflow.com/q/20844735
tags question: http://stackoverflow.com/q/20745355
tags question: http://stackoverflow.com/q/20706952
tags question: http://stackoverflow.com/q/20726180
tags question: http://stackoverflow.com/q/20717402
tags question: http://stackoverflow.com/q/20810398

http://stackoverflow.com/comment/31088637
has text: @JeroenVannevel I'mm gonna paste the code right away
score: 0
comment on: http://stackoverflow.com/q/20746887
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31099829
has text: Use `PreferenceManager.getDefaultSharedPreferences(this);` instead.
type: AnswerComment
comment on: http://stackoverflow.com/a/20752828
type: Comment
score: 0

http://stackoverflow.com/comment/31117611
score: 0
comment on: http://stackoverflow.com/a/20762924
type: Comment
has text: No, at first, I don't add in WEB-INF/lib. Then I tried to add some jars. And when you say me that I need to add resteasy-jaxrs-3.0.6.Final, I added only. But Tomcat shows an error when it starts.
type: AnswerComment

http://stackoverflow.com/comment/30992324
score: 0
has text: @mihai_mandis - There is absolutely nothing wrong with `set /a parmCount+=1`. It cannot be the source of the problem, and I would argue it is the preferred way to increment a value, but it is mostly a matter of style.
comment on: http://stackoverflow.com/q/20691925
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20787141
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31159896
has body: I believe you are looking for javax.servlet.http.HttpServlet. public class TestingServlet extends HttpServlet { There is no HttpServer class in any of the packages you've imported.
has comment: http://stackoverflow.com/comment/31159864
score: 5
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20787132
answers question: http://stackoverflow.com/q/20787132

http://stackoverflow.com/comment/31103227
has text: @user3131312 no, just mark as correct peeskillet answer
comment on: http://stackoverflow.com/a/20754609
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20828257
answer count: 1
downvote count: 0
favorite count: 0
tagged with: paypal-sandbox
has answer: http://stackoverflow.com/a/20838739
type: AnsweredQuestion
has body: We do express checkout(on sandbox) and we set "zh_CN" in the create recurring payments profile CreateRecurringPaymentsProfileRequestType reqType = new CreateRecurringPaymentsProfileRequestType(); reqType.setVersion(VERSION); reqType.setErrorLanguage(getLangCode()); We also happen to set it in the request paypal token api as well in two places(which works since the paypal site shows up in chinese)... setExpressCheckoutRequestDetails.setReturnURL(url); setExpressCheckoutRequestDetails.setCancelURL(url2); setExpressCheckoutRequestDetails.setPaymentDetails(paymentDetailsList); //This is the first place which works!!!! as the paypal GUI shows up in chinese... setExpressCheckoutRequestDetails.setLocaleCode(getLangCode()); setExpressCheckoutRequestDetails.setBuyerEmail(user.getEmail()); SetExpressCheckoutRequestType setExpressCheckoutRequest = new SetExpressCheckoutRequestType(setExpressCheckoutRequestDetails); setExpressCheckoutRequest.setVersion(VERSION); //This is the second location which probably doesn't work though this request has never failed :( and I don't know how to force a failure :( as putting amount 105.37 on negative testing did not work setExpressCheckoutRequest.setErrorLanguage(getLangCode()); We then comment out the startdate of the billing period to cause a failure since negative testing is not working (see post how to simulate payment denial in paypal sandbox ). This causes a failure but the errors that come back are in English not chinese saying "Start Date is required" and long message "Subscription start date is required" error code 11549. Why is this not working? (We just simply display the paypal errors because it seems like too many to translate all the time but it's not in the correct language). thanks, Dean
score: 1
tagged with: java
upvote count: 1
tagged with: paypal
type: Question
accepted answer: http://stackoverflow.com/a/20838739
has title: paypal error messages not in correct language
linked to: http://stackoverflow.com/q/20818171

http://stackoverflow.com/comment/63584242
has text: You're evaluating the **whole** stream in advance! And if `current` never `.equals(e)`, you'll get an endless loop. Both even if you subsequently apply e.g. `.limit(1)`. That's far worse than *'unclean'*.
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/26255154

http://stackoverflow.com/comment/30986005
has text: Possible duplicate of [Calculating all of the subsets of a set of numbers](http://stackoverflow.com/questions/4640034/calculating-all-of-the-subsets-of-a-set-of-numbers)
score: 1
comment on: http://stackoverflow.com/q/20690104
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31016656
type: AnswerComment
score: 0
type: Comment
has text: Another option to create schema is to use URL `jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true`.
comment on: http://stackoverflow.com/a/20705074

http://stackoverflow.com/comment/31143065
score: 0
comment on: http://stackoverflow.com/a/20777073
type: AnswerComment
has text: Thanks a lot :) Is this the standard way to do things when you want to edit graphic content in a class from a different class? Or are there ways that are more common?
type: Comment

http://stackoverflow.com/comment/31384687
comment on: http://stackoverflow.com/a/20888804
type: AnswerComment
score: 0
type: Comment
has text: Your code works fine to get the leaf node values but I dont have access to the xml file. I get an unmarshalled pojo object to work with. Is there any way I can use DOM over the pojo instead of xml file?

http://stackoverflow.com/a/20789156
has comment: http://stackoverflow.com/comment/31165600
answers question: http://stackoverflow.com/q/20788922
has comment: http://stackoverflow.com/comment/31189409
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31163958
has comment: http://stackoverflow.com/comment/31166085
has comment: http://stackoverflow.com/comment/31164394
has comment: http://stackoverflow.com/comment/31173485
has comment: http://stackoverflow.com/comment/31165222
has comment: http://stackoverflow.com/comment/31165404
has comment: http://stackoverflow.com/comment/31165456
has comment: http://stackoverflow.com/comment/31165637
has comment: http://stackoverflow.com/comment/31165894
has comment: http://stackoverflow.com/comment/31173339
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31173894
has comment: http://stackoverflow.com/comment/31166360
has comment: http://stackoverflow.com/comment/31173581
has comment: http://stackoverflow.com/comment/31164175
has comment: http://stackoverflow.com/comment/31166440
has comment: http://stackoverflow.com/comment/31165968
has body: Hibernate uses proxy objects when you have relationships to other entities, this proxy helps to get the info from the DataBase only when it is needed so it mechanism is called a lazy initialization, and to get the info it needs the session object, the object customer in your list is not initialize so you need to do it, explicit so: public List&lt;CustomerProfile&gt; findAll(){ List&lt;CustomerProfile&gt; list_cust = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); String sql = "FROM CustomerProfile"; try{ session.beginTransaction(); list_cust = session.createQuery(sql).list(); for (CustomerProfile cp : list_cust) { Hibernate.initialize(cp.getCustomer()); //or cp.getCustomer().getLoginName(); } session.beginTransaction().commit(); }catch(Exception e){ session.beginTransaction().rollback(); } return list_cust; }
has comment: http://stackoverflow.com/comment/31163725
has comment: http://stackoverflow.com/comment/31165714
has comment: http://stackoverflow.com/comment/31173445
accepted answer of: http://stackoverflow.com/q/20788922
type: Answer
has comment: http://stackoverflow.com/comment/31163828

http://stackoverflow.com/q/20832057
accepted answer: http://stackoverflow.com/a/20832183
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31243131
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20832183
score: 0
possible better answer: http://stackoverflow.com/a/20832681
has comment: http://stackoverflow.com/comment/31243266
has answer: http://stackoverflow.com/a/20832681
has body: I had my Pojo class: @Entity @Table(name="INSTITUTE") public class Institute { private int id; private Member member_id; private String yearoffrom; private Date created_date; private Country country_id; private State state_id; private City city_id; private String josh_rating; private String institute_type; private Clob about; private String tags; private String natureofbus; private String placement; private String placement_percentage; private String affiliations; private String scholarship; private String keyword; private String avg_salary; private String document_path; private String contact_person; private String address; private String source; private String zip; private int is_active; private int is_deleted; private AdminUser created_by_id; private AdminUser verified_by_id; I am selecting only few columns through HQL select inst.id,inst.member_id.name as institutename,inst.institute_type,inst.city_id.name as cityname,inst.state_id.name as statename,inst.country_id.name as countryname,inst.created_by_id.username as createdby,inst.verified_by_id.username as verifiedby from Institute inst On running the code, I found that Hibernate query is generated by Application and is returning the resultset. But when I want to traverse the list by this code: for(Institute bean : institutelist) { Application throws an ClassCastException. How to resolve this problem? Following is the stracktrace: SEVERE: Servlet.service() for servlet [spring] in context with path [/EducationNew] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to education.bean.Institute] with root cause java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to education.bean.Institute at education.service.InstituteListingService.getInstituteList_HQL(InstituteListingService.java:45) at education.controller.LoginController.validateUser(LoginController.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) a…
has title: class cast exception on running HQL
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/31243216

http://stackoverflow.com/comment/31000384
type: Comment
type: QuestionComment
has text: Where does it say boat is abstract?
comment on: http://stackoverflow.com/q/20698138
score: 0

pointers
tags question: http://stackoverflow.com/q/20735956
tags question: http://stackoverflow.com/q/20689509
type: Tag
tag name: pointers

http://stackoverflow.com/a/20755084
accepted answer of: http://stackoverflow.com/q/20755058
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20755058
has body: You seem to be expecting a 10-digit number, not an 8-digit one. You have an extra \\d\\d in the middle of your expression. ^(((19\\d\\d)|([2-9]\\d\\d\\d))\\d\\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])? ^^^^^^ Here Note that some 7, 8 and 9-digit numbers will be accepted by your regular expression, for two reasons. You've made the 0s optional at the beginning of the month, and the beginning of the day, by way of the ? after each 0. You've made the day itself optional, by way of the ? at the end.

http://stackoverflow.com/q/20792098
has comment: http://stackoverflow.com/comment/31169238
possible better answer: http://stackoverflow.com/a/20792104
type: Question
has answer: http://stackoverflow.com/a/20792187
accepted answer: http://stackoverflow.com/a/20792187
tagged with: java
score: 0
answer count: 2
has body: Does the java compiler automatically add an escape character if a string is not escaped and the value is stored in a properties file? For example, the following statement generates a compiler error because of the \W character: testRegex ="[ \t]*(Not\Wknown)[ \\t]*"; If however i store that string in a properties file and load it as it is, the compiler does not complain. app.properties regex.expr = [ \t]*(Not\Wknown)[ \\t]* MyClass.java testRegex = System.getProperty("regex.expr"); Does the compiler automatically escape the \W value?
has answer: http://stackoverflow.com/a/20792104
has title: Java - Escaping characters directly in code vs in a properties file
tagged with: property-files
type: AnsweredQuestion

http://stackoverflow.com/q/20706289
upvote count: 3
answer count: 1
tagged with: travis-ci
favorite count: 0
has answer: http://stackoverflow.com/a/20706750
accepted answer: http://stackoverflow.com/a/20706750
has comment: http://stackoverflow.com/comment/31015374
has body: Hi so my current build is passing which you can view here: https://travis-ci.org/quinnliu/WalnutiQ But if you go to my repository here:https://github.com/quinnliu/WalnutiQ and look at the travis CI status bar it still says there is a build error. How can I fix this?
type: AnsweredQuestion
downvote count: 0
type: Question
score: 3
has title: Travis CI build passing but status bar still showing error
tagged with: java

http://stackoverflow.com/a/20790066
has body: You can read each line and split(" ") which will give you an array of Strings with the data from that line, then you can check the first index to see what is the category. Using the Hashmap as you did, you could use this first String as the key and add the line to an ArrayList that could be the value for your Hashmap, then you will have all the lines of a given category added to the ArrayList. Cheers
type: Answer
answers question: http://stackoverflow.com/q/20789915
score: 0

http://stackoverflow.com/comment/31261646
type: Comment
type: QuestionComment
has text: Just in case I would consider taking all the .close() calls to a `finally {}` block, that way you make sure you return all the resources you asked for to the OS
comment on: http://stackoverflow.com/q/20842410
score: 1

http://stackoverflow.com/q/20748000
tagged with: collections
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/31090647
type: Question
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/31094263
score: -4
has answer: http://stackoverflow.com/a/20748106
has answer: http://stackoverflow.com/a/20748082
has comment: http://stackoverflow.com/comment/31090648
has body: For some reason: List&lt;String&gt; words = new ArrayList&lt;String&gt;(); gives me an error (red line) under the word List, but this: ArrayList&lt;String&gt; words = new ArrayList&lt;String&gt;(); doesn't. Why is that?
favorite count: 0
has title: Error with lists in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31090577

dom
tags question: http://stackoverflow.com/q/20731853
type: Tag
tags question: http://stackoverflow.com/q/20795479
tags question: http://stackoverflow.com/q/20782400
tags question: http://stackoverflow.com/q/20728185
tags question: http://stackoverflow.com/q/20759712
tags question: http://stackoverflow.com/q/20728634
tags question: http://stackoverflow.com/q/20746274
tags question: http://stackoverflow.com/q/20747333
tag name: dom
tags question: http://stackoverflow.com/q/20682263

http://stackoverflow.com/comment/31155751
type: QuestionComment
type: Comment
has text: @alex2410 It's from the spiffy framework. http://spiffyframework.sourceforge.net/javadoc/spiffy/core/util/TwoDHashMap.html
comment on: http://stackoverflow.com/q/20784872
score: 0

http://stackoverflow.com/a/20778109
has body: con is very likely to be null in this situation properbably due to connect() not being called. Although, maybe connect() is being called and there is a SQLException exception which is silently being caught. In most cases, it is a bad idea to catch an exception and do nothing about it. Minimally, you should log the exception. Also this is incorrect String sql = "SELECT USERNAME, PASSWORD FROM " + "APP.LOGIN_DETAILS WHERE " + "USERNAME ='"+user+"'PASSWORD ='"+pass+"'"; try String sql = "SELECT USERNAME, PASSWORD FROM " + "APP.LOGIN_DETAILS WHERE " + "USERNAME = '" +user+ " and 'PASSWORD ='"+pass+"'";
answers question: http://stackoverflow.com/q/20778011
score: 0
has comment: http://stackoverflow.com/comment/31145527
has comment: http://stackoverflow.com/comment/31145495
has comment: http://stackoverflow.com/comment/31145295
type: Answer
has comment: http://stackoverflow.com/comment/31144896
has comment: http://stackoverflow.com/comment/31145279
has comment: http://stackoverflow.com/comment/31144757

http://stackoverflow.com/comment/31194528
type: QuestionComment
comment on: http://stackoverflow.com/q/20806316
score: 3
has text: I think those are not valid reasons to determine "security". May be what they meant was "support".
type: Comment

http://stackoverflow.com/comment/31136826
type: QuestionComment
has text: Your `main` method is in `DemoBook`, not `TextBook`. Run the former.
score: 0
comment on: http://stackoverflow.com/q/20773888
type: Comment

http://stackoverflow.com/comment/31167546
type: AnswerComment
comment on: http://stackoverflow.com/a/20782361
score: 0
type: Comment
has text: @Voo no , you are either mistaken or confused. when you declare a single byte, it takes a whole 32 bits (not bytes) which is 4 bytes. on some VMs , it will take less on some cases (for example an array of bytes). in any case, java developers don't use a byte type in order to save space, but because it's the most logical thing to do (for example when messing around with raw data). Java is more about logical high level than low level.

http://stackoverflow.com/comment/31340254
score: 0
comment on: http://stackoverflow.com/q/20838461
has text: Found out I need a STjlStringAdapter. http://i-proving.com/2007/10/17/understanding-hl7-data-types/ Can't find a download for a HL7 library anywhere though, this is so frustrating...
type: QuestionComment
type: Comment

checkboxlist
tags question: http://stackoverflow.com/q/20734999
type: Tag
tag name: checkboxlist

http://stackoverflow.com/q/20829547
type: Question
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20829582
linked to: http://stackoverflow.com/q/338206
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/20831109
has comment: http://stackoverflow.com/comment/31238159
has body: I'm trying to use a switch statement in a Android Application. This switch statement is testing the value of a String, and then based of that changing the value of another String. String s1 = "a" then String s2 = "1" I keep getting an error that says I need to change the compliance to 1.7. After I do that, I then get an error that says I need to change the compliance to 1.6. Is there a way to fix this? or can anyone think of a work around for this?
has comment: http://stackoverflow.com/comment/31240303
has comment: http://stackoverflow.com/comment/31238522
has comment: http://stackoverflow.com/comment/31238115
accepted answer: http://stackoverflow.com/a/20829604
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31238149
has title: Switch statement of string
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20829604
has answer: http://stackoverflow.com/a/59476534
tagged with: switch-statement
possible better answer: http://stackoverflow.com/a/20831109
has comment: http://stackoverflow.com/comment/31238285

http://stackoverflow.com/comment/66712945
type: AnswerComment
score: 0
has text: Happy to discover tinyb : at least, a solution exists now. So my (old) answer is no more relevant, and you should try this Intel project.
type: Comment
comment on: http://stackoverflow.com/a/36928156

http://stackoverflow.com/q/20688288
has comment: http://stackoverflow.com/comment/30982411
tagged with: war
answer count: 0
type: UnansweredQuestion
has title: How to use rest war for development
has comment: http://stackoverflow.com/comment/30995335
tagged with: java
tagged with: javascript
tagged with: eclipse
has body: I have a REST application packed as a war file from which I have to develop a UI in java+Spring (since this app will do some stuff besides consuming the already created web app). Is there a way to add that war file to my eclipse development environment? The only thing i could came up was exporting the new app as war and put it together to the existing war and test them in some test environment. (both apps will be in the same server in the future). Thanks in advance.
type: Question
score: 0

http://stackoverflow.com/comment/31260025
type: AnswerComment
type: Comment
score: 0
has text: I am feeling you. Let me try to add Log4J manually and see if it resolve the defect.
comment on: http://stackoverflow.com/a/20839623

http://stackoverflow.com/a/20838651
has body: I'm going to go out on a limb ... I think what you are doing is a bad idea: Your utility class should not be writing to log files. It should be sending log events to a logging subsystem (java.util.logging, log4j, logback, slf4j, etc.) and leaving it to the logging subsystem to decide what to log. Your utility class should not be generating emails. If you are going to do that kind of thing, it is best to disconnect that from the application entirely. For example, implement something to scan the log files ... or process log events. There are sophisticated systems that are designed for doing this without filling the admin's mail box, etc with useless error reports. Look up "nagios" and "zenoss" for some examples ... The main advantage of using logging subsystem and external monitoring is that you can change the behaviour in configuration files rather than having to modify, build and redeploy your code.
answers question: http://stackoverflow.com/q/20838482
has comment: http://stackoverflow.com/comment/31254692
has comment: http://stackoverflow.com/comment/31254739
score: 4
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/31056018
score: 2
type: Comment
comment on: http://stackoverflow.com/q/20728621
type: QuestionComment
has text: @Jayan I'm using application plugin to build and run on my local dev box. But on a production environment, gradle may not be there and I would have to just copy the jar to prod and run.

http://stackoverflow.com/comment/31253488
score: 0
has text: @MounirHamoudi thanks for replying but the repaint and revalidate does not solve the problem , I have solved it by setting popup to false then set it to true mean use it two times at the same place like this box.setpopupvisible(false); box.setpopupvisible(true); for the second question I have solved it also by using box.geteditor().getitem();
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20829050

http://stackoverflow.com/q/20796484
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/20796570
has comment: http://stackoverflow.com/comment/31176958
type: Question
has comment: http://stackoverflow.com/comment/31176998
has title: Start Multiple thread at the same time
has answer: http://stackoverflow.com/a/21283549
has answer: http://stackoverflow.com/a/20797024
score: 0
has body: I have a list of different URLs (about 10) from which I need content. I have made a program with which I am getting the content of 1 URL but I am unable to do it with multiple URLs. I've studied lots of tutorials on threads in Java but I'm unable to find an answer. In my case, URLs are like www.example1.com, www.example2.com, www.example3.com, www.example4.com. I want to make thread for each URL and run it at the same time. public class HtmlParser { public static int searchedPageCount = 0, skippedPageCount = 0, productCount = 0; public static void main(String[] args) { List&lt;String&gt; URLs = new LinkedList&lt;String&gt;(); long t1 = System.currentTimeMillis(); URLs.add("www.example.com"); int i = 0; for (ListIterator iterator = URLs.listIterator(); i &lt; URLs.size();) { i++; System.out.println("While loop"); List&lt;String&gt; nextLevelURLs = processURL(URLs.get(iterator .nextIndex())); for (String URL : nextLevelURLs) { if (!URLs.contains(URL)) { System.out.println(URL); iterator.add(new String(URL)); } } System.out.println(URLs.size()); } System.out.println("Total products found: " + productCount); System.out.println("Total searched page: " + searchedPageCount); System.out.println("Total skipped page: " + skippedPageCount); long t2 = System.currentTimeMillis(); System.out.println("Total time taken: " + (t2 - t1) / 60000); } public static List&lt;String&gt; processURL(String URL) { List&lt;String&gt; nextLevelURLs = new ArrayList&lt;String&gt;(); try { searchedPageCount++; // System.out.println("Current URL: " + URL); Elements products = Jsoup.connect(URL).timeout(60000).get() .select("div.product"); for (Element product : products) { System.out.println(product.select(" a &gt; h2").text()); System.out.println(product.select(" a &gt; h3").text()); System.out.println(product.select(".product &gt; a").attr("href")); System.out .println(product.select(".image a &gt; img").attr("src")); System.out.println(product.select(".price").text()); System.out.println(); produ…
answer count: 3
accepted answer: http://stackoverflow.com/a/21283549
has comment: http://stackoverflow.com/comment/31177187
has answer: http://stackoverflow.com/a/20796570
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31176997

file-io
tags question: http://stackoverflow.com/q/20841980
tags question: http://stackoverflow.com/q/20779946
tags question: http://stackoverflow.com/q/20795169
tags question: http://stackoverflow.com/q/20735174
tags question: http://stackoverflow.com/q/20778845
tags question: http://stackoverflow.com/q/20699000
tags question: http://stackoverflow.com/q/20753600
tags question: http://stackoverflow.com/q/20792522
tags question: http://stackoverflow.com/q/20821423
type: Tag
tags question: http://stackoverflow.com/q/20786822
tags question: http://stackoverflow.com/q/20682270
tags question: http://stackoverflow.com/q/20717806
tags question: http://stackoverflow.com/q/20791441
tags question: http://stackoverflow.com/q/20802794
tags question: http://stackoverflow.com/q/20693270
tags question: http://stackoverflow.com/q/20728248
tags question: http://stackoverflow.com/q/20688705
tags question: http://stackoverflow.com/q/20684514
tags question: http://stackoverflow.com/q/20773657
tags question: http://stackoverflow.com/q/20801710
tags question: http://stackoverflow.com/q/20768086
tag name: file-io
tags question: http://stackoverflow.com/q/20690247
tags question: http://stackoverflow.com/q/20817588
tags question: http://stackoverflow.com/q/20813606
tags question: http://stackoverflow.com/q/20682226
tags question: http://stackoverflow.com/q/20793781
tags question: http://stackoverflow.com/q/20794204
tags question: http://stackoverflow.com/q/20797281

http://stackoverflow.com/a/20739626
upvote count: 1
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20739600
has body: Yes there is a reason and you would have known if you read the first lines of it's javadoc: This class implements the Set interface, backed by a hash table (actually a HashMap instance). It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time.

http://stackoverflow.com/comment/30982396
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20688179
has text: This doesn't seem like a job for regular expression, unless you want to translate Delete Here in all language and store them in your expression which seems insane to me.

http://stackoverflow.com/comment/31125523
has text: @Pshemo - The edit makes perfect sense, although I'm not sure exactly what OP's blind spot was. The key thing to realize is that `new int[][]{{1}}` (with or without parentheses around it) is an [_array creation expression_](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.10) and the trailing `[0]` is simply selecting the element at index 0 of the just-created array.
comment on: http://stackoverflow.com/a/20767083
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/30995930
comment on: http://stackoverflow.com/a/20695508
score: 0
type: AnswerComment
type: Comment
has text: how are you deploying in tomcat?

http://stackoverflow.com/comment/31205312
score: 0
type: Comment
type: QuestionComment
has text: Are you sure it's not just a problem with your console? If you print to `System.out` then you need to ensure that your console / command prompt / terminal / etc is able to properly render unicode characters, is in a font that can etc!
comment on: http://stackoverflow.com/q/20802486

http://stackoverflow.com/comment/31037179
has text: The easiest way to find out, is to make a `Point2D` of the original position and transform it!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20718462
score: 1

http://stackoverflow.com/a/20792895
has comment: http://stackoverflow.com/comment/31171382
has comment: http://stackoverflow.com/comment/31171007
has comment: http://stackoverflow.com/comment/31171042
type: Answer
has comment: http://stackoverflow.com/comment/31170805
has comment: http://stackoverflow.com/comment/31171101
has comment: http://stackoverflow.com/comment/31179160
has comment: http://stackoverflow.com/comment/31170888
upvote count: 3
has body: you should probably change == to &gt;= updated answer: in the xml, you have android:max="120", make it android:max="190"
has comment: http://stackoverflow.com/comment/31171215
has comment: http://stackoverflow.com/comment/31171002
answers question: http://stackoverflow.com/q/20792887
has comment: http://stackoverflow.com/comment/31170787
score: 3
has comment: http://stackoverflow.com/comment/31170836
accepted answer of: http://stackoverflow.com/q/20792887
has comment: http://stackoverflow.com/comment/31170628
has comment: http://stackoverflow.com/comment/31170962
has comment: http://stackoverflow.com/comment/31179926
has comment: http://stackoverflow.com/comment/31170967
has comment: http://stackoverflow.com/comment/31170859
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20768945
answers question: http://stackoverflow.com/q/20768806
type: Answer
has body: Try this below method(using inflating view) public void onKillClick(View v) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); //or youractivity.getsystemservice v = vi.inflate(R.layout.row, null); TextView t = (TextView) v.findViewById(R.id.toptext); String s = t.getText().toString(); net.killProcess(s); }
score: 0

http://stackoverflow.com/comment/31200387
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/20807066
has text: If I use that it's the 1.0 schema.

http://stackoverflow.com/q/20806011
has comment: http://stackoverflow.com/comment/31197702
has body: I have a Java-written server that executes this code to digest the password before inserting it into the database: private static StandardStringDigester getDigester() { StandardStringDigester v_Digester = new StandardStringDigester(); v_Digester.setAlgorithm("SHA-1"); v_Digester.setIterations(50000); return v_Digester; } public static String digest(String p_InputPassword) { return getDigester().digest(p_InputPassword); } I have also a iOS application written in Objective C that communicates with this server and in some part of my code I need to check if the password entered matches the password stored. Given that this is not a login functionality, I'm not willing to send the password to the server and let it make this verification, so I need an equivalent method to digest the password in Objective C. I did some research and came up with this code, that is not generating an equivalent string for me to compare with the one provided by the server: static const int m_Iterations = 50000; +(NSString *) digest:(NSString *)p_InputPassword { unsigned char v_Digest[CC_SHA1_DIGEST_LENGTH]; NSData *v_Data = [p_InputPassword dataUsingEncoding:NSUnicodeStringEncoding]; v_Data = [NSData dataWithBytes:[v_Data bytes] + 2 length:[v_Data length] - 2]; for (int v_Iteration = 0; v_Iteration &lt; m_Iterations; v_Iteration++) { if (CC_SHA1([v_Data bytes], [v_Data length], v_Digest)) { v_Data = [NSData dataWithBytes:v_Digest length:CC_SHA1_DIGEST_LENGTH]; } else NSLog(@"treta %i", v_Iteration); } NSMutableString *v_Result = [[NSMutableString alloc] init]; for (int v_Index = 0 ; v_Index &lt; CC_SHA1_DIGEST_LENGTH ; v_Index++) { [v_Result appendFormat: @"%02x", v_Digest[v_Index]]; } return v_Result; }
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20806629
accepted answer: http://stackoverflow.com/a/20806629
tagged with: sha1
score: 1
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0
has title: StandardStringDigester with SHA1 equivalent in Objective C
tagged with: objective-c
tagged with: jasypt
tagged with: digest
downvote count: 0

http://stackoverflow.com/comment/31067447
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20727724
has text: @Capoeira_us I understand your problem, but consider what would happen if you actually could intercept the password prompt and answer it programmatically?

http://stackoverflow.com/q/20687980
has comment: http://stackoverflow.com/comment/30981935
has comment: http://stackoverflow.com/comment/30982218
has comment: http://stackoverflow.com/comment/30982047
type: AnsweredQuestion
tagged with: list
score: -5
tagged with: linked-list
has comment: http://stackoverflow.com/comment/30982016
has comment: http://stackoverflow.com/comment/30982239
tagged with: java
has title: Linked List in Java: Displaying last node incorrectly
type: Question
has comment: http://stackoverflow.com/comment/30982019
has comment: http://stackoverflow.com/comment/30981876
has comment: http://stackoverflow.com/comment/30982144
downvote count: 5
has body: Following are the two classes: import java.io.*; class Node { int data; Node link; BufferedReader buf=new BufferedReader(new InputStreamReader(System.in)); void accept()throws IOException { System.out.println("Enter a number: "); data=Integer.parseInt(buf.readLine()); } } import java.io.*; class LinkedList { BufferedReader buf=new BufferedReader(new InputStreamReader(System.in)); Node start=new Node(); void create()throws IOException { Node n=new Node(); n.accept(); start.link=n; } void addbeg()throws IOException { Node n=new Node(); n.accept(); n.link=start.link; start.link=n; } void addend()throws IOException { Node n=new Node(); n.accept(); Node n1=new Node(); n1=start.link; while(n1.link!=null) { n1=n1.link; } n1.link=n; n.link=null; } void addafter()throws IOException { boolean flag=false; System.out.println("Enter data after which node is to be added: "); int d=Integer.parseInt(buf.readLine()); Node n=new Node(); n.accept(); Node n1=start.link; while(n1.link!=null) { if(n1.data==d) { flag=true; break; } n1=n1.link; } if(flag==true) { n.link=n1.link; n1.link=n; } else System.out.println("Data is not present in the list"); } void addbefore()throws IOException { boolean flag=false; Node n=new Node(); n.accept(); System.out.println("Enter the data before which node is to be added: "); int d=Integer.parseInt(buf.readLine()); Node n1=start.link; Node prev=start; while(n1.link!=null) { if(n1.data==d) { n.link=n1; prev.link=n; flag=true; break; } else { prev=n1; n1=n1.link; } } if(flag==false) { System.out.println("Data not found"); } } void delbeg() { Node n=start.link; start.link=n.link; n.link=null; } void delend() { Node n=start.link; Node prev=start; while(n.link!=null) { prev=n; n=n.link; } prev.link=null; } void delspecific()throws IOException { boolean flag=false; System.out.println("Enter data to be deleted: "); int d=Integer.parseInt(buf.readLine()); Node n=start.link; Node prev=start; while(n.link!=null) { if(n.data==d) { prev.link=n.link; n.link=null; flag…
has comment: http://stackoverflow.com/comment/30982147
has answer: http://stackoverflow.com/a/20688435
has comment: http://stackoverflow.com/comment/30982522
has comment: http://stackoverflow.com/comment/30982717
has comment: http://stackoverflow.com/comment/30982119
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/30981966
accepted answer: http://stackoverflow.com/a/20688435
has comment: http://stackoverflow.com/comment/30982360
has comment: http://stackoverflow.com/comment/30981800
has comment: http://stackoverflow.com/comment/30981823
has comment: http://stackoverflow.com/comment/30982085
favorite count: 0

http://stackoverflow.com/comment/30998954
score: 0
type: Comment
type: QuestionComment
has text: My program involves JNI integration which has to be tested for memory leaks. But the issue seems to be JVM startup with Valgrind with a simple java program. I am not sure is this a bug already?
comment on: http://stackoverflow.com/q/20697087

http://stackoverflow.com/a/20690382
upvote count: 3
has comment: http://stackoverflow.com/comment/30988015
accepted answer of: http://stackoverflow.com/q/20689865
has body: You need to populate your Model like this: public class Category{ private Integer id; private String name; private Category parentCategory; private List&lt;Category&gt; subCategories; ... //getters and setters } In Servlet, You need to have LIST of Category LEVEL 1 ( Parent is NULL ). List&lt;Category&gt; rootCategories = getAllCategoriesLevel1(); request.setAttribute("rootCategories", rootCategories ); In JSP ( Need 3 loops OR 4,5 loops ) &lt;c:forEach items="${rootCategories}" var="categoryLevel1"&gt; // ... &lt;c:forEach items="${categoryLevel1.subCategories}" var="categoryLevel2"&gt; // ... &lt;c:forEach items="${categoryLevel2.subCategories}" var="categoryLevel3"&gt; // ... &lt;/c:forEach&gt; // ... &lt;/c:forEach&gt; // ... &lt;/c:forEach&gt;
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/30988044
answers question: http://stackoverflow.com/q/20689865
type: Answer
score: 3

http://stackoverflow.com/comment/30982089
comment on: http://stackoverflow.com/q/20687960
type: QuestionComment
score: 0
has text: Are you asking for a compile-time or runtime check?
type: Comment

http://stackoverflow.com/a/20730132
type: Answer
has comment: http://stackoverflow.com/comment/31058487
upvote count: 0
has comment: http://stackoverflow.com/comment/119561024
accepted answer of: http://stackoverflow.com/q/20730070
answers question: http://stackoverflow.com/q/20730070
downvote count: 2
score: -2
type: AcceptedAnswer
has body: Try block will be as follows try{ Integer intValue = Integer.parseInt("String"); } catch (Exception e){ e.printStackTrace(); }

http://stackoverflow.com/comment/31196369
type: Comment
has text: @Katianie Wrong. Hint: You can code `Integer i = new Integer(0);`. Bigger hint: Read comment by @his
comment on: http://stackoverflow.com/a/20807177
score: 0
type: AnswerComment

android-authenticator
tag name: android-authenticator
tags question: http://stackoverflow.com/q/20696000
type: Tag
tags question: http://stackoverflow.com/q/20707154

http://stackoverflow.com/comment/31088903
type: QuestionComment
score: 0
has text: @CommonsWare no; they are float as mentioned
type: Comment
comment on: http://stackoverflow.com/q/20746940

http://stackoverflow.com/comment/31040370
score: 0
type: Comment
type: QuestionComment
has text: @LutzL, once again thanks for your reply. You are correct and that is actually what my search is about. The derivatives are all available so its 'simply' solving the system with 11 nonlinear equations. thanks again!
comment on: http://stackoverflow.com/q/20702257

http://stackoverflow.com/a/20697776
answers question: http://stackoverflow.com/q/20695554
has body: Why not save these in cookies? using something like jquery cookie plugin? OR add these parameters as attributes to a model object and pass the model to the view OR look into something like @ ControllerAdvice if you are using Spring 3.2. Plenty of options.
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/20698951
favorite count: 0
has comment: http://stackoverflow.com/comment/31001511
has answer: http://stackoverflow.com/a/20699043
accepted answer: http://stackoverflow.com/a/20699043
tagged with: android
score: -3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20698997
type: Question
tagged with: android-contentprovider
tagged with: imageview
tagged with: java
has comment: http://stackoverflow.com/comment/31001610
has title: How to load image from Contact into ImageView
downvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/20698997
upvote count: 1
has body: I have one ImageView component and wants to load image from contact I have this URI content://com.android.contacts/contacts/799/photo What should I do??

http://stackoverflow.com/comment/31104337
comment on: http://stackoverflow.com/a/20739024
type: Comment
has text: @Sandeep Yes it should show a status bar showing something like downloading/updating maven index. And it should take a couple of minutes.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/30995294
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20695159
has text: `Math.random()` is equivalent to `Random.nextDouble()` not `Random.nextInt()`
score: 0

http://stackoverflow.com/comment/31283134
type: AnswerComment
type: Comment
has text: and how do I get the connection factory from the Webshphere MQ?
comment on: http://stackoverflow.com/a/20841219
score: 0

http://stackoverflow.com/comment/31233179
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20826821
type: AnswerComment
has text: @T.J.Crowder +1 for the above, plus the note to Adam: *never* consider bytecode when thinking about JIT compiler's optimizations. Bytecode is much closer to Java source code than to the actual JIT-compiled code being executed. In fact, the trend in modern languages is not to have bytecode at all as a part of the language spcefication.

http://stackoverflow.com/comment/31891532
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20753282
has text: I have deleted m2 directory and reimported. Its ok.

http://stackoverflow.com/a/20739918
score: 2
answers question: http://stackoverflow.com/q/20739736
has body: When a client invokes a method that method should fail-fast, because detecting errors is easier than. They arise where they first occur. In your case you have a method named addNode(node). So when a client invokes it to add a node the behavior depends on that method's contract. I guess you do not expect that a client calls it and wants to add a null node. Thus you should fail-fast and throw a NullPointerException or maybe an IllegalArgumentException. In the second case node.getEdges(node) it is also depends on the contract and the contract depends on what makes sense in your problem domain. I think that node.getEdges(null) should throw an IllegalArgumentException, because a node that has no edges is different to a null node and I would like to distinguish between this. Something more to consider about the return value If a client gets a result from a method the result should make the client code easier to write and fault-tolerant. In the second case getEdges(node) you should return an empty collection if there are no edges for a node, because this makes the client code easier. The client can avoid unnecessary null checks. When returning a value you should think of the client code and how it would handle the return value. Then you should choose a return value that makes the client code easier. For example: I expect that the client code for getEdges(node) will look something like this Collection&lt;Node&gt; nodes = grap.getEdges(node); for(Node node: nodes){ ... } So if you return null instead of an empty collection the client code must look like this Collection&lt;Node&gt; nodes = grap.getEdges(node); if(nodes != null){ for(Node node: nodes){ ... } } The worst case for the client would be if the getEdges(node) method throws a NullPointerException when there are no edges for the code. I think that it is a normal condition in a graph that no edges exist for some node. Thus I would not throw an exception. Thats why I would return an empty collection in that case.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31076171
type: Answer
accepted answer of: http://stackoverflow.com/q/20739736
upvote count: 2

http://stackoverflow.com/comment/31071602
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20726440
has text: Ok. So what stops from using normal internal id as a primary key and another unique field with UUID?

http://stackoverflow.com/a/20811074
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31203969
has body: g is (almost for sure) object of class java.awt.Graphics See descriptions for setcolor() and fillRect() methods
accepted answer of: http://stackoverflow.com/q/20810989
has comment: http://stackoverflow.com/comment/31203919
answers question: http://stackoverflow.com/q/20810989
has comment: http://stackoverflow.com/comment/31203852
has comment: http://stackoverflow.com/comment/31204037
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31204057

http://stackoverflow.com/a/20796579
has body: On Ubuntu/Debian/Mint you need the liblockfile-dev package.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20786375
has comment: http://stackoverflow.com/comment/31208310
upvote count: 1
has comment: http://stackoverflow.com/comment/31224362
type: Answer

http://stackoverflow.com/q/20711367
downvote count: 1
has comment: http://stackoverflow.com/comment/31265687
has answer: http://stackoverflow.com/a/20711408
favorite count: 0
has comment: http://stackoverflow.com/comment/31024055
tagged with: android
possible better answer: http://stackoverflow.com/a/20711408
has comment: http://stackoverflow.com/comment/31062829
upvote count: 0
has body: thanks for help me, I'm learning programming with java and android, my problem is that I develop an app that convert from miles to km and viceversa and show the result in the middle of the screen in big number, but when hit convert the result is just 0.0, I want to know how to display the result. here are my code //Method called when click the button public void onClick(View view) { switch (view.getId()){ case R.id.radioButton: RadioButton milesButton = (RadioButton) findViewById(R.id.radioButton); RadioButton kmButton = (RadioButton) findViewById(R.id.radioButton2); if(text.getText().length() == 0) { Toast.makeText(this, "Please enter a valid number", Toast.LENGTH_LONG).show(); return; } } Double inputValue = Double.parseDouble(text.getText().toString()); RadioButton rb = (RadioButton) findViewById(R.id.radioButton); RadioButton rb2 = (RadioButton) findViewById(R.id.radioButton2); if (rb.isChecked()) { text.setText(String.valueOf(Conversor.convertMilesToKm(inputValue))); rb.setChecked(false); rb2.setChecked(true); } else { text.setText(String.valueOf(Conversor.convertKmToMiles(inputValue))); rb2.setChecked(false); rb.setChecked(true); } } This is my main.xml file &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" tools:context=".MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;EditText android:gravity="center" android:id="@+id/conversion_number" android:hint="@string/in_message" android:layout_height="wrap_content" android:layout_width="wrap_content" android:inputType="numberSigned|numberDecimal" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:ems="10" android:layout_marginTop="31dp" android:layout_toLeftOf="@+id/button" /&gt; &lt;Button android:text="@string/convert" android:layout_height="wrap_content" android:layout_wid…
accepted answer: http://stackoverflow.com/a/20711598
type: AnsweredQuestion
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/20711598
type: Question
has title: Android App display 0.0 instead of the result
answer count: 2

http://stackoverflow.com/comment/31078840
has text: yup works for me but it's actually just scan.nextLine()
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20741189

http://stackoverflow.com/comment/39651164
comment on: http://stackoverflow.com/a/20740726
type: AnswerComment
type: Comment
has text: what is the difference between onclick listener and onclick handler ?
score: 1

http://stackoverflow.com/a/20827465
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20827379
has body: There is no direct equal to friend classes in Java. However have a look at http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html.

http://stackoverflow.com/a/20785477
has body: private Runnable fiveSecondRunnable = new Runnable() { @Override public void run() { if (count5 &lt; 0) { switchT030Sec(); } else { tvSec5.setText(""+count5); Log.v("5sec set", "yes"); count5--; man.postDelayed(this, 1000); } } }; and start it by calling man.post(fiveSecondRunnable);
answers question: http://stackoverflow.com/q/20785332
score: 0
type: Answer

http://stackoverflow.com/q/20813052
has title: Getting 'No mapping found' error with basic Spring 3.0 MVC program
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31207424
has comment: http://stackoverflow.com/comment/31207745
tagged with: spring-mvc
has body: I learning Spring MVC from Spring In Action 3rd Edition and trying to implement using my eclipse IDE and deploying the application on Tomcat V6.0 When I am deploying the application and trying to load the home page (http://localhost:8080/SpringInAction3/), I am getting an error message in server logs as: INFO: Server startup in 1314 ms Dec 28, 2013 2:58:47 PM org.springframework.web.servlet.PageNotFound noHandlerFound WARNING: No mapping found for HTTP request with URI [/SpringInAction3/] in DispatcherServlet with name 'spitter' But my controller handles the requests, here is my controller code: @Controller public class HomeController { public static final int DEFAULT_SPITTLES_PER_PAGE = 25; private SpitterService spitterService; @Inject public HomeController(SpitterService spitterService) { this.spitterService = spitterService; } @RequestMapping({ "/", "/home" }) public String showHomePage(Map<String, Object> model) { model.put("spittles", spitterService.getRecentSpittles(DEFAULT_SPITTLES_PER_PAGE)); return "home"; } } So in this controller I am handing requests that are made on "/" and also "/home" Here is my spitter-servlet.xml file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <mvc:resources mapping="resources/" location="/resources/" /> <mvc:annotation-driven /> <context:component-scan base-package="com.habuma.spitter"/> /WEB-INF/views/views.xml </beans> I have defined my service as like this: @Component…
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31207375
type: Question
has comment: http://stackoverflow.com/comment/31207752
linked to: http://stackoverflow.com/q/41577234
has comment: http://stackoverflow.com/comment/31207656
tagged with: tomcat
duplicate of: http://stackoverflow.com/q/41577234
score: 0
has comment: http://stackoverflow.com/comment/31209202
has comment: http://stackoverflow.com/comment/31207479
has comment: http://stackoverflow.com/comment/31208061
has comment: http://stackoverflow.com/comment/31207371
answer count: 0

http://stackoverflow.com/q/20837084
tagged with: java
tagged with: concurrency
has body: What are the differences between, or respective limitations of, java's Timer facility and ScheduledThreadPoolExecutor service? I know that Timer runs in single thread, but are there any other limitations apart from that?
has answer: http://stackoverflow.com/a/23728391
type: Question
has comment: http://stackoverflow.com/comment/31252859
has comment: http://stackoverflow.com/comment/126873361
has comment: http://stackoverflow.com/comment/31255894
answer count: 1
downvote count: 0
has title: Limitations of Timer over ScheduledThreadPoolExecutor
favorite count: 0
linked to: http://stackoverflow.com/q/48956511
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31251753
has comment: http://stackoverflow.com/comment/31251814
score: 2
upvote count: 2

http://stackoverflow.com/a/20725544
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: Classes and other methods do not get serialized. Serialization is the process of converting an object into a stream. If your question is "How do I serialize/deserialize a nested class," just make the nested class serializable and then use it as you would a top level class. If your question is "How do I access a nested class from a serialized class, you can do this: ((GreenhouseControls) ois.readObject()).new WindowMalfunction(&lt;constructor arguments&gt;);
answers question: http://stackoverflow.com/q/20725508

http://stackoverflow.com/comment/31015843
score: 0
comment on: http://stackoverflow.com/q/20706871
type: Comment
type: QuestionComment
has text: Could you post the whole stacktrace please?

http://stackoverflow.com/comment/74197294
type: Comment
comment on: http://stackoverflow.com/a/20769932
has text: This is really useful if you need it for just debugging. It takes like 20 seconds to put in your code, and works out of the box.
type: AnswerComment
score: 0

http://stackoverflow.com/q/20797196
type: Question
has answer: http://stackoverflow.com/a/20797276
possible better answer: http://stackoverflow.com/a/20797273
has comment: http://stackoverflow.com/comment/31178635
has body: I'm trying to write a Java application that uses a database to store a large amount of encyclopedic-type information, but I don't know how to store and deploy that information in the application itself. Databases are usually stored in one central location (the server), but for a standalone, distributable application this obviously won't work. I've read that JDBC supports "embedded" databases that work out of the application's current working directory, but this would still require a massive SQL script to populate the local database on each installation of the application (so I assume.) I am not very familiar with the overall deployment process of applications, so perhaps I'm missing a key step, but this seems like a common problem that would have a simple, standardized solution but thus far I have been unable to find it.
tagged with: database
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20799481
has title: Creating and Deploying a "Static" Database
accepted answer: http://stackoverflow.com/a/20797276
has comment: http://stackoverflow.com/comment/31178331
tagged with: deployment
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20797273
tagged with: java

http://stackoverflow.com/q/20804409
type: Question
has comment: http://stackoverflow.com/comment/31190983
has answer: http://stackoverflow.com/a/20804774
has comment: http://stackoverflow.com/comment/31191391
has answer: http://stackoverflow.com/a/20804493
score: 4
has comment: http://stackoverflow.com/comment/31191124
tagged with: java
has comment: http://stackoverflow.com/comment/31191018
accepted answer: http://stackoverflow.com/a/20804493
has answer: http://stackoverflow.com/a/20804528
has title: Why does Java print a negative sign in front of 0 when 0 with no sign is equal and more commonly accepted as correct?
possible better answer: http://stackoverflow.com/a/20804528
has comment: http://stackoverflow.com/comment/31191087
has comment: http://stackoverflow.com/comment/31191263
upvote count: 4
has comment: http://stackoverflow.com/comment/31191370
answer count: 4
has body: In java the output of the following code is 0.0,-0.0,-0.0. what is the reason for these different answers? System.out.print((0.0 % -1)+","+(-0.0 % 1)+","+ (-0.0 % -1));
has comment: http://stackoverflow.com/comment/31191403
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31190894
has comment: http://stackoverflow.com/comment/31190917
downvote count: 0
linked to: http://stackoverflow.com/q/13544342
has answer: http://stackoverflow.com/a/20804545
favorite count: 0
has comment: http://stackoverflow.com/comment/31191327

http://stackoverflow.com/a/20740236
has comment: http://stackoverflow.com/comment/31104382
answers question: http://stackoverflow.com/q/20739880
type: Answer
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/31076723
has comment: http://stackoverflow.com/comment/31076800
has comment: http://stackoverflow.com/comment/31280853
has body: Once you have have committed the transaction, the result set will automatically be closed. Commit method is like telling all the insertion/update has been successfully done. So it closes the result set. Few alternative ways i can suggest inorder to achieve the same is, 1. Dump the result set data into some collection classes so that you can retrieve or fetch the data from it at any point. Even when the transaction has been committed and resultSet has been closed. 2. You can first make autocommit property to be true. Then you can call a stored procedure inside the loop of iteration of resultset and make that procedure commit the result if there's no error in it. In this way your result set will be open and data has been committed via procedure. Any way you choose . You have to work around anyhow.
has comment: http://stackoverflow.com/comment/31245585
upvote count: 0

http://stackoverflow.com/a/20804271
upvote count: 4
answers question: http://stackoverflow.com/q/20790001
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20790001
type: AcceptedAnswer
type: Answer
score: 4
has body: For 32 bit DLLs being used by jni, the code has to be compiled without the usual __stdcall adornments - i.e. the code can't have the @N postfix on the symbol name; but it still needs to be compiled in __stdcall mode. When compiling the dll under mingw, you need to add the option --kill-at to the linker. This is generally passed using -Wl,--kill-at. This will cause the @N postfix to be removed, and so appear as a simple symbol which can be linked at run-time by the JVM. The option can be abbreviated to -Wl,-k as well. An alternative is to use a map file, which exports the symbols in their unmangled form, which is the mechanism that's used most often when compiling with microsoft's own visual studio compiler. This is pretty poorly documented, and the resulting error you get when it happens doesn't help too well. I'd recommend looking at JNA, which makes writing native code wrappers a lot simpler, and in this case would mean no C++ code needed. The JNA code to accomplish this looks like: import com.sun.jna.platform.win32.User32; import com.sun.jna.platform.win32.WinUser; import com.sun.jna.platform.win32.WinDef.LPARAM; import com.sun.jna.platform.win32.WinDef.WPARAM; public class JNAMonitorTrigger { public void monitor(LPARAM param) { User32.INSTANCE.PostMessage(WinUser.HWND_BROADCAST, WinUser.WM_SYSCOMMAND, new WPARAM(0xf170), param); } public void on() { monitor(new LPARAM(-1)); } public void off() { monitor(new LPARAM(2)); } public static void main(String args[]) throws Exception { JNAMonitorTrigger me = new JNAMonitorTrigger(); me.off(); Thread.sleep(1000); me.on(); } };

http://stackoverflow.com/comment/31024505
score: 0
type: AnswerComment
has text: It's a JavaBean-thing I guess, also working in JSP. `#{testBean.test}` and `#{testBean[test]}` are the same...
type: Comment
comment on: http://stackoverflow.com/a/20711491

http://stackoverflow.com/comment/31167392
comment on: http://stackoverflow.com/a/20791064
type: AnswerComment
has text: OMG THANK YOU SO MUCH!!!! I've been fumbling around with this error for 3 days when all I had to do was delete ONE step. THANK YOU SO MUCH HENRY!! Could you please explain to me how adding the type made it a local variable?
type: Comment
score: 0

http://stackoverflow.com/a/20723114
answers question: http://stackoverflow.com/q/20723072
has body: You are mistaken. If you look at advanced math infinity is typically treated as a number. For example, in complex analysis it is typically 1+0i (depending on the projection chosen it may be a different value). That is, it is perfectly sensible that IEEE 754 defined infinity no to be a NaN. NaN is used where mathematical expressions are undefined, e.g. for infinity times 0.
has comment: http://stackoverflow.com/comment/31068736
score: 0
type: Answer

http://stackoverflow.com/comment/31188115
has text: Aside from what @ElliottFrisch said, just run this in a debugger and set a breakpoint on your line marked `[2]`... see what `filename` is. If it works when you specify a literal filename then obviously `filename` isn't reading in what you think it is. Just take a look at the value and figure it out.
type: QuestionComment
comment on: http://stackoverflow.com/q/20802794
type: Comment
score: 1

http://stackoverflow.com/a/20765854
answers question: http://stackoverflow.com/q/20765809
downvote count: 0
type: Answer
has body: Could you please explain me what happens here and why it works without errors. Type erasure. Java generics exist only at compile time. If you try to shove an int into something that is only declared as List, (which is bound to Objects by default) at runtime, it will work just fine.
score: 1
upvote count: 1

http://stackoverflow.com/a/20711458
has body: I guess it is wrong in your sense. I suspect you're looking for this. String pattern = "(\\D*)(\\d+)(.*)"; Maybe you want to check reluctant quantifiers too. http://docs.oracle.com/javase/tutorial/essential/regex/quant.html
has comment: http://stackoverflow.com/comment/31024263
type: Answer
has comment: http://stackoverflow.com/comment/31024349
has comment: http://stackoverflow.com/comment/31024283
accepted answer of: http://stackoverflow.com/q/20711362
has comment: http://stackoverflow.com/comment/31024317
has comment: http://stackoverflow.com/comment/31024193
has comment: http://stackoverflow.com/comment/31024262
answers question: http://stackoverflow.com/q/20711362
has comment: http://stackoverflow.com/comment/31024250
has comment: http://stackoverflow.com/comment/31025608
has comment: http://stackoverflow.com/comment/31024517
has comment: http://stackoverflow.com/comment/31024248
score: 0
has comment: http://stackoverflow.com/comment/31024478
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31024590
has comment: http://stackoverflow.com/comment/31024409

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/20839099
tags question: http://stackoverflow.com/q/20800742
tags question: http://stackoverflow.com/q/20799983
tags question: http://stackoverflow.com/q/20786759
tags question: http://stackoverflow.com/q/20731119
tags question: http://stackoverflow.com/q/20745762
tags question: http://stackoverflow.com/q/20849263
tags question: http://stackoverflow.com/q/20808490
tags question: http://stackoverflow.com/q/20808541
tags question: http://stackoverflow.com/q/20782120
tags question: http://stackoverflow.com/q/20814314
tags question: http://stackoverflow.com/q/20748079
tags question: http://stackoverflow.com/q/20819060
tags question: http://stackoverflow.com/q/20788522
tags question: http://stackoverflow.com/q/20728185
tags question: http://stackoverflow.com/q/20699078
type: Tag
tags question: http://stackoverflow.com/q/20821866
tags question: http://stackoverflow.com/q/20799332
tags question: http://stackoverflow.com/q/20807582
tags question: http://stackoverflow.com/q/20844376
tags question: http://stackoverflow.com/q/20824555
tags question: http://stackoverflow.com/q/20728634
tags question: http://stackoverflow.com/q/20745440
tags question: http://stackoverflow.com/q/20832178
tags question: http://stackoverflow.com/q/20807066
tags question: http://stackoverflow.com/q/20821109
tags question: http://stackoverflow.com/q/20701094
tags question: http://stackoverflow.com/q/20818136
tags question: http://stackoverflow.com/q/20767191
tags question: http://stackoverflow.com/q/20790704
tags question: http://stackoverflow.com/q/20706534
tags question: http://stackoverflow.com/q/20845328
tags question: http://stackoverflow.com/q/20827210
tags question: http://stackoverflow.com/q/20778428
tags question: http://stackoverflow.com/q/20837532
tags question: http://stackoverflow.com/q/20783894
tags question: http://stackoverflow.com/q/20698013
tags question: http://stackoverflow.com/q/20708049
tags question: http://stackoverflow.com/q/20849507
tags question: http://stackoverflow.com/q/20794435
tags question: http://stackoverflow.com/q/20735489
tags question: http://stackoverflow.com/q/20725115
tags question: http://stackoverflow.com/q/20836597
tags question: http://stackoverflow.com/q/20782283
tags question: http://stackoverflow.com/q/20681038
tags question: http://stackoverflow.com/q/20808679
tags question: http://stackoverflow.com/q/20767480
tags question: http://stackoverflow.com/q/20817019
tags question: http://stackoverflow.com/q/20690047
tags question: http://stackoverflow.com/q/20756115
tags question: http://stackoverflow.com/q/20722415
tags question: http://stackoverflow.com/q/20754390
tags question: http://stackoverflow.com/q/20762720
tags question: http://stackoverflow.com/q/20829825
tags question: http://stackoverflow.com/q/20772164
tags question: http://stackoverflow.com/q/20836133
tags question: http://stackoverflow.com/q/20808284
tags question: http://stackoverflow.com/q/20707150
tags question: http://stackoverflow.com/q/20784499
tags question: http://stackoverflow.com/q/20794685
tags question: http://stackoverflow.com/q/20685355
tags question: http://stackoverflow.com/q/20838461
tag name: xml
tags question: http://stackoverflow.com/q/20843221
tags question: http://stackoverflow.com/q/20708566
tags question: http://stackoverflow.com/q/20747693
tags question: http://stackoverflow.com/q/20734631
tags question: http://stackoverflow.com/q/20746390
tags question: http://stackoverflow.com/q/20739011
tags question: http://stackoverflow.com/q/20705162
tags question: http://stackoverflow.com/q/20682263
tags question: http://stackoverflow.com/q/20825643
tags question: http://stackoverflow.com/q/20806819
tags question: http://stackoverflow.com/q/20711223
tags question: http://stackoverflow.com/q/20735331
tags question: http://stackoverflow.com/q/20838290
tags question: http://stackoverflow.com/q/20731867
tags question: http://stackoverflow.com/q/20709045
tags question: http://stackoverflow.com/q/20715860

http://stackoverflow.com/q/20796527
has answer: http://stackoverflow.com/a/20796610
answer count: 3
downvote count: 0
has body: This question is provoked by this post. When a simple program like the following is run public class Sample { public static void main(String[] args) { } } with options -versbose:class, it lists a bunch of classes before loading this class [Opened C:\jdk1.6.0_14\jre\lib\rt.jar] [Loaded java.lang.Object from C:\jdk1.6.0_14\jre\lib\rt.jar] [Loaded java.io.Serializable from C:\jdk1.6.0_14\jre\lib\rt.jar] [Loaded java.lang.Comparable from C:\jdk1.6.0_14\jre\lib\rt.jar] . . . . . . [Loaded java.security.cert.Certificate from C:\jdk1.6.0_14\jre\lib\rt.jar] [Loaded Sample from file:/D:/tmp/] [Loaded java.lang.Shutdown from C:\jdk1.6.0_14\jre\lib\rt.jar] [Loaded java.lang.Shutdown$Lock from C:\jdk1.6.0_14\jre\lib\rt.jar] My questions is, my program never needed classes like java.util.Collection, Set List and so on. Then why is Bootstrap classloader is loading them. Is this how JVM specs mandates or how Bootstrap classloader decides which classes to load ? EDIT: Another aspect: Even if you try to run a non existent class, the program ends with ClassNotFoundException but not without loading all the classes mentioned earlier. So the classes are loaded merely on invoking the JVM ! So JVM loads a set of classes by default but, what governs this behavior?
favorite count: 0
tagged with: classloader
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20796046
has title: The classes loaded by Bootstrap Classloader
has answer: http://stackoverflow.com/a/20796686
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/35238398
upvote count: 5

http://stackoverflow.com/a/20716791
downvote count: 0
type: AcceptedAnswer
score: 5
type: Answer
has body: Based on analysis in the question "Pressing menu button causes crash in Activity with no ActionBar", this is because the action bar is null. And that's because of this: requestWindowFeature(Window.FEATURE_NO_TITLE); // I add this line which removes the action bar among other things. Now, your requirements are conflicting: you want a menu but you don't want an action bar. A "menu popup from bottom" is not something you can have, at least not using the standard Android components. You'll have to choose between: Action bar and menu, removing the FEATURE_NO_TITLE. No action bar, no menu, keeping the FEATURE_NO_TITLE.
accepted answer of: http://stackoverflow.com/q/20716764
answers question: http://stackoverflow.com/q/20716764
upvote count: 5

http://stackoverflow.com/q/20793113
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/20793195
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has body: I am trying to override my Player class that extends Actor draw method but I am receiving an error saying The method draw(SpriteBatch, float) of type Player must override or implement a supertype method Why can I not override the default draw method from the class Actor? Here is my code from the Player class. public class Player extends Actor { @Override public void draw(SpriteBatch batch, float parentAlpha) { Gdx.app.log(getName(), "Drawing player"); } public Player() { setName("mainPlayer"); playerBounds = new Rectangle(100, 100, 32, 32); } } Here is my code from the class with the Stage that is being drawn. public class Mainscreen implements Screen { // Class TAG private static final String TAG = "Main Screen"; // Screen Variable(s) private Awakening g; private SpriteBatch sprBatch; private OrthographicCamera gameCamera; private Player mainPlayer; // Screen Stage(s) private sMain sMain; @Override public void dispose() { sprBatch.dispose(); sMain.dispose(); } @Override public void hide() { g.inputController.removeProcessor(sMain); dispose(); } public Mainscreen(Awakening game){ g = game; sMain = new sMain(g, g.configMgr.getWidth(), g.configMgr.getHeight(), true); gameCamera = new OrthographicCamera(); gameCamera.setToOrtho(false, sMain.getWidth(), sMain.getHeight()); mainPlayer = new Player(g, gameCamera); g.setPlayer(mainPlayer); sprBatch = new SpriteBatch(); g.mapMgr.setMap(g, gameCamera, "TestMap", mainPlayer); sMain.addActor(mainPlayer); } @Override public void pause() {g.togglePause(true);g.debugOut(TAG, "pause()");} @Override public void render(float delta) { if(!g.isPaused()){ sMain.act(delta); Gdx.gl.glClearColor(.125f, .125f, .125f, 0); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gameCamera.update(); g.mapMgr.updateNPCS(); sprBatch.setProjectionMatrix(gameCamera.combined); sprBatch.begin(); g.mapMgr.draw(gameCamera, new int[] {0,1}); sMain.draw(); // Draw player/NPCs //g.getPlayer().draw(sprBatch, 0f); g.mapMgr.drawCollisionRectan…
score: 3
tagged with: libgdx
has answer: http://stackoverflow.com/a/20793195
has title: LibGDX Actor draw override
downvote count: 0
answer count: 1

http://stackoverflow.com/q/20702878
has comment: http://stackoverflow.com/comment/31008421
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31008266
has body: Is there anything wrong in these two methods that copy &amp; returns an array? This is how i called it : o2[i].addArr(o1.getArr()); And at the end the result is that o2[i].getArr(); is empty. I don't know why but this is my code if you could help me NOTE: The class Array i wrote it here Array while it's another class name in my code. just to make it clear for you public Array[] getArr(){ //first method int count=0; for(int i=0;i&lt;10;i++){ if(Arrlist[i]!=null) count++;} Array[] arr=new Array[count]; for(int i=0;i&lt;count;i++) arr[i]=Arrlist[i]; return arr;} public void addArr(Array[]arr){ //second method for(int i=0;i&lt;arr.length;i++) Arrlist[i]=arr[i]; }
has comment: http://stackoverflow.com/comment/31012012
tagged with: java
downvote count: 3
type: Question
score: -2
tagged with: arrays
has title: Is there anything wrong in these two methods that copy & returns an array
has answer: http://stackoverflow.com/a/20702915

http://stackoverflow.com/q/20775097
favorite count: 0
has answer: http://stackoverflow.com/a/21847717
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21878546
has title: In intellij, How to see SVN log/history of a file renamed or moved before previous commit
tagged with: intellij-idea
has body: In intellij, my project is under SVN control, I have renamed and moved a file then I commited it. How can I show log/history of this file after this commit with intellij.
tagged with: svn
downvote count: 0

http://stackoverflow.com/a/20762171
type: Answer
upvote count: 1
score: 1
has body: The date format you should use is "EEE, MMM d yyyy HH:mm:ss z" instead of "EEE, MMM d yyyy hh:mm:ss z" The case of the hour position changes it between 12hr and 24hr format.
answers question: http://stackoverflow.com/q/20762089
downvote count: 0

http://stackoverflow.com/q/20709730
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20709809
type: AnsweredQuestion
tagged with: android
type: Question
tagged with: orientation
has title: Get device orientation without knowing Context
has comment: http://stackoverflow.com/comment/31045298
answer count: 1
has body: I'm using following method to determine current orientation public boolean isPortrait() { int orientation = mContext.getResources().getConfiguration().orientation; return orientation == Configuration.ORIENTATION_PORTRAIT; } And now I want to move this method to separate class and make them static to be able to access it with following syntax Orientation.isPortait. The problem is Context that I need to use to determine orientation. Is there any way to get device orientation without Context, Activity, etc? UPDATE: All I need is simplify my code and make it shorter. That's why I don't want to use or pass in Context at all.
accepted answer: http://stackoverflow.com/a/20709809

http://stackoverflow.com/comment/31238366
has text: @DDP Try deleting your Tomcat server instance and creating a new one.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20829390

http://stackoverflow.com/a/20800614
has body: Your database is login and you are referring to a table named login. String selectQuery = "SELECT * FROM " + TABLE_LOGIN; // table name is 'login' But you created a table in login database with name member. CREATE TABLE `login`.`member` Obviously it should not be working. And even if you have a typo error, based on your select statement, your cursor.getString sequences are wrong. When you are selecting all fields by specifying *, you must abide by the sequence order number of the columns to use in getString methods. If I am not wrong, they shall be: user.put("uid", cursor.getString(1)); // id - uid user.put("username", cursor.getString(2)); // uname - username user.put("email", cursor.getString(4)); user.put("fname", cursor.getString(5)); user.put("lname", cursor.getString(6)); user.put("dob", cursor.getString(7)); user.put("tel", cursor.getString(8)); user.put("address", cursor.getString(9)); user.put("ptc", cursor.getString(10)); user.put("created_at", cursor.getString(12));
answers question: http://stackoverflow.com/q/20800385
has comment: http://stackoverflow.com/comment/31187961
upvote count: 1
has comment: http://stackoverflow.com/comment/31189176
has comment: http://stackoverflow.com/comment/31184376
has comment: http://stackoverflow.com/comment/31184425
score: 1
has comment: http://stackoverflow.com/comment/31184342
has comment: http://stackoverflow.com/comment/31188648
has comment: http://stackoverflow.com/comment/31184630
has comment: http://stackoverflow.com/comment/31188977
has comment: http://stackoverflow.com/comment/31189867
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31188856
downvote count: 0
has comment: http://stackoverflow.com/comment/31189334
accepted answer of: http://stackoverflow.com/q/20800385
type: Answer

servlets
tags question: http://stackoverflow.com/q/20823070
tags question: http://stackoverflow.com/q/20762595
tags question: http://stackoverflow.com/q/20713229
tags question: http://stackoverflow.com/q/20815501
tags question: http://stackoverflow.com/q/20846299
tags question: http://stackoverflow.com/q/20785918
tags question: http://stackoverflow.com/q/20792313
tags question: http://stackoverflow.com/q/20826768
tags question: http://stackoverflow.com/q/20710200
tags question: http://stackoverflow.com/q/20761391
tags question: http://stackoverflow.com/q/20824814
tags question: http://stackoverflow.com/q/20731850
tags question: http://stackoverflow.com/q/20725961
tags question: http://stackoverflow.com/q/20804210
tags question: http://stackoverflow.com/q/20801529
tags question: http://stackoverflow.com/q/20788679
tags question: http://stackoverflow.com/q/20739346
tags question: http://stackoverflow.com/q/20769148
tags question: http://stackoverflow.com/q/20801546
tags question: http://stackoverflow.com/q/20823759
tags question: http://stackoverflow.com/q/20807249
tags question: http://stackoverflow.com/q/20781934
tags question: http://stackoverflow.com/q/20802147
tags question: http://stackoverflow.com/q/20732341
tags question: http://stackoverflow.com/q/20681062
tags question: http://stackoverflow.com/q/20689865
tags question: http://stackoverflow.com/q/20723446
tags question: http://stackoverflow.com/q/20819155
tags question: http://stackoverflow.com/q/20737470
tags question: http://stackoverflow.com/q/20808344
tags question: http://stackoverflow.com/q/20832250
tags question: http://stackoverflow.com/q/20804043
tags question: http://stackoverflow.com/q/20785977
tags question: http://stackoverflow.com/q/20726920
tags question: http://stackoverflow.com/q/20686465
tags question: http://stackoverflow.com/q/20822502
tags question: http://stackoverflow.com/q/20737044
tags question: http://stackoverflow.com/q/20768720
tags question: http://stackoverflow.com/q/20772837
tags question: http://stackoverflow.com/q/20785484
tags question: http://stackoverflow.com/q/20843911
tags question: http://stackoverflow.com/q/20827284
tags question: http://stackoverflow.com/q/20825271
tags question: http://stackoverflow.com/q/20728953
tags question: http://stackoverflow.com/q/20731491
tags question: http://stackoverflow.com/q/20701199
tags question: http://stackoverflow.com/q/20824118
tags question: http://stackoverflow.com/q/20780235
tags question: http://stackoverflow.com/q/20842858
tags question: http://stackoverflow.com/q/20799515
tags question: http://stackoverflow.com/q/20775889
tags question: http://stackoverflow.com/q/20771268
tags question: http://stackoverflow.com/q/20738403
tags question: http://stackoverflow.com/q/20747936
tags question: http://stackoverflow.com/q/20751374
tags question: http://stackoverflow.com/q/20756224
tags question: http://stackoverflow.com/q/20759556
tags question: http://stackoverflow.com/q/20697853
tags question: http://stackoverflow.com/q/20747647
tag name: servlets
tags question: http://stackoverflow.com/q/20834953
tags question: http://stackoverflow.com/q/20700038
tags question: http://stackoverflow.com/q/20761590
tags question: http://stackoverflow.com/q/20745782
tags question: http://stackoverflow.com/q/20721541
type: Tag
tags question: http://stackoverflow.com/q/20802349
tags question: http://stackoverflow.com/q/20829526
tags question: http://stackoverflow.com/q/20787132
tags question: http://stackoverflow.com/q/20742492
tags question: http://stackoverflow.com/q/20680730
tags question: http://stackoverflow.com/q/20698299
tags question: http://stackoverflow.com/q/20777095
tags question: http://stackoverflow.com/q/20680457
tags question: http://stackoverflow.com/q/20750612
tags question: http://stackoverflow.com/q/20776600
tags question: http://stackoverflow.com/q/20680955
tags question: http://stackoverflow.com/q/20841849
tags question: http://stackoverflow.com/q/20811732
tags question: http://stackoverflow.com/q/20831457

http://stackoverflow.com/q/20686055
has title: How to write the hashCode() function for a cyclic graph node?
score: 11
type: AnsweredQuestion
downvote count: 0
tagged with: hashcode
tagged with: java
has body: I have the following class that is used as part of a graph : public class MyNode { private String name; private Set&lt;MyNode&gt; parents; private Set&lt;MyNode&gt; children; // getters and setters } When I use Eclipse's Source / Generate hashCode() and equals(), it generates this method: @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((children == null) ? 0 : children.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((parents == null) ? 0 : parents.hashCode()); return result; } The problem is that this method goes from the current object to its children, then while computing the hashCode() of the first child, it gets back to the original node through the parents.hashCode() but don't know that the hashCode() has already been computed there. It then reenters the children of the original node, and it gives a beautiful infinite loop. Question : how can I check that two instances of MyNode are the same object while, at the same time, avoid the infinite loop? Is this acceptable to add a visited boolean in the MyNode class, for the purpose of stopping the exploration? Or is there a better solution? Thanks!
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/20686217
accepted answer: http://stackoverflow.com/a/20686217
has answer: http://stackoverflow.com/a/20687679
possible better answer: http://stackoverflow.com/a/20686288
has answer: http://stackoverflow.com/a/20686288
has comment: http://stackoverflow.com/comment/30978064
upvote count: 11
answer count: 3
favorite count: 0

http://stackoverflow.com/q/20800548
linked to: http://stackoverflow.com/q/8237193
type: Question
has comment: http://stackoverflow.com/comment/31184080
has answer: http://stackoverflow.com/a/20800768
score: 0
has body: I have this String which I want to convert in Date form like 2013-06-06 "/Date(1370257470183+0530)/" If anybody have Idea , How to do this programmatically please help me Regards.
has title: Convert Date String to Date form
linked to: http://stackoverflow.com/q/8573250
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/20800913
accepted answer: http://stackoverflow.com/a/20800913
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/20800737
answer count: 4
has answer: http://stackoverflow.com/a/20800697
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20800768
linked to: http://stackoverflow.com/q/13440506
duplicate of: http://stackoverflow.com/q/8237193
has comment: http://stackoverflow.com/comment/31184044
tagged with: java
has comment: http://stackoverflow.com/comment/31184195
tagged with: date

http://stackoverflow.com/comment/30993349
has text: What is `sean`, and where do you initialize it?
type: Comment
comment on: http://stackoverflow.com/q/20693859
type: QuestionComment
score: 0

http://stackoverflow.com/q/20840203
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/31258065
has comment: http://stackoverflow.com/comment/31257562
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/20842035
has body: I found TooTallNate's Java-Websocket library. I am attempting to implement a client and server as a proof of concept to see if web sockets will solve a problem for us. My client is my Ubuntu 12.04 Linux workstation. I wrote a websocket server application that listens for bindings on 4242. Then I run my client and attempt to connect. I captured the communication using wireshark: 214 9.064163 192.168.1.81 192.168.20.50 TCP 74 43413 &gt; 4242 [SYN] Seq=0 Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=185839 TSecr=0 WS=128 215 9.064191 192.168.20.50 192.168.1.81 TCP 54 4242 &gt; 43413 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 My question is, why would the packet be refused so quickly? I don't believe I'm running a firewall, but if it were a firewall, unregistered ports generally just get ignored instead of shutdown within a few picoseconds. Does anyone know what this means?
has comment: http://stackoverflow.com/comment/31257611
score: 0
has title: Implementing a websocket
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/20842035
has comment: http://stackoverflow.com/comment/31257690
tagged with: java-websocket
type: AnsweredQuestion

http://stackoverflow.com/comment/31089214
has text: are you requiring the net/http/server? `require 'net/http/server'`
comment on: http://stackoverflow.com/q/20747103
score: 1
type: Comment
type: QuestionComment

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/20775604
tags question: http://stackoverflow.com/q/20694466
tags question: http://stackoverflow.com/q/20738255
tags question: http://stackoverflow.com/q/20789616
tag name: android-actionbar
tags question: http://stackoverflow.com/q/20684690
tags question: http://stackoverflow.com/q/20783944
tags question: http://stackoverflow.com/q/20702715

http://stackoverflow.com/comment/36178238
type: AnswerComment
has text: It really might be system-dependent..? Guess i'd have to create a simple sample project setup to further investiage. I might do that once i got some spare time. Thanks for your efforts :)
score: 0
comment on: http://stackoverflow.com/a/23546851
type: Comment

http://stackoverflow.com/comment/31277534
type: AnswerComment
type: Comment
has text: Oh that is much nicer. I think Autowired finally clicked for me. I would like to save boilderplate code, but I'm wary to spend another several days learning when progress is needed. But I will look into it for sure, starting right now.
comment on: http://stackoverflow.com/a/20850535
score: 0

http://stackoverflow.com/comment/31072548
comment on: http://stackoverflow.com/q/20737541
score: 0
type: QuestionComment
type: Comment
has text: What exactly is this supposed to do? If any of your elements in `ourBags` meets or exceeds the length of the array, you'll get a runtime exception. Also, what does your method `comp` have to do with your question?

http://stackoverflow.com/q/20816476
linked to: http://stackoverflow.com/q/988403
answer count: 1
has title: How to run java program using a .bat file exactly?
score: 0
tagged with: batch-file
has comment: http://stackoverflow.com/comment/31213528
has answer: http://stackoverflow.com/a/20816558
has comment: http://stackoverflow.com/comment/31213495
type: UnansweredQuestion
has body: Using @echo off javac source.java java source I am able to create source.class file and also run but the out window is not persisting... When java source executes the cmd just blinks and goes off but I want that window visible until we close it. Please help me how to do it? Thanks in advance
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31213474

http://stackoverflow.com/comment/31188636
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20802808
score: 0
has text: @gtgaxiola is right. Why is "i" not showing?

http://stackoverflow.com/a/20693422
answers question: http://stackoverflow.com/q/20693270
downvote count: 0
has body: You're calling the wrong method. BufferedWriter.write(int) only writes a char. Check the Javadoc. If you want to write the integer as four bytes in binary, you need DataOutputStream.writeInt(). If you want to write it as a string, you need BufferedWriter.write(""+People.genRand()), possibly followed by BufferedWriter.newLine().
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/20799996
has comment: http://stackoverflow.com/comment/33664869
type: Answer
answers question: http://stackoverflow.com/q/20784531
accepted answer of: http://stackoverflow.com/q/20784531
upvote count: 10
score: 10
has body: My solution: Add into Tomcat/lib all libraries that you download from Jersey and are including into /ext folder of the Jersey .zip Add into Web-Inf/lib of my project only libraries that are under /lib folder of the Jersey zip file Add into Web-Inf/lib of my project javax.ws.rs-api-2.jar that you can find in /api folder of Jersey With this, I don't have problems to run Tomcat with Jersey. And this is my web.xml for Jersey 2.0 <?xml version="1.0" encoding="UTF-8"?> MyRESTServices index.html index.htm index.jsp default.html default.htm default.jsp Jersey Web Application org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.myservice.services 1 Jersey Web Application /rest/* Where com.myservice.services is the package where I have my services Thanks for your comments!!
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20744479
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20744536
score: 4
upvote count: 4
tagged with: bitbucket
answer count: 1
downvote count: 0
favorite count: 0
has title: Push more than one netbeans project in one repository
accepted answer: http://stackoverflow.com/a/20744536
has body: I have a client-server program splited in 3 net beans projects, 1. client 2. server 3. common classes I would like to push them in one bitbucket git repository but after pushing one of the projects i can't push others Remote Repository Updates Branch : master Old Id : dfe16274e865383a78be5ddc294d828650cd73b0 New Id : 855f9f0355e9151330e82948cfda8bfc7a412d65 Result : REJECTED_NONFASTFORWARD Local Repository Updates Branch : origin/master Old Id : null New Id : 855f9f0355e9151330e82948cfda8bfc7a412d65 Result : NOT_ATTEMPTED Note that there is no package and file name conflicts in these projects. As looks like there is nothing like/equivalent to Solution in Visual Studio to group related projects in net beans, is it a good idea and correct use of git to push all these 3 projects into one repo? How to push other two projects to my repo? git version: 1.8.3.1 Net beans version: 7.3
tagged with: git

http://stackoverflow.com/q/20773398
tagged with: java
has answer: http://stackoverflow.com/a/20773590
score: 0
answer count: 2
tagged with: jtextarea
possible better answer: http://stackoverflow.com/a/20773590
has title: Format JTextArea in Tabular format
has comment: http://stackoverflow.com/comment/31146765
accepted answer: http://stackoverflow.com/a/20773714
tagged with: japplet
has comment: http://stackoverflow.com/comment/31136125
has body: I am Doing Simple text Report on JTextArea in JApplet. I am Trying to display this String of Array in Table format, it's quite work well but i want Integer number hould be in RightAlign and Text should be in LeftAlign.as well as please suggest me JTextArea is good or JTextpane is ? To make simple Text report.my next target is to get input from XML file and display as in table structure, i know its too hard to make such thing, but what they say about "Nothing is impossible". so plz someone help me to do this i am completely stuck with this. import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.MissingFormatArgumentException; import javax.swing.BorderFactory; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JTextArea; import javax.swing.border.Border; public class MainReport extends JApplet implements ActionListener { String[] colName = new String[] { "Date", "Account.No", "Description", "Deposit", "Withdraw" }; // here is my input of String Array. String a[][] = new String[][] { { "13/12/2013", "101", "AlphaSoftInfotekNashik", "3000", "0" }, { "15/12/2013", "102", "Bank Ladger 2 xxxxxxxxxxxxx", "5000", "0" }, { "16/12/2013", "103", "Accout Closing with Details", "800", "0" } }; StringBuilder sb = new StringBuilder(); final String Header = "%s %85s%n%n%s %10s%n"; // final String HRule =""; final String format = "|%1$-30s|%2$-30s|%3$-30s|%4$-30s|%5$-35s"; final String NumColF = ""; String cformat = "%20s"; String format1 = "%20s"; String s1 = "%61s";// for spillover text String s2 = "%10s"; int i, j, k; int Position = 0; boolean flag = false; String a1, a2; Container c; JTextArea outputArea; public static final int LINES = 10; public static final int CHAR_PER_LINE = 40; JButton b; public void init() { c = getContentPane(); c.setLayout(new FlowLayout()); outputArea = new JTextArea(30, 60); outputArea.setLocatio…
type: AnsweredQuestion
tagged with: string-formatting
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20773714

http://stackoverflow.com/q/20817374
has answer: http://stackoverflow.com/a/20817445
accepted answer: http://stackoverflow.com/a/20817445
has body: everybody! I have an assignment that is to create a small program to generate different bets for the lottery. I've got hours wondering about the piece of code that should create the array with distinct numbers within each bet. The problem is that, although I've tried to cut repetitions off, my code keeps generating bets with repeating numbers within each line of the matrix. What do you think I should look more deeply? public static void main(String[] args) { //Ask the user how many lines of 15 numbers will be created System.out.print("How many lines should the matrix have? "); Scanner input = new Scanner(System.in); int numberOfLines = input.nextInt(); // Create the two-dimension array. int[][] numbers = new int[15][numberOfLines]; for (int i = 0; i &lt; numberOfLines; i++) { for (int j = 0; j &lt; 15; j++) { boolean exist = false; do { numbers[j][i] = 1 + (int)(Math.random()*25); for (int k = 0; k &lt; j; k++) { if (numbers[j][i] == numbers[k][i]) exist = true; else { exist = false; } } } while (exist); } } //Sort the array int temp = 0; for (int i = 0; i &lt; numberOfLines; i++){ for (int j = 0; j &lt; 15; j++) { for (int k = (j + 1); k &lt; 15; k++) if (numbers[k][i] &gt; numbers[j][i]) { temp = numbers[j][i]; numbers[j][i] = numbers[k][i]; numbers[k][i] = temp; } } } //Print the array System.out.println(); for(int i = 0; i &lt; numberOfLines; i++) { System.out.printf("Line %d: ", (i+1)); for (int j = 0; j &lt; 15; j++){ System.out.printf("%4d",numbers[j][i]); } System.out.println(); System.out.println(); } //System.out.println(numbers[0][1]); //System.out.println(numbers[1][0]); } }
answer count: 2
tagged with: random
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/20818415
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20818415
downvote count: 0
score: 1
tagged with: java
has title: Create an array with random values in a certain range
type: Question
tagged with: arrays

http://stackoverflow.com/a/20717318
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20716993
has body: You need to construct the a ObjectOutputStream before the ObjectInputStream. Otherwise you get a deadlock because of the stream header written and read by the constructors.

netbeans
tags question: http://stackoverflow.com/q/20842959
tags question: http://stackoverflow.com/q/20765744
tags question: http://stackoverflow.com/q/20695059
tags question: http://stackoverflow.com/q/20846641
tags question: http://stackoverflow.com/q/20711579
tags question: http://stackoverflow.com/q/20818422
tags question: http://stackoverflow.com/q/20811399
tags question: http://stackoverflow.com/q/20760389
tags question: http://stackoverflow.com/q/20745964
tags question: http://stackoverflow.com/q/20728953
tags question: http://stackoverflow.com/q/20761713
tags question: http://stackoverflow.com/q/20758049
tags question: http://stackoverflow.com/q/20685036
tags question: http://stackoverflow.com/q/20774288
type: Tag
tags question: http://stackoverflow.com/q/20682704
tags question: http://stackoverflow.com/q/20836776
tags question: http://stackoverflow.com/q/20754723
tags question: http://stackoverflow.com/q/20846385
tags question: http://stackoverflow.com/q/20722327
tags question: http://stackoverflow.com/q/20697446
tags question: http://stackoverflow.com/q/20848316
tags question: http://stackoverflow.com/q/20680159
tags question: http://stackoverflow.com/q/20838709
tags question: http://stackoverflow.com/q/20718913
tags question: http://stackoverflow.com/q/20705580
tags question: http://stackoverflow.com/q/20821775
tags question: http://stackoverflow.com/q/20771790
tags question: http://stackoverflow.com/q/20739450
tags question: http://stackoverflow.com/q/20705848
tags question: http://stackoverflow.com/q/20840871
tags question: http://stackoverflow.com/q/20841972
tags question: http://stackoverflow.com/q/20808490
tags question: http://stackoverflow.com/q/20744479
tags question: http://stackoverflow.com/q/20747647
tags question: http://stackoverflow.com/q/20715844
tags question: http://stackoverflow.com/q/20685670
tags question: http://stackoverflow.com/q/20840860
tags question: http://stackoverflow.com/q/20818489
tags question: http://stackoverflow.com/q/20744348
tags question: http://stackoverflow.com/q/20811370
tag name: netbeans
tags question: http://stackoverflow.com/q/20838980
tags question: http://stackoverflow.com/q/20831100
tags question: http://stackoverflow.com/q/20746687
tags question: http://stackoverflow.com/q/20722978
tags question: http://stackoverflow.com/q/20711837
tags question: http://stackoverflow.com/q/20694018
tags question: http://stackoverflow.com/q/20846099
tags question: http://stackoverflow.com/q/20730453
tags question: http://stackoverflow.com/q/20807047

http://stackoverflow.com/q/20746444
has answer: http://stackoverflow.com/a/20746473
type: AnsweredQuestion
upvote count: 3
possible better answer: http://stackoverflow.com/a/20746582
tagged with: java
has comment: http://stackoverflow.com/comment/31087571
linked to: http://stackoverflow.com/q/2036970
has answer: http://stackoverflow.com/a/20746684
type: Question
has body: I defined a Class Base class Base { private int i; Base(int i) { this.i = i; } } So object of Base class can access private variable. class BaseDemo { public static void main(String[] args) { Base objBase = new Base(10); System.out.println(objBase.i); } } But it's giving me a compiler error I has private access in Base. I'm confused while coding, what is wrong?
tagged with: object
score: 3
tagged with: access-modifiers
has answer: http://stackoverflow.com/a/20746498
has answer: http://stackoverflow.com/a/20746582
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/31087695
has answer: http://stackoverflow.com/a/20746465
favorite count: 0
has answer: http://stackoverflow.com/a/20746478
has title: Regarding access specifiers
has answer: http://stackoverflow.com/a/20746487
accepted answer: http://stackoverflow.com/a/20746487

http://stackoverflow.com/q/20758427
has answer: http://stackoverflow.com/a/20759187
has answer: http://stackoverflow.com/a/20758464
score: 0
has body: I'm developing a notepad application I want to use my custom font and I'm following this code. Typeface barType = Typeface.createFromAsset(getApplicationContext().getAssets(),"font/CaviarDreams.ttf"); subject.setTypeface(barType); But, I don't want to use this code because I must write this code for every textview or edittext. Is there any way to make this easily?
possible better answer: http://stackoverflow.com/a/20758464
has title: How can I change my app font
has answer: http://stackoverflow.com/a/20758736
tagged with: android
tagged with: android-typeface
accepted answer: http://stackoverflow.com/a/20759187
answer count: 4
linked to: http://stackoverflow.com/q/10766716
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/10766716
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/20758506

http://stackoverflow.com/q/20820771
accepted answer: http://stackoverflow.com/a/20821116
has title: How can I increase the throughput in this simple Java-based TCP server application?
has body: I am writing a very basic TCP server. The server keeps track of the state it receives from clients. I documented the message format and published the source. On a 2009 MacBookPro (2.26 GHz Core 2 Duo, 4 GB RAM), the throughput is very low - 1 MB/s if server and client run on the same machine. I am looking for ways to dramatically increase the throughput. Both, the main loop of the server and the client are fairly straightforward. After establishing the connection with the server, the client creates instances of UpdateOneMessage, and sends their byte[] representation to the server. From Client.run(): for (int i = 0; i &lt; maxMessageCount; i++) { send(new UpdateOneMessage(1 + i, id, "updatedState")); // .. read response } Client.send() serializes the message and writes to the DataOutputStream. private int send(final Message message) throws Exception { final byte[] bytes = message.serialize(); out.write(bytes); out.flush(); return bytes.length; } Profiling client and server with JVM Monitor, showed CPU time was dominated by reading from the InputStreamReader and writing to the DataOutputStream. But at 1 MB/s, this application is not even close to being IO-bound. Which throughput can I expect from my app considering that each message is fairly small (55 bytes on average)? What else can I do to find the bottlenecks in this simple application?
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20820817
has comment: http://stackoverflow.com/comment/31221701
has answer: http://stackoverflow.com/a/20820817
tagged with: tcp
tagged with: java
type: Question
answer count: 2
tagged with: java-server
downvote count: 0
has answer: http://stackoverflow.com/a/20821116
favorite count: 0
has comment: http://stackoverflow.com/comment/31221687
upvote count: 2
tagged with: sockets

http://stackoverflow.com/comment/31265002
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20710343
has text: So given that I am not using inheritance anymore for my entity classes, why would I still be facing the same issue? All my ID properties are populated with null values. Any clues?
score: 0

http://stackoverflow.com/a/32675808
downvote count: 0
answers question: http://stackoverflow.com/q/20707626
type: Answer
has body: You may simply add Response response = target.request().cookie(Your Cookie) while you make the call. Do not call the builder explicitly as it will not add the cookie in your final call. This should get the cookie added to your call. An example call for a post is added for more clarity Response response =webTarget.request().accept(MediaType.APPLICATION_JSON).cookie(cookie).buildPost(Entity.entity(jsonObject.toString(), MediaType.APPLICATION_JSON)).invoke(); Hope that helps
score: 1
upvote count: 1

http://stackoverflow.com/comment/31195213
type: Comment
type: QuestionComment
score: 0
has text: `File file = new File("mp3.mp3"); try { player.open(file); <--- Error Line }` Error Message: `javazoom.jlgui.basicplayer.BasicPlayerException: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file` //Same Error -I tried to open also a nonexist file; the error is different, it directly say it does not exist. _It still work for eclipse run_
comment on: http://stackoverflow.com/q/20806428

decimal
tags question: http://stackoverflow.com/q/20819228
tags question: http://stackoverflow.com/q/20722927
tag name: decimal
tags question: http://stackoverflow.com/q/20800484
type: Tag
tags question: http://stackoverflow.com/q/20830737

http://stackoverflow.com/a/20847601
answers question: http://stackoverflow.com/q/20847436
score: 0
has body: If you change the constructor parameter to Array like this: public Node(Node... nodes){ } you can pass something like this: Node A = new Node(b,c); inside the constructor you should write like this: Arrays.asList(nodes) and it returns List
type: Answer

http://stackoverflow.com/comment/31190683
has text: What do you mean when you say "set values of these parameters" ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20797260

http://stackoverflow.com/a/20779146
has body: You can do following : Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); edttext1.setText((cal.get(Calendar.DAY_OF_MONTH)+1)+"-"+cal.get(Calendar.MONTH)+"-"+cal.get(Calendar.YEAR)); //This will set the current date //Now extend your date 7 days ahead cal.add(Calendar.DAY_OF_MONTH, 7); edttext2.setText((cal.get(Calendar.DAY_OF_MONTH)+1)+"-"+cal.get(Calendar.MONTH)+"-"+cal.get(Calendar.YEAR));
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20779010
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/20774828
type: Question
linked to: http://stackoverflow.com/q/19174823
tagged with: libgdx
has answer: http://stackoverflow.com/a/20777418
upvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/19128241
has title: strange error with removeProcessor?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has body: I use a KeyUp event to remove the event of a stage object. What I did: @Override public boolean keyUp(int keycode) { if (keycode == consoleKeyToggle) { show = !show; if (show) framework.AddInputListener(stage); else framework.RemoveInputListener(stage); } return false; } and in framework object I have 2 functions: @Override public void AddInputListener(InputProcessor input) { multiplexer.addProcessor(input); } @Override public void RemoveInputListener(InputProcessor input) { multiplexer.removeProcessor(input); } AddInputListener is fine, but when RemoveInputListener is called, I get this error: Exception in thread "LWJGL Application" java.lang.IndexOutOfBoundsException: index can't be &gt;= size: 2 &gt;= 2 at com.badlogic.gdx.utils.Array.get(Array.java:127) at com.badlogic.gdx.InputMultiplexer.keyUp(InputMultiplexer.java:76) at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:288) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:199) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113) Any suggestion? Thanks

http://stackoverflow.com/comment/31244045
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20832062
has text: Never change your interface??? You'd last about 15 minutes that way.

http://stackoverflow.com/a/20699830
type: Answer
score: 0
has body: Need to look at the exception . However, just a shot in the dark: If you see something like com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException You might want to wrap it with try/catch and in the catch block reconnect and rerun your query. Check MySQL docs for handling stalled connection. BTW: this is really easy with Spring - you can configure the dataSource to revive stalled connections.
answers question: http://stackoverflow.com/q/20698677

http://stackoverflow.com/a/20735579
accepted answer of: http://stackoverflow.com/q/20735174
downvote count: 0
answers question: http://stackoverflow.com/q/20735174
type: Answer
has body: For this problem, I suggest using a Map&lt;String,List&lt;Integer&gt; and the sample format you showed. Open a Scanner on your input file, read a String to be the key, and then read ints until you run out. Repeat until EOF.
upvote count: 1
has comment: http://stackoverflow.com/comment/31070020
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31111985
type: AnswerComment
has text: forget about `Vector`, use `List`: http://stackoverflow.com/questions/1386275/why-is-java-vector-class-considered-obsolete-or-deprecated
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20759701

http://stackoverflow.com/q/20831792
has comment: http://stackoverflow.com/comment/31242823
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/20832459
favorite count: 0
has title: Verifying my knowledge of how an empty Scanner reacts in Java
accepted answer: http://stackoverflow.com/a/20832459
upvote count: 1
has body: Is this true? If you have a scanner attached to System.in, and it's current Buffer is 100% empty, it will always pause whenever it encounters a call to the scanner object. scan.hasNext(); scan.nextInt(); scan.nextBoolean(); I just want to make sure I am understanding what is going on properly. I am seeing that it pauses when it encounters these in my little test programs but I am wonder if the program always pauses when it encounters these or if it only pauses at these calls when the buffer is empty. Thank you.
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/20751235
has body: 75% of my code works, this part works fine for my assignment... I have gotten parts a-e It is the following I cannot get to run with that part of the code... F. Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add four days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday. G. Add the appropriate constructors. Any advise on how I can structure what I wrote, to get it to compute with the first part? import java.util.*; /* Personal information */ public class MyDayIIII { static Scanner readinput = new Scanner(System.in); //Creates common input object class String d1; // Private member variable public MyDayIIII(String d1) //Constructor of value Sunday { d1 = "Sunday"; } public void setD1(String theD1) //Assigns value for user's input for "set day" { d1 = theD1; } public String claimD1() //Displays user's day { return d1; } // print the day, looks unnecessary public void printD1() { System.out.println("Printed Day: " + d1); } // return the next day public String tomD1() { // using direct comparison will fail as day == "Saturday"? // so use compareTo() method... if(d1.compareTo("Saturday") == 0) return ("Sunday"); else if(d1.compareTo("Sunday") == 0) return ("Monday"); else if(d1.compareTo("Monday") == 0) return ("Tuesday"); else if(d1.compareTo("Tuesday") == 0) return ("Wednesday"); else if(d1.compareTo("Wednesday") == 0) return ("Thursday"); else if(d1.compareTo("Thursday") == 0) return ("Friday"); else if(d1.compareTo("Friday") == 0) return ("Saturday"); else return ("\"Please Capitalize the First Letter of Your Day(e.g. Monday)\""); } // return the previous day public String SetprD1() { if(d1.compareTo("Friday") == 0) return ("Thursday"); else if(d1.compareTo("Thursday") == 0) return ("Wednesday"); else if(d1.compareTo("Wednesday") == 0) return ("Tuesday"); else if(d1.compareTo("Tuesday") == 0) return ("Monday"); else if(d1.comp…
accepted answer: http://stackoverflow.com/a/20751265
score: -1
tagged with: class
downvote count: 2
has answer: http://stackoverflow.com/a/20751265
upvote count: 1
answer count: 1
has title: Program "Day" 75% Working... Help JAVA
has comment: http://stackoverflow.com/comment/31097218
favorite count: 0
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/20811190
has answer: http://stackoverflow.com/a/20811517
answer count: 3
has answer: http://stackoverflow.com/a/20811583
has comment: http://stackoverflow.com/comment/31203787
has comment: http://stackoverflow.com/comment/31203853
type: UnansweredQuestion
tagged with: java
has body: I have three classes. Where currentsplit is declared as static and accesed in mid.java DecDriver.java public class DecDriver extends Configured implements Tool { public static Split currentsplit=new Split(); public static void main(String[] args) throws Exception { } } Split.java import java.util.ArrayList; import java.util.List; public class Split{ public List attr_index; public List attr_value; double entophy; String classLabel; Split() { this.attr_index= new ArrayList&lt;Integer&gt;(); this.attr_value = new ArrayList&lt;String&gt;(); } Split(List attr_index,List attr_value) { this.attr_index=attr_index; this.attr_value=attr_value; } void add(Split obj) { this.add(obj); } } Mid.java DecDriver id = new DecDriver(); for(int count=0;count&lt;size_split;count++) { index=(Integer) id.currentsplit.attr_index.get(count); System.out.println("index : "+index); attr_value=(String)id.currentsplit.attr_value.get(count); System.out.println("attr_value : "+attr_value); } But I have a scenario where I should write currentsplit object to a file from DecDriver and access that file in Mid.java and proceed further. How can I do that? What I did is converted the currentsplit object to string and wrote in file using bufferedwriter. DecDriver.java public class DecDriver extends Configured implements Tool { public static Split currentsplit=new Split(); public static void main(String[] args) throws Exception { String objtostring = currentsplit.toString(); //Buffered writer sptbw.write(objtostring); . . } Then I tried to read the file in Mid and casted to Split object. Object s = null ; String cursplitinfo; //BufferedReader while ((cursplitinfo = splitpathbw.readLine()) != null) { s = cursplitinfo; } Split currentsplitobj = (Split) s; DecDriver id = new DecDriver(); for(int count=0;count&lt;size_split;count++) { index=(Integer) currentsplitobj.attr_index.get(count); System.out.println("index : "+index); attr_value=(String)currentsplitobj.attr_value.get(count); System.out.println("attr_val…
type: Question
has answer: http://stackoverflow.com/a/20811239
tagged with: object
has comment: http://stackoverflow.com/comment/31204464
has title: Cast an object to another class
has comment: http://stackoverflow.com/comment/31203895
has comment: http://stackoverflow.com/comment/31203799
score: 0

http://stackoverflow.com/comment/31059734
type: QuestionComment
has text: Robin Green is correct: you should not be calling repaint (or revalidate) from within paintComponent. paintComponent may be called very frequently and needs to be lightweight and fast. It appears you aren't changing any state in your paintComponent method anyway. The revalidate call (which I'm pretty sure will call repaint for you) should immediately follow whatever code actually changes your component's state.
comment on: http://stackoverflow.com/q/20728833
score: 0
type: Comment

regex
tags question: http://stackoverflow.com/q/20757414
tags question: http://stackoverflow.com/q/20724418
tags question: http://stackoverflow.com/q/20755058
tags question: http://stackoverflow.com/q/20711967
tags question: http://stackoverflow.com/q/20803209
tags question: http://stackoverflow.com/q/20740767
tags question: http://stackoverflow.com/q/20811211
tags question: http://stackoverflow.com/q/20706793
tags question: http://stackoverflow.com/q/20824118
tags question: http://stackoverflow.com/q/20732809
tags question: http://stackoverflow.com/q/20724324
tag name: regex
tags question: http://stackoverflow.com/q/20711362
tags question: http://stackoverflow.com/q/20710502
tags question: http://stackoverflow.com/q/20763234
tags question: http://stackoverflow.com/q/20686344
tags question: http://stackoverflow.com/q/20687763
tags question: http://stackoverflow.com/q/20706127
tags question: http://stackoverflow.com/q/20812682
tags question: http://stackoverflow.com/q/20701024
tags question: http://stackoverflow.com/q/20701346
tags question: http://stackoverflow.com/q/20694366
tags question: http://stackoverflow.com/q/20691449
tags question: http://stackoverflow.com/q/20692028
tags question: http://stackoverflow.com/q/20713263
tags question: http://stackoverflow.com/q/20713411
tags question: http://stackoverflow.com/q/20686076
tags question: http://stackoverflow.com/q/20739355
tags question: http://stackoverflow.com/q/20832615
tags question: http://stackoverflow.com/q/20790413
tags question: http://stackoverflow.com/q/20741440
tags question: http://stackoverflow.com/q/20729025
tags question: http://stackoverflow.com/q/20832516
tags question: http://stackoverflow.com/q/20846895
tags question: http://stackoverflow.com/q/20837137
tags question: http://stackoverflow.com/q/20786288
tags question: http://stackoverflow.com/q/20826592
tags question: http://stackoverflow.com/q/20756883
tags question: http://stackoverflow.com/q/20686040
tags question: http://stackoverflow.com/q/20819988
tags question: http://stackoverflow.com/q/20697589
tags question: http://stackoverflow.com/q/20695234
tags question: http://stackoverflow.com/q/20691165
tags question: http://stackoverflow.com/q/20761089
tags question: http://stackoverflow.com/q/20849507
tags question: http://stackoverflow.com/q/20690196
tags question: http://stackoverflow.com/q/20796870
tags question: http://stackoverflow.com/q/20795053
tags question: http://stackoverflow.com/q/20806993
tags question: http://stackoverflow.com/q/20801269
tags question: http://stackoverflow.com/q/20836147
tags question: http://stackoverflow.com/q/20832178
tags question: http://stackoverflow.com/q/20845243
tags question: http://stackoverflow.com/q/20796518
tags question: http://stackoverflow.com/q/20685168
tags question: http://stackoverflow.com/q/20807667
tags question: http://stackoverflow.com/q/20768448
tags question: http://stackoverflow.com/q/20814288
tags question: http://stackoverflow.com/q/20736288
tags question: http://stackoverflow.com/q/20693042
tags question: http://stackoverflow.com/q/20764560
tags question: http://stackoverflow.com/q/20771679
tags question: http://stackoverflow.com/q/20724960
type: Tag
tags question: http://stackoverflow.com/q/20727396

http://stackoverflow.com/a/20803788
downvote count: 0
has comment: http://stackoverflow.com/comment/61858662
has comment: http://stackoverflow.com/comment/62612189
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/61876544
has comment: http://stackoverflow.com/comment/62654114
accepted answer of: http://stackoverflow.com/q/20803664
has comment: http://stackoverflow.com/comment/62649141
type: Answer
has body: You need to the OutputStream (InputStream) of your Process (and you should use a ProcessBuilder)... like so public static void main(String[] args) { String filename = args[1].substring(0, args[1].length() - 5); String cmd1 = "javac " + args[1]; String cmd2 = "java " + filename; try { // Use a ProcessBuilder ProcessBuilder pb = new ProcessBuilder(cmd1); Process p = pb.start(); InputStream is = p.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while ((line = br.readLine()) != null) { System.out.println(line); } int r = p.waitFor(); // Let the process finish. if (r == 0) { // No error // run cmd2. } } catch (Exception e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/31191722
score: 9
answers question: http://stackoverflow.com/q/20803664
upvote count: 9

http://stackoverflow.com/comment/31271866
comment on: http://stackoverflow.com/q/20847389
has text: URL's with less code works, but need to use this
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31099553
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20752638
type: Comment
has text: @ViktorK. `type: folder` for src folder

http://stackoverflow.com/comment/31183350
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20800079
has text: Is it built as a jar file?
score: 0

http://stackoverflow.com/a/20697191
has body: What is it that you are not getting? Its byte codes. If you understand byte codes then you would easily understand what the output is saying. javap 'de-assembles' the code and not decompiles it. So what this is saying is that you have a WaitNOtifyExample constructor, a main method and two public string references. Within those method and constructor definitions follows the byte codes of these and it describes what these two items are doing (in byte codes).
type: Answer
answers question: http://stackoverflow.com/q/20697091
score: 0

http://stackoverflow.com/q/20765175
has answer: http://stackoverflow.com/a/20765240
tagged with: substring
score: 0
has body: I have an alphanumaric string i want to get only the numbers from that alphanumaric string. Like i have a string S = Call forwarding [112234]&amp; Multiparty [434566] &amp; Caller line identification[12345]&amp;. I want to get the string as string S = 112234 &amp; 434566 &amp;12345 &amp; so that I can split this string with "&amp;" and pupulate a listview using arrayadapter. currently I am using this method and it shows aphanumaric string like S in first case I want to be it in secound case. Here is my code. String[] list={}; String ServerResponse = response.toString(); Log.d("Curretnts", "Server response"+ServerResponse); list =ServerResponse.split("&amp;"); final ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(),android.R.layout.simple_list_item_1, list); listView1.setAdapter(adapter);
answer count: 1
tagged with: string
tagged with: android
has title: Extract numbers from alphanumaric string in Android
accepted answer: http://stackoverflow.com/a/20765240
type: AnsweredQuestion
tagged with: alphanumeric
tagged with: java
type: Question

load
tags question: http://stackoverflow.com/q/20708418
type: Tag
tags question: http://stackoverflow.com/q/20792872
tags question: http://stackoverflow.com/q/20747103
tag name: load

http://stackoverflow.com/comment/30971954
comment on: http://stackoverflow.com/a/20682571
type: Comment
has text: i dont want to use a list for that purpose for reasons that i cant explain here But i think that would be a solution
score: 0
type: AnswerComment

http://stackoverflow.com/comment/62864022
has text: If you have local jar files in multiple directories, you need to add all of them to the flatDir. Ex :- flatDir { dirs 'libs1','libs2','libs3'}
comment on: http://stackoverflow.com/a/20700183
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/20708857
accepted answer: http://stackoverflow.com/a/20712045
type: Question
possible better answer: http://stackoverflow.com/a/20714791
tagged with: android
has answer: http://stackoverflow.com/a/20714791
upvote count: 6
tagged with: c++
has comment: http://stackoverflow.com/comment/31023314
has comment: http://stackoverflow.com/comment/31019446
answer count: 2
has body: I am trying to call the following java method in Android public static String getLevelFile(String levelName) { /*body*/} from c++ using the following jni code JniMethodInfoJavaApi methodInfo; if (! getStaticMethodInfo(methodInfo, "getLevelFile", "(Ljava/lang/String;)Ljava/lang/String;")) { return std::string(""); } LOGD("calling getLevelFile"); jstring returnString = (jstring) methodInfo.env-&gt;CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID, levelName.c_str()); LOGD("returned from getLevelFile"); methodInfo.env-&gt;DeleteLocalRef(methodInfo.classID); const char *js = methodInfo.env-&gt;GetStringUTFChars(returnString, NULL); std::string cs(js); methodInfo.env-&gt;ReleaseStringUTFChars(returnString, js); LOGD("returning Level data"); The app crashes when doing the CallStaticMethodObject() . I have verified that the method signature is correct by using javap. And the LOGD("calling getLevelFile"); prints fine and then it crashes. I am able to do other CallStaticVoidMethod()s from the same class but not this one. Any ideas what I am doing wrong?
tagged with: android-ndk
tagged with: java-native-interface
tagged with: java
has answer: http://stackoverflow.com/a/20712045
has comment: http://stackoverflow.com/comment/31025048
has title: call a static JNI method to return a String from C++
type: AnsweredQuestion
downvote count: 0
score: 6
favorite count: 0

windows-server-2008-r2
tag name: windows-server-2008-r2
tags question: http://stackoverflow.com/q/20737651
type: Tag

http://stackoverflow.com/comment/31157626
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20785911
score: 0
has text: See http://stackoverflow.com/questions/784404/how-can-i-specify-a-display

http://stackoverflow.com/comment/31024506
type: Comment
has text: Thanks for commenting. Mr.Jeus I did it after you said . BUt nothing happened.I meant nor error occured.did on CMD.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20710091

http://stackoverflow.com/a/20710983
has body: From your stack trace, it appears that the LinkedList behind the permut Queue is empty. That is, permut is empty. Looking at Noued.successeur, we see that permut is coming from taquin8.Test_permut(). And looking at Taquin8.Test_permut, we see that the default case returns an empty Queue. So, you need to figure out why taquin8.Test_permut is entering the default case. Hint: g is outside the range [0:8]. I recommend running your code through a debugger, or at least adding some println statements.
has comment: http://stackoverflow.com/comment/31023463
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20710824
downvote count: 0

http://stackoverflow.com/q/20816358
tagged with: recursion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20816814
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31213220
upvote count: 1
has title: My Recursive loop gives me a Stack Overflow error even I think I have an exit from the loop
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31213728
has body: I am just a Java beginner and I'm trying to do a Minesweeper program. It's nearly finished but I want to do a method that opens also the adjacent squares if the opened square is a "0" this is the code. For some reason it produces half the results I want and then pushes out an StackOverflowError. variables: finalA = buttons row finalB = buttons column buttons = button containing mine etc. value = value showing mines adjacent to the square rows = total rows columns = total columns And here is the code: public static JButton[][] zeros(int finalA, int finalB, JButton[][] buttons, int[][] value, int rows, int columns){ int a,b; //I found a reason for one Stack Overflow already. It was because when there was 2 zeros adjacent the code started to "jump inbetween them". I don't know why this didn't fix the whole problem. int[][] zeroOpened = new int[rows][columns]; for (a = 0 ; a &lt; rows ; a++){ for (b = 0 ; b &lt; columns ; b++){ zeroOpened[a][b] = 0; } } for(a=0 ; a&lt;3 ; a++){ for(b = 0 ; b&lt;3 ; b++){ if(value[finalA-1+a][finalB-1+b] == 0 ){ buttons[finalA][finalB].setText("0"); zeroOpened[finalA][finalB] = 1; //this produces the error. The first part blocks Out of bounds exception, at least I think so. Second part doesn't work. It works for a while and then produces StackOverflow. if(finalA-1+a &lt; rows &amp;&amp; finalA-1+a &gt; 0 &amp;&amp; finalB-1+b &lt; columns &amp;&amp; finalA-1+b &gt; 0 &amp;&amp; zeroOpened[finalA-1+a][finalB-1+b]!=1) { zeros(finalA-1+a,finalB-1+b,buttons,value,rows,columns); } }else{ if(finalA-1+a &lt; rows &amp;&amp; finalA-1+a &gt; 0 &amp;&amp; finalB-1+b &lt; columns &amp;&amp; finalA-1+b &gt; 0) { buttons[finalA-1+a][finalB-1+b].setText("" + value[finalA-1+a][finalB-1+b]); } } } } return buttons; }
has comment: http://stackoverflow.com/comment/31213404
has answer: http://stackoverflow.com/a/20816703

http://stackoverflow.com/comment/31178126
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20797201
has text: Post the stacktrace of the exception.
type: Comment

http://stackoverflow.com/q/20696408
type: AnsweredQuestion
tagged with: java
has body: I am using a java class CryptoSHA1BASE64.java to encrypt a plain text to sha1Base64 key String result = CryptoSHA1BASE64.hash(text); The code of the class - CryptoSHA1BASE64.java is import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.servlet.ServletException; public final class CryptoSHA1BASE64 { public static String hash(String plaintext) throws ServletException { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA"); // SHA-1 generator instance } catch (NoSuchAlgorithmException e) { throw new ServletException(e.getMessage()); } try { md.update(plaintext.getBytes("UTF-8")); // Message summary // generation } catch (UnsupportedEncodingException e) { throw new ServletException(e.getMessage()); } byte raw[] = md.digest(); // Message summary reception try { String hash = new String(org.apache.commons.codec.binary.Base64.encodeBase64(raw), "UTF-8"); return hash; } catch (UnsupportedEncodingException use) { throw new ServletException(use); } } } I want to decrypt the generated key back to plain text, i tried same approach i.e., the decrypt method of apache commons - Base64.decodeBase64(key) But, I gest some weird character instead of plain text. Any suggestions/comments would be of great help. Thanks!!!
linked to: http://stackoverflow.com/q/3479067
has answer: http://stackoverflow.com/a/20696544
type: Question
tagged with: decode
has title: DecodeBase64 using apache commons
answer count: 1
tagged with: base64
score: 0
has comment: http://stackoverflow.com/comment/30997656
has comment: http://stackoverflow.com/comment/31025016
accepted answer: http://stackoverflow.com/a/20696544
has comment: http://stackoverflow.com/comment/30997675
tagged with: encryption

http://stackoverflow.com/comment/31171584
type: AnswerComment
type: Comment
has text: Thanks, as you said, I fogot to add the `java.libray.path` property in eclipse :)
score: 1
comment on: http://stackoverflow.com/a/20787153

http://stackoverflow.com/q/20784755
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31155672
has comment: http://stackoverflow.com/comment/31155595
tagged with: log4j2
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31155621
score: 0
answer count: 1
has title: Disable messages from Log4J
accepted answer: http://stackoverflow.com/a/20784949
has comment: http://stackoverflow.com/comment/31155742
has answer: http://stackoverflow.com/a/20784949
has body: I have this example of Log4J configuration. Logger log = Logger.getRootLogger(); BasicConfigurator.configure(); // Basic configuration for Log4J 1.x ConsoleAppender console = new ConsoleAppender(); //create appender //configure the appender console.setLayout(new PatternLayout("%d{dd/MM/yyyy HH:mm:ss} %m%n")); console.setThreshold(Level.DEBUG); console.activateOptions(); //add appender to any Logger (here is root) Logger.getRootLogger().addAppender(console); Into the console I get this output: 0 [FelixStartLevel] INFO root - test____scs 26/12/2013 14:15:10 test____scs This message 0 [FelixStartLevel] INFO root - test____scs is printed by the code Logger log = Logger.getRootLogger(); How i can disable this code?
tagged with: log4j

http://stackoverflow.com/q/20800578
tagged with: java
tagged with: jboss
answer count: 1
tagged with: application-server
accepted answer: http://stackoverflow.com/a/20801161
has title: Custom log in JBOSS
type: AnsweredQuestion
has body: Hello, everyone! I have a problem with logger. i want to log to a custom files, but theese files are empty. Could somebody help? Base logger: import org.apache.log4j.FileAppender; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; import java.io.File; import java.io.IOException; public class BaseLogger { private Logger logger; private BaseLogger(){ } public BaseLogger(String loggerName) { this.logger = Logger.getLogger(loggerName); try { this.logger.addAppender(createAppender(loggerName + "_APP.LOG")); } catch (IOException e) { e.printStackTrace(); } logger.info("logger init."); } public void logInfo(String info){ logger.info(info); } public void logInfo(String info, Throwable t){ logger.info(info, t); } public void logError(String error) { logger.error(error); } public void logError(String error, Throwable t) { logger.error(error, t); } public void logFatal(String fatal) { logger.fatal(fatal); } public void logFatal(String fatal, Throwable t) { logger.fatal(fatal, t); } private FileAppender createAppender(String fileName) throws IOException { return new FileAppender(new PatternLayout(), System.getProperty("jboss.server.log.dir") + File.separator + fileName); } } Logger class: public class ServicesLogger { public static final BaseLogger GENERAL_LOGGER = new BaseLogger("GENERAL_LOGGER"); public static final BaseLogger SERVICE_EXECUTOR = new BaseLogger("SERVICE_EXECUTOR"); } when i invoke ServicesLogger.SERVICE_EXECUTOR.logInfo("info"); in jboss console is appear this text, but in file not. what is the problem?
score: 0
type: Question
has answer: http://stackoverflow.com/a/20801161

http://stackoverflow.com/comment/33836752
comment on: http://stackoverflow.com/q/20733516
has text: By the way, do you really need all the low-level functionality in your 2D game? [libgdx](http://libgdx.badlogicgames.com/) makes many common tasks easier. (for both 2D and 3D game development)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31159957
type: AnswerComment
has text: You want to write only when `equals` or `substring` match fails, right?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20787045

http://stackoverflow.com/q/20682355
has title: .txt file seems to be different when opened on my computer. It seems to be OK on any other mobile device
type: Question
tagged with: eclipse
has comment: http://stackoverflow.com/comment/30972157
has body: I've got a strange problem with my newly made .txt file. My Android Program is writing a string to a .txt file. Here's my method: public void generateNoteOnSD(String sFileName, String sBody){ try { File root = new File(Environment.getExternalStorageDirectory(), "Grafy"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName + ".txt"); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.append("**************\n"); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); } } Here's how i invoke my method: String s = "0 1 0 0 1 0\n1 0 1 0 1 0\n0 1 0 1 0 0\n0 0 1 0 1 1\n1 1 0 1 0 0\n0 0 0 1 0 0\n"; generateNoteOnSD("test", s); The problem is that my .txt file looks like this(when i open it on my mobile): 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 0 1 0 0 ********************** But when i open this file on my Computer the '\n' chars are gone... o.o and file looks like this: 0 1 0 0 1 01 0 1 0 1 00 1 0 1 0 00 0 1 0 1 11 1 0 1 0 00 0 0 1 0 0********************** Where's the problem? :(
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20682481
upvote count: 2
tagged with: file-conversion
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20682481
has comment: http://stackoverflow.com/comment/30971386

http://stackoverflow.com/a/20685238
has body: what's the difference between an Abstract class with a default constructor and a class with private constructor? If there's a default constructor, it will be callable from subclasses. If it's private, you'll only be able to create subclasses within the same class, as that's the only context in which the private constructor will be accessible. Note that the code you've provided is neither of these situations - it's explicitly providing a package-protected parameterless constructor. That's not private, and it's not a default constructor. Whether the class is abstract or not is orthogonal to the constructors it provides, although an abstract class with only a private constructor forces you to create subclasses within the declaring class in order to create instances, rather than just relying on you creating instances within the declaring class.
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20685195
answers question: http://stackoverflow.com/q/20685195
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/31113175
type: Comment
comment on: http://stackoverflow.com/a/20758337
score: 0
type: AnswerComment
has text: I put the whole pom.xml into edit section of my question

http://stackoverflow.com/comment/31039351
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20717560
has text: Since this code uses JDOM 2.x and the indicated duplicate uses JDOM1.x (which are very different in the way they handle XPaths), this is not a duplicate...

http://stackoverflow.com/q/20787800
type: Question
has comment: http://stackoverflow.com/comment/31162963
has comment: http://stackoverflow.com/comment/31167147
has comment: http://stackoverflow.com/comment/31163232
answer count: 2
has answer: http://stackoverflow.com/a/20788869
has comment: http://stackoverflow.com/comment/31166865
has comment: http://stackoverflow.com/comment/31161682
has comment: http://stackoverflow.com/comment/31162042
has comment: http://stackoverflow.com/comment/31167054
has comment: http://stackoverflow.com/comment/31165185
has comment: http://stackoverflow.com/comment/31161356
has comment: http://stackoverflow.com/comment/31161784
upvote count: 10
has comment: http://stackoverflow.com/comment/31161687
favorite count: 0
has comment: http://stackoverflow.com/comment/31161199
has comment: http://stackoverflow.com/comment/31162314
tagged with: paint
has comment: http://stackoverflow.com/comment/31161824
downvote count: 0
has comment: http://stackoverflow.com/comment/31161459
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31161606
linked to: http://stackoverflow.com/q/11337679
tagged with: jcomponent
has answer: http://stackoverflow.com/a/20798104
has title: What are the benefits to painting on a JPanel vs. JComponent?
tagged with: swing
has comment: http://stackoverflow.com/comment/31161354
has comment: http://stackoverflow.com/comment/31161822
has comment: http://stackoverflow.com/comment/31162338
has body: So in a recent answer, someone commented this (in regards to painting): "This is probably some kind of illness of 90% of Swing Programmers: When they make their own component, they always extend JPanel instead of JComponent. Why?" I'm still fairly new to programming, so I think it's too early to call myself a Swing programmer, as I have yet to find my niche. But overriding JPanel is just the way I was taught. So I set out to find the answer to the "Why?" question of the commenter. These are some of the answers I found. Background painting is main difference. The JComponent class doesn't paint its background, so you have to paint the background in the overridden paintComponent method. In contrast, JPanel has an opaque background which can be painted by calling its paintComponennt method. Instead of extending JComponent, some programmers prefer to extend the JPanel class. A JPanel is intended to be a container that can contain other components, but it is also possible to paint on it. There is just one difference. A panel is opaque, which means that it is responsible for painting all pixels within its bounds. The easiest way to achieve that is to paint the panel with the background color, by calling super.paintComponent in the paintComponent method of each panel subclass: If the opaque property is set to true ... then the Swing painting system does not have to waste time trying to paint behind the component, hence improves performance. I think the last quote really explains it best. But besides the opacity, are there other beneficial reasons "90% of Swing programmers have this illness" of extending JPanel rather than JComponent?
has comment: http://stackoverflow.com/comment/31161269
has comment: http://stackoverflow.com/comment/31172868
tagged with: java
score: 10
tagged with: jpanel

http://stackoverflow.com/comment/31202137
has text: WHen you tried instatiating the map first, you could have avoided the map=item.getProperties() line.. possibly map might have become null again due to this assignment.just debug and see the stuff
comment on: http://stackoverflow.com/q/20810270
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139195676
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20777951
has text: Similar: [*What Maven Artifact Contains javax.ws.rs.Path?*](https://stackoverflow.com/q/18139029/642706)

http://stackoverflow.com/comment/77432718
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/42402475
type: Comment
has text: I tried changing my -Dserver.port=0 and tested with two applications, launched at the same time. Now both open in different port

http://stackoverflow.com/comment/37424816
has text: Post updated. This is a standalone application.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20699182
score: 0

http://stackoverflow.com/q/20795104
has body: I am trying to create a rest service. But I got the following error after running. Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151) at com.sun.jersey.api.client.Client.handle(Client.java:648) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:507) at astral.restservice.client.Test.main(Test.java:20) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) 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 sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.<init>(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLCo…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31174606
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/9361623
has answer: http://stackoverflow.com/a/20795805
upvote count: 8
type: Question
has title: Error in Java Rest Service : Connection refused: connect
has comment: http://stackoverflow.com/comment/31174674
possible better answer: http://stackoverflow.com/a/24195609
answer count: 3
has answer: http://stackoverflow.com/a/24195609
has answer: http://stackoverflow.com/a/26898310
tagged with: environment-variables
downvote count: 1
favorite count: 0
tagged with: rest
accepted answer: http://stackoverflow.com/a/20795805

http://stackoverflow.com/comment/31267488
type: QuestionComment
comment on: http://stackoverflow.com/q/20845369
score: 0
type: Comment
has text: You've defined a 'clients' variable again in onPostExecute that isn't instantiated. I'm guessing you get a NPE when you iterate it. Try commenting it out. If that doesn't fix it post your logcat so we can see the error you are getting.

http://stackoverflow.com/comment/31260399
comment on: http://stackoverflow.com/q/20841567
score: 0
type: Comment
type: QuestionComment
has text: I have added the results in my first post. Please check.

http://stackoverflow.com/comment/137980525
type: Comment
has text: For me your code is not working. So, I added ```Row row1 = sh.createRow(row); Cell cell = row1.createCell(column);```
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78253918

http://stackoverflow.com/q/20808653
has answer: http://stackoverflow.com/a/33277119
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: outlook
has title: How to create custom flags on outlook with javax.mail?
has body: I have created custom flags for gmail using javax.mail api: Flags scannedFlag = new Flags("scanned"); So I can search on the folder those messages that doesn't have the scanned flag. FlagTerm fterm = new FlagTerm(scannedFlag, false); IMAPFolder folder.open(Folder.READ_WRITE); Message[] messages = folder.search(fterm ); And I can assign the custom flag to all messages: for (int i = 0; i &lt; messages.length; i++) { Message msg = messages[i]; msg.setFlags(scannedFlag, true); } This approach works great on gmail, but when I do this with outlook it doesn'work. It give me the following error when I try to asign the scannedFlag on msg : javax.mail.MessagingException: A7 BAD Invalid "flag-list": Contains unsupported flag or closing character missing.; nested exception is: com.sun.mail.iap.BadCommandException: A7 BAD Invalid "flag-list": Contains unsupported flag or closing character missing. at com.sun.mail.imap.IMAPMessage.setFlags(IMAPMessage.java:921) at com.tegik.App.main(App.java:54) Caused by: com.sun.mail.iap.BadCommandException: A7 BAD Invalid "flag-list": Contains unsupported flag or closing character missing. at com.sun.mail.iap.Protocol.handleResult(Protocol.java:353) at com.sun.mail.imap.protocol.IMAPProtocol.storeFlags(IMAPProtocol.java:1603) at com.sun.mail.imap.protocol.IMAPProtocol.storeFlags(IMAPProtocol.java:1588) at com.sun.mail.imap.IMAPMessage.setFlags(IMAPMessage.java:917) How could I create custom flags on outlook with a similar approach that I used on gmail?
tagged with: jakarta-mail
answer count: 1
favorite count: 0

http://stackoverflow.com/q/20819295
has body: Why am I getting this compile error message from the code below? (The program moves an arrow round in 4 directions depending on which arrow key is pressed on the keyboard:d) Direction.java:41: error: DirectionPanel.DirectionListener is not abstract and does not override abstract method keyReleased(KeyEvent) in KeyListener private class DirectionListener implements KeyListener { //Direction.java import javax.swing.*; import javax.swing.JFrame; import java.awt.*; import java.awt.event.*; class DirectionPanel extends JPanel { private final int WIDTH = 300, HEIGHT = 200; private final int JUMP = 10; //increment for image movement private final int IMAGE_SIZE = 31; private ImageIcon up, down, right, left, currentImage; private int x, y; //constructor: public DirectionPanel () { addKeyListener (new DirectionListener()); x =WIDTH / 2; y = HEIGHT / 2; up = new ImageIcon ("arrowUp.gif"); down = new ImageIcon ("arrowDown.gif"); left = new ImageIcon ("arrowLeft.gif"); right = new ImageIcon ("arrowRight.gif"); currentImage = right; setBackground (Color.black); setPreferredSize (new Dimension(WIDTH, HEIGHT)); setFocusable(true); } //draws public void paintComponent (Graphics page) { super.paintComponent (page); currentImage.paintIcon (this, page, x, y); } //represents the listener for keyboard activity private class DirectionListener implements KeyListener { public void keyPressed (KeyEvent event) { switch (event.getKeyCode()) { case KeyEvent.VK_UP: currentImage = up; y -= JUMP; break; case KeyEvent.VK_DOWN: currentImage = down; y += JUMP; break; case KeyEvent.VK_LEFT: currentImage = left; x -= JUMP; break; case KeyEvent.VK_RIGHT: currentImage = right; x += JUMP; break; } repaint(); } //empty definitions for unused methods private void KeyTyped (KeyEvent event) {} private void KeyReleased (KeyEvent event) {} } } public class Direction { public static void main (String[] args) { JFrame frame = new JFrame ("Direction"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.…
tagged with: java
tagged with: swing
type: Question
tagged with: keylistener
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31218893
has comment: http://stackoverflow.com/comment/31218827
has answer: http://stackoverflow.com/a/20819395
has answer: http://stackoverflow.com/a/20819316
has comment: http://stackoverflow.com/comment/31218936
type: UnansweredQuestion
has title: It's not abstract does not override abstract method
has comment: http://stackoverflow.com/comment/31218967

http://stackoverflow.com/q/20756121
type: Question
linked to: http://stackoverflow.com/q/1296235
has answer: http://stackoverflow.com/a/20757134
downvote count: 0
possible better answer: http://stackoverflow.com/a/20756781
tagged with: jsp
favorite count: 0
answer count: 3
has title: How to call a Spring MVC controller in jsp
tagged with: spring
linked to: http://stackoverflow.com/q/20676949
has answer: http://stackoverflow.com/a/20756559
upvote count: 3
accepted answer: http://stackoverflow.com/a/20756559
has answer: http://stackoverflow.com/a/20756781
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
has body: I'd like to include a jsp page for exemple <ui:include src="/WEB-INF/jsp/header.jsp" /> but my header.jsp have variables and I need a controller to initialise theses variables, is there a way to call a controller and include the controller method jsp in an other jsp ? For exemple; <%@tag description="Overall Page template" pageEncoding="UTF-8"%> <%@attribute name="header" fragment="true"%> <%@attribute name="footer" fragment="true"%> //include my header controller <ui:include src="/WEB-INF/jsp/header.jsp" /> <jsp:doBody /> //include my footer controller header.jsp Header ${test} my header method public String header(Map<String, Object> model){ model.put("test", "test"); return "header"; } But the controller is not used and ${test} is empty
tagged with: java

http://stackoverflow.com/comment/31030822
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20714804
has text: research `Xmx` and `Xms` options

http://stackoverflow.com/comment/31187902
has text: @silwa your suggested answer is giving whole value inside adapter like id, name, address.. but what i need is to fill array just with name
type: Comment
comment on: http://stackoverflow.com/a/20802471
score: 0
type: AnswerComment

http://stackoverflow.com/a/20812898
has comment: http://stackoverflow.com/comment/31207853
has comment: http://stackoverflow.com/comment/31207240
answers question: http://stackoverflow.com/q/20812857
has body: hidePasswordCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { httpProxyPassword.setEchoChar('*'); } else { httpProxyPassword.setEchoChar((char) 0); } } }); You have to use httpProxyPassword.setEchoChar((char) 0); for that. Here httpProxyPassword is a name of textbox you can use as per your's.
has comment: http://stackoverflow.com/comment/31207827
score: 15
upvote count: 15
accepted answer of: http://stackoverflow.com/q/20812857
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/20782657
has comment: http://stackoverflow.com/comment/31153175
tagged with: raspberry-pi
has comment: http://stackoverflow.com/comment/31172995
has body: I'm delevoping a TV Scoreboard Application by using window laptop and raspberry pi. Socket connection by Putty.I have put the script timer.sh inside the raspberry pi by using WinSCP. But when i run the command: ./run_timer.sh Error prompt: pi@raspberrypi ~ $ ./run_timer.sh -bash: ./run_timer.sh: No such file or directory timer.sh with command: #!/bin/sh java -jar /home/pi/ScoreBoard_app/Timer/Timer.jar Any step i missed?
has title: ./run_timer.sh: no such file or directory
has answer: http://stackoverflow.com/a/20783028
type: AnsweredQuestion
answer count: 1
tagged with: executable-jar
type: Question
accepted answer: http://stackoverflow.com/a/20783028
tagged with: sh
tagged with: putty
score: 0
tagged with: java

http://stackoverflow.com/comment/31236913
has text: @user3081519: show the code you're using to do this, obviously the code itself is wrong since my ideone sample demonstrates that it works as intended.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20828838
score: 0

http://stackoverflow.com/comment/31039054
type: Comment
type: QuestionComment
has text: Actually it could be memory leak so more and more time is spend by GC when memory consumption grow. Can you please post used JVM options. Thx
comment on: http://stackoverflow.com/q/20716169
score: 0

http://stackoverflow.com/q/20731243
has answer: http://stackoverflow.com/a/20733266
type: AnsweredQuestion
downvote count: 0
tagged with: swing
type: Question
has title: Action Listener not working on mouse clicks
score: 1
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/20733266
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/18745072
has body: I am planning to build a GUI for shortest path. I have created buttons in a for loop. Now I want to change the colors of the pressed buttons but I am getting an error regarding Action Listener. It says "Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method addActionListener(ActionListener) in the type AbstractButton is not applicable for the arguments (Final_GUI)".. Although i have tested this code using a JPanel and it was working fine there, But here It's not working now. I want to change the color of the button pressed. If a press that button again i want its previous color to be restored. Following is the picture of what i want to do : .. :( import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComboBox; import javax.swing.event.*; import javax.swing.JFrame; public class Final_GUI extends JFrame { JLabel label; ButtonGroup cbg; JRadioButton radio_1; JRadioButton radio_2; JRadioButton radio_3; JCheckBox checkbox_1; JCheckBox checkbox_2; JCheckBox checkbox_3; JScrollPane scrollpane_1; JComboBox combobox_1; JList list_1; JScrollPane sp_list_1; JComboBox combobox_2; JButton Orange; JButton Exit; JLabel for_text; int check [][]= new int [100][100]; int x=100; int y=200; JFrame frame = new JFrame(); JButton[][] buttons = new JButton[x][y]; JPanel mPanel = new JPanel(); JPanel bPanel = new JPanel(); JPanel cPanel = new JPanel(); JTextArea scoreKeeper = new JTextArea(); Container c = getContentPane(); int[][] intArray = new int[x][y]; public Final_GUI() { butGen(); score(); Final_GUILayout customLayout = new Final_GUILayout(); getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12)); getContentPane().setLayout(customLayout); label = new JLabel("Shortest Path Finding Algorithm"); getContentPane().add(label); cbg = new ButtonGroup(); radio_1 = new JRadioButton("radio_1", false); cbg.add(radio_1); getContentPane().add(radio_1); ra…
favorite count: 0

http://stackoverflow.com/a/20687462
has comment: http://stackoverflow.com/comment/30987389
has body: It's simply referring to however the language specifies separations between the arguments of a function. For example, in Java: public void foo(int a, int b) { ... } The function arguments a and b are separated using a comma.
answers question: http://stackoverflow.com/q/20687388
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/31041986
type: Comment
has text: I would prefer not to mix several dependency injection frameworks. Maybe I should just give up on HK2 and switch to Guice or Spring instead. It's just a bit annoying at this stage ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20714302

http://stackoverflow.com/q/20830304
type: AnsweredQuestion
has title: Java using the Vector class - Matrix
has comment: http://stackoverflow.com/comment/31239915
tagged with: java
possible better answer: http://stackoverflow.com/a/20830458
type: Question
has answer: http://stackoverflow.com/a/20830458
has answer: http://stackoverflow.com/a/20830508
tagged with: vector
tagged with: matrix
accepted answer: http://stackoverflow.com/a/20830379
downvote count: 0
favorite count: 0
answer count: 3
has body: So I have the following problem. I parsed out the text from a .txt file, and the text contained two sets of data that I needed to collect - certain ID and a set of double numbers linked to each ID. For example: ID1: [3.21 23.3 15 . .] ID2: [. . .]. The way I imagined collecting the data was through Vector - matrix, or Vector&lt;Vector&lt;String&gt;&gt; matrix = new Vector&lt;Vector&lt;String&gt;&gt;();. So basically I would read each ID as a first element (position 0) of each row in the matrix, and then I would read double numbers as Strings in the following rows respectively. I will do the conversion later. Now check my code: Vector&lt;Vector&lt;String&gt;&gt; matrix = new Vector&lt;Vector&lt;String&gt;&gt;(); Vector&lt;String&gt; array = new Vector&lt;&gt;(); while(s.hasNext()) { String data = s.next(); Matcher matcherDouble = patternDouble.matcher(data); Matcher matcherID = patternID.matcher(data); if(matcherID.find()) { System.out.println("found: " + matcherID.group(1)); /*********************************/ if(!(array.isEmpty())) { matrix.add(array); } /**********************************/ array.clear(); array.add(matcherID.group(1)); } if(matcherDouble.find()) { System.out.println("found: " + matcherDouble.group(3)); array.add(matcherDouble.group(3)); } } I parsed out everything correctly so this part of code is enough to explain my problem. So because I need a matrix, I decided to collect arrays individually and at the same tame to add them to the matrix. Depending on the number of different ID-s I'll have as many arrays to add. In the first cycle through if( matcherID.find()), I wont add an array to matrix because that is when I am getting my first ID and I still need the other elements before i add an array to matrix. Every time after this one, my condition if(!( array.isEmpty())) will be met and i will add another array to matrix. My problem is that once I have added the first array to the matrix - matrix starts to change dynamically as I change the array. Fo…
has comment: http://stackoverflow.com/comment/31239833
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/20830379
has comment: http://stackoverflow.com/comment/31239866

http://stackoverflow.com/a/20685164
has body: You won't be able to request JSON by using a path to a file on your system. Its hard to say if this is the only thing you'll need to change though.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20685087
has comment: http://stackoverflow.com/comment/30976620
downvote count: 0
has comment: http://stackoverflow.com/comment/30981213
score: 1

http://stackoverflow.com/q/20756822
has body: I want to remove the array Removelist in a list Removelist1. If the Removelist array having one value then it works fine otherwise it will not remove the array.The code is given below: for(int j=0;j&lt;Removelist.length;j++) { System.out.println(Removelist[j]); if(Removelist1.contains(Removelist[j])) { System.out.println("Exists: "+Removelist[j]); Removelist1.remove(Removelist1.indexOf(Removelist[j])); } }
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20756875
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31107050
has comment: http://stackoverflow.com/comment/31106948
has title: How to remove an Array in a List in Java?
has comment: http://stackoverflow.com/comment/31106945
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/31106947
tagged with: arraylist
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/20756882
favorite count: 0

http://stackoverflow.com/comment/31101674
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20753344
type: Comment
has text: could you elaborate on how I would modify my layout or what the subclass of ArrayAdapter should look like?

http://stackoverflow.com/a/20788330
score: 0
has body: i think, set a fps, frame per second, its may be because your thread is running too fast, i.e. counter++ in each frame. get some sleep. not you obviously :P, its just add sleep before any increment in counter Thread.sleep(10); counter++; this will set your animation to 100fps, i.e. 1000/10. Similarly for 25fps, set Thread.sleep(40); .. try atleast. Hope that works :)
answers question: http://stackoverflow.com/q/20788114
type: Answer

http://stackoverflow.com/a/20838944
downvote count: 0
answers question: http://stackoverflow.com/q/20832008
has body: One more way is to use Encrypt class for encrypting your password with randomly generated keyvalue. But you need to store the keyvalue in your DB for encrypted password. Like this, Integer randVal = random.nextInt(); Encrypt encrypt = new Encrypt(); // convert password to encrypted password String encyppassword = encrypt.encryptText( Integer.toString(randVal) + "", your_password); While decrypt you need to use keyvalue and encrypted password. Like this, Decrypt decrypt = new Decrypt(); Integer randVal = keyvalue_from_db; String decryptedPassword = decrypt.decryptText( String.valueOf(randVal.toString()), encrypted_password); Hope this helps.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/20744093
has comment: http://stackoverflow.com/comment/31108697
downvote count: 1
answers question: http://stackoverflow.com/q/20743901
has body: Use &lt;context:component-scan base-package="de.dijon.test.*" annotation-config="true" use-default-filters="true" /&gt; in application-context.xml file
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/31086870
score: -1

http://stackoverflow.com/q/20773338
tagged with: android
has title: Getting an UnknownHostException when trying to fetch data from flickr?
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I am trying to fetch the xml file from flickr. Here is my code: public static final String TAG = "FlickrFetchr"; public static final String ENDPOINT = "http://api.flickr.com/services/rest/"; public static final String API_KEY = "d4db9623ea909f4d2a01c8c9667fd378"; //secret=0c764276c114d52f public static final String METHOD_GET_RECENT = "flickr.photos.getRecent"; public static final String PARAM_EXTRAS = "extras"; public static final String EXTRA_SMALL_URL = "url_s"; private static final String XML_PHOTO = "photo"; String url = Uri.parse(ENDPOINT).buildUpon().appendQueryParameter("method", METHOD_GET_RECENT) .appendQueryParameter("api_key", API_KEY) .appendQueryParameter(PARAM_EXTRAS, EXTRA_SMALL_URL) .build().toString(); String xmlString = getUrl(url); When i debug, i see that the url is (Docs)and it works, the xml file is there. But i am getting an exception that says "Unable to resolve host "api.flickr.com": No address associated with hostname". Can anyone see the problem? Thanks.
has answer: http://stackoverflow.com/a/20773408
accepted answer: http://stackoverflow.com/a/20773408
type: Question
has comment: http://stackoverflow.com/comment/31135816
upvote count: 2
tagged with: xml-parsing
tagged with: flickr
answer count: 1
has comment: http://stackoverflow.com/comment/31135917
favorite count: 0
has comment: http://stackoverflow.com/comment/31135888

http://stackoverflow.com/a/20775007
has body: @NotBlank and @Email both share "" as invalid value. You might consider adding some kind of conversion service which converts "" into Null and replace the @NotBlank constraint with @NotNull. Null doesn't trigger @Email, but triggers @NotNull only. Groups are not necessary in this scenario. Regarding your second question, a constraint is per default in the group javax.validation.groups.Default. You set your @Email constraint explicitly in the group ValidInput.class.
has comment: http://stackoverflow.com/comment/31396510
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20709644
answers question: http://stackoverflow.com/q/20709644
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20683614
accepted answer of: http://stackoverflow.com/q/20683502
type: Answer
answers question: http://stackoverflow.com/q/20683502
has comment: http://stackoverflow.com/comment/30975639
downvote count: 1
has comment: http://stackoverflow.com/comment/30973959
has body: I believe this is the same problem as this question... your variable assignment is reversed. It should be (although this code is still incorrect - see below): a = clients.get(clients.size()++); EDIT: this was already answered by Prabhakaran, but apparently people felt the need to downvote my answer.. I think I did address the original question, but I appreciate that my code sample was still incorrect, so I will try to provide a more complete answer: First of all, as to the "required variable not found" error, if you google it you will see that other SO question as the first hit. clients.get(clients.size()++) is not a variable, so you can't assign things to it. I am not sure where a is declared in your code, but assume that it is a variable and thus my suggestion of reversing the assignment. Next, for the clients.get(clients.size()++) line, as others have mentioned or alluded to - VAR++ is equivalent to VAR = VAR + 1, so again is an assignment operation going on. In this case, clients.size() is not a variable, so you can not increment it. If you wanted the clients.size() + 1 index, you could have written: a = clients.get(clients.size() + 1)... but that will throw an ArrayIndexOutOfBoundsException, because you're trying to access an element of clients beyond its current size! That is why Prabhakaran rewrote your method as they did, changing that line to a clients.add(c) call - as it seemed to fit the original intent of the method.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30975336
score: 0

http://stackoverflow.com/q/20795352
has body: I'm making an Android app for my WordPress blog and I've set up a static class Server.java in my Android app to communicate with a PHP file that I created on my hosting servers. I use URLConnection, DataOutputStream and DataInputStream to do the communication. One of my functions gets the latest 10 posts from my WordPress, and is retrieved the following way... In any of my java files, call Server.getPosts(); Below is my Server.java file (the parts you need to see, at least) public class Server { public static final String SERVER_URL = "http://www.startingtofeelit.com/android-server.php"; public static String getPosts() { return executeHttpRequest("command=getPosts"); } @SuppressWarnings("deprecation") private static String executeHttpRequest(String data) { String result = new String(); try { URL url = new URL(SERVER_URL); URLConnection connection = url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); DataOutputStream dataOut = new DataOutputStream(connection.getOutputStream()); dataOut.writeBytes(data); dataOut.flush(); dataOut.close(); // get the response from the server and store it in result DataInputStream dataIn = new DataInputStream(connection.getInputStream()); String inputLine; while ((inputLine = dataIn.readLine()) != null) { result += inputLine; } dataIn.close(); } catch (IOException e) { result = null; } System.out.println("Returning from Server.java"); return result; } } I got most of this code from a guide online. It returns a string that has the xml representation of my posts. If you'd like, you can view the xml/return string here, but that is not really necessary for you to help me. My main problem is here: I'm getting a huge amount of memory dumps. Something in the way my code is set up, I get massive amounts of memory dumps with the tag "dalvikvm" and the message GC_CONCURRENT freed 312K, 5% free 9989K/10439…
has answer: http://stackoverflow.com/a/20796059
upvote count: 2
type: UnansweredQuestion
downvote count: 1
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31175316
answer count: 2
tagged with: client-server
has title: Memory dumps when reading from server causes Android app to load too slowly
has comment: http://stackoverflow.com/comment/31175826
has answer: http://stackoverflow.com/a/20796486
tagged with: android
favorite count: 0

http://stackoverflow.com/comment/31335312
has text: URI instance is from "org.eclipse.emf.common.util" it does not have 'toURL' API in it. Instead we can use EcorePlatformUtil.getFile(resourceInstance); From the file instance we can get the location.
type: Comment
comment on: http://stackoverflow.com/a/20836591
score: 0
type: AnswerComment

http://stackoverflow.com/a/20811193
has comment: http://stackoverflow.com/comment/31297868
answers question: http://stackoverflow.com/q/20807131
has comment: http://stackoverflow.com/comment/72031243
accepted answer of: http://stackoverflow.com/q/20807131
has comment: http://stackoverflow.com/comment/72031508
has comment: http://stackoverflow.com/comment/58094212
downvote count: 2
has body: Conditional logic in tests is undesirable. With that in mind, Espresso's API was designed to guide the test author away from it (by being explicit with test actions and assertions). Having said that, you can still achieve the above by implementing your own ViewAction and capturing the isDisplayed check (inside the perform method) into an AtomicBoolean. Another less elegant option - catch the exception that gets thrown by failed check: try { onView(withText("my button")).check(matches(isDisplayed())); //view is displayed logic } catch (NoMatchingViewException e) { //view not displayed logic } Kotlin version with an extension function: fun ViewInteraction.isDisplayed(): Boolean { try { check(matches(ViewMatchers.isDisplayed())) return true } catch (e: NoMatchingViewException) { return false } } if(onView(withText("my button")).isDisplayed()) { //view is displayed logic } else { //view not displayed logic }
has comment: http://stackoverflow.com/comment/71153809
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/70867404
score: 110
has comment: http://stackoverflow.com/comment/66402300
type: Answer
has comment: http://stackoverflow.com/comment/31322770
upvote count: 112

http://stackoverflow.com/comment/31151845
comment on: http://stackoverflow.com/q/20782403
score: 0
type: Comment
type: QuestionComment
has text: Is it class or inteface/abstract class ?

http://stackoverflow.com/a/20811769
has body: Change to Intent intent; // declare it as instance vairable Then in onCreate intent = new Intent(this, GameActivity.class); Activity context is available in onCreate of activity. You can't use this before that. Also you can do all your initializations of view's in onCreate.
upvote count: 2
has comment: http://stackoverflow.com/comment/31204920
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20811763
answers question: http://stackoverflow.com/q/20811763
has comment: http://stackoverflow.com/comment/31205040
has comment: http://stackoverflow.com/comment/31204896

http://stackoverflow.com/comment/31323769
comment on: http://stackoverflow.com/q/20753058
type: QuestionComment
has text: @EJP Why impossible? To the JVM, since it is a native process, there is really only one memory space. A direct ByteBuffer is a way for Java code to access any address in that memory space, instead of just what is on the heap. It compiles down to essentially the same machine instructions as other memory accesses. ByteBuffers are meant to be fast. The designers didn't even want to put a conditional in `get` and `put` that checks whether a MappedByteBuffer has been unmapped, which is why you can't unmap it. (Despite the crippling bugs this causes.)
type: Comment
score: 0

http://stackoverflow.com/q/20777032
has title: Background Image in JFrame
has answer: http://stackoverflow.com/a/20777117
tagged with: imageicon
type: UnansweredQuestion
tagged with: java
tagged with: embedded-resource
tagged with: swing
type: Question
tagged with: image
has body: So I developed a game in Java and I'm getting othing while adding image to My JFrame,Its a ball and racket game,I'm using eclipse.I personally think its the directory problem,so for reference I've put the png files in src folder.! Here is the Code for my Game2 Class: package Challenger; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @SuppressWarnings("serial") public class Game2 extends JPanel { Ball ball = new Ball(this); Ball ball2 = new Ball(this); Racquet racquet = new Racquet(this); float speed = (float) 1.0; int score; private JButton playMore; private JButton exitPlease; static JFrame frame = new JFrame("Challenger"); private Icon defaultImg; private JLabel bck; private int getScore() { return score; } public Game2() { addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { racquet.keyReleased(e); } @Override public void keyPressed(KeyEvent e) { racquet.keyPressed(e); } }); setFocusable(true); bck=new JLabel(new ImageIcon("bg.png")); bck.setBounds(0, 0, 300, 400); frame.add(bck); } private void move() { ball.move(); if(score &gt;= 10) { float tempSpeed = ball2.getSpeed(); ball2.move2(tempSpeed); } racquet.move(); } @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Graphics2D g3d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ball.paint(g2d); racquet.paint(g2d); if( score &gt;= 10) { ball2.paint(g3d); } g2d.setColor(Color.RED); g2d.setFont(new Font("Verdana",…
score: 0
has comment: http://stackoverflow.com/comment/31142524
answer count: 1

http://stackoverflow.com/comment/31086713
type: Comment
comment on: http://stackoverflow.com/q/20735147
has text: Do you have an index on the two fields you want to sort/paginate on? You said you want to sort by username - that's not in your query. Btw you don't need $project first - you can put it last, AF is smart enough not to pass through fields it doesn't need. But index is critical for good performance.
score: 0
type: QuestionComment

java.util.scanner
tags question: http://stackoverflow.com/q/20848118
tags question: http://stackoverflow.com/q/20757020
tags question: http://stackoverflow.com/q/20826190
tags question: http://stackoverflow.com/q/20722857
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/20690683
tags question: http://stackoverflow.com/q/20718530
tags question: http://stackoverflow.com/q/20686352
tags question: http://stackoverflow.com/q/20721961
tags question: http://stackoverflow.com/q/20834913
tags question: http://stackoverflow.com/q/20842928
type: Tag
tags question: http://stackoverflow.com/q/20687441
tags question: http://stackoverflow.com/q/20723422
tags question: http://stackoverflow.com/q/20713355
tags question: http://stackoverflow.com/q/20811399
tags question: http://stackoverflow.com/q/20691697
tags question: http://stackoverflow.com/q/20813848
tags question: http://stackoverflow.com/q/20816555
tags question: http://stackoverflow.com/q/20818712
tags question: http://stackoverflow.com/q/20825068
tags question: http://stackoverflow.com/q/20838244

http://stackoverflow.com/a/20769074
has body: The "Permission denied" in the error message indicates you don't have read access to the directory. Which user is running the java code, your personal user or the cloudera? To fix, you should either make the data readable for your user, move it to a common location that is globally readable, think /usr/local, or run your code as the cloudera user. Also, is this in HDFS or on the local filesystem?
answers question: http://stackoverflow.com/q/20765820
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31173396
has comment: http://stackoverflow.com/comment/31131276

http://stackoverflow.com/comment/31207026
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20811517
has text: Is there any alternative way?
score: 0

http://stackoverflow.com/q/20721205
type: Question
downvote count: 0
tagged with: awt
favorite count: 0
has body: I'm trying to add a system tray icon, with a right click menu on the icon, for a javafx program. The answers I've found indicate that the only way to do this is via java.awt.SystemTray Which is fine, but the popup menu which shows up when I right click the icon in tray, looks very bland. Also, if I hover the mouse over any of the popup menu options, I expect the background color of that option to change, to indicate that I'm selecting it. But this doesn't happen, the menu stays completely static and unchanging until I click an option. I'm looking for a way that I can listen to the mouseover event on a MenuItem and change its background + foreground color to indicate that it has the focus. But I can't find any methods in the API that let you do this. Is there any other way? Or is there anything else I can do to make the menu seem a bit more responsive?
has comment: http://stackoverflow.com/comment/31042118
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31042213
has title: Improving the appearance of java.awt.PopupMenu and java.awt.MenuItem?
upvote count: 1
has comment: http://stackoverflow.com/comment/31042256
has comment: http://stackoverflow.com/comment/105333680
score: 1
tagged with: java

http://stackoverflow.com/comment/31387276
score: 0
type: Comment
type: AnswerComment
has text: I created a quick sparse matrix demo which roughly mirrors your use case: https://github.com/mikera/vectorz/blob/develop/src/test/java/example/SparseMatrix.java
comment on: http://stackoverflow.com/a/20783858

http://stackoverflow.com/a/20682484
answers question: http://stackoverflow.com/q/20682311
downvote count: 0
has body: You can try this http://java-sl.com/JEditorPanePrinter.html to print content of JEditorPane. Highlighting is not printed. It's not part of attributes. To print text background/foreground you should specify text element's attributes. TO scale JEditorPane's content you can try this http://java-sl.com/Scale_In_JEditorPane.html To see the background just set background of JEditorPane. However some editor kits use own rendering for the root views and you might need to specify the color in the root view instead.
has comment: http://stackoverflow.com/comment/37460362
type: Answer
has comment: http://stackoverflow.com/comment/31055687
upvote count: 3
score: 3

http://stackoverflow.com/comment/31660222
has text: Thanks a lot ! I had a similar issue and it was driving me mad !
comment on: http://stackoverflow.com/a/20694037
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20733794
type: Answer
has body: getInt() is not a method, that will not even compile. nextInt()'s parameter is exclusive so a call to nextInt(1) will always give you a zero. That might be why it appears not to be random to you. Also, instead of adding a 1 to chest and then checking to see if equals 1, just don't add anything and check for it to equal zero. Same for sword.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20733741

http://stackoverflow.com/q/20805444
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31195166
tagged with: audio
score: 3
downvote count: 0
tagged with: java
type: Question
has body: What is the best way to go about putting sound into a Java application? Or is there one, it's just all personal preference or situation? I was looking online, and I found a tutorial that included the use of the undocumented "sun.audio" (I believe it was called that) package. I looked around, and found the "javax.sound.sampled" package, which is documented, official, and appears to be the same thing. So I was wondering, is there a "best", "most efficient", or "standard" way to include music in a Java application? I was looking around stackoverlow and other websites, and I found a lot of different answers pointing in multiple directions. I suppose a follow-up question would be is one package better for short lived "effect" sounds, and one better for a more background music feel? Or is one just better overall? Thanks for the help.
has comment: http://stackoverflow.com/comment/31194476
has answer: http://stackoverflow.com/a/20807744
has title: What is the best way to go about putting sound into a Java application?
upvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/a/20755339
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20752781
upvote count: 0
has body: There are two parts to your question: Part 1: What is the &lt;M&gt;? The presence of a generic parameter on a method makes it a "typed method", which means the method has a generic type that is determined by the caller, usually by inference. It may be bounded. If the class has a type too and the method is an instance method, the two types are unrelated. Part 2: The generic types must match exactly. The reason boils down to the fact that if B is a subtype of A, SomeClass&lt;T extends B&gt; is not a subtype of SomeClass&lt;T extends A&gt;, more particularly, SomeClass&lt;A&gt; is not a subtype of SomeClass&lt;? super A&gt;.
score: -1

http://stackoverflow.com/comment/31018197
type: Comment
has text: Hey, Blaise, Thnks, could you explain me more details about how to implement it?
comment on: http://stackoverflow.com/a/20708192
type: AnswerComment
score: 0

http://stackoverflow.com/comment/72031508
type: Comment
score: 1
has text: Also the entire fact you have a doesNoteExists but no doesExists makes it worse- I can't even decide what direction is a failure. If it just returned a boolean, I could throw a not in. Just a horrible failure of library design.
comment on: http://stackoverflow.com/a/20811193
type: AnswerComment

http://stackoverflow.com/q/20805233
has title: Implementation of a set using ArrayList in a generic class
accepted answer: http://stackoverflow.com/a/20805333
has comment: http://stackoverflow.com/comment/31192541
tagged with: arraylist
answer count: 2
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/31192456
has answer: http://stackoverflow.com/a/20805333
possible better answer: http://stackoverflow.com/a/20805380
has answer: http://stackoverflow.com/a/20805380
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: set
has comment: http://stackoverflow.com/comment/31192767
has body: Im trying to implement a set using arrayList, i want to make 2 constructors. an empty one and one that get an array and adds it: public class set&lt;E&gt; { Set &lt;E&gt; setList; ArrayList&lt;E&gt; elementList; public set(){ setList = (Set&lt;E&gt;) new ArrayList(); } public &lt;E&gt; set(E[] inputArray){ super(); for(E element: inputArray) // not working setList.add( element); // setList.addAll(Arrays.asList(inputArray)); - not working either } I get an error at the second constructor: "The method add(E) at the type set is not applicable for arguments (E)"
upvote count: 1
type: Question

http://stackoverflow.com/q/20679427
upvote count: 1
has answer: http://stackoverflow.com/a/20679739
downvote count: 1
has title: How to receive new data on an InputStream from a socket continuously
tagged with: java
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/30999277
has comment: http://stackoverflow.com/comment/30967049
favorite count: 0
has body: My java code is this package pack.client; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.net.Socket; import java.net.UnknownHostException; import org.apache.commons.codec.binary.Hex; public class ReceiveHex { public static void main(String[] args) throws UnknownHostException, IOException { Socket s = new Socket("192.168.121.146", 6866); byte[] data = new byte[5]; while(true) { InputStream stream = s.getInputStream(); stream.read(data); System.out.println(Hex.encodeHexString(data)); data= null; //stream.reset(); } } } I want to receive data continuosly from the server in the array and print it. Right now I am getting 0000000000 How to achieve this, Please help me with this.
tagged with: sockets
has answer: http://stackoverflow.com/a/20679545
type: UnansweredQuestion

http://stackoverflow.com/comment/30978197
type: Comment
type: QuestionComment
score: 0
has text: Do an alert(s); just before you peform the third replaceAll. See what value is coming in.
comment on: http://stackoverflow.com/q/20686076

http://stackoverflow.com/q/20727539
has title: The Code Won't Repaint Properly
tagged with: draw
type: Question
tagged with: graphics
tagged with: canvas
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20727626
type: UnansweredQuestion
has body: I'm trying to get the code to move the things that are drawn on the canvas. However, I don't know how to go about by it. As of now, whenever I press the key that is supposed to make the object move to the right or left, the drawn object simply disappears. However, other objects that are not supposed to move stay on the screen. More information: When ran, the code would simply display the circle drawn. However, I think that it is perpetually being repainted as the drawing keeps flashing and blinking. When I try to press the buttons associated with the key listener, nothing happens. After pressing the button for a few seconds, the circle disappears completely. Here is the code that is poorly made and disorganized: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.*; import javax.imageio.*; import java.io.*; public class FaceFrame extends JFrame { private FaceCanvas face; public FaceFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 800); setVisible(true); setLayout(new BorderLayout()); face = new FaceCanvas(); add(face, BorderLayout.CENTER); } public static void main(String args[]) { JFrame faceFrame = new FaceFrame(); } } class FaceCanvas extends Canvas { private int xpos, ypos; public FaceCanvas() { setBackground( Color.BLUE ); setSize( 300, 300 ); xpos = ypos = 50; } public void paint( Graphics g ) { // override paint method by re-defining it g.setColor( Color.WHITE ); g.drawOval( xpos, ypos, 31, 31 ); g.drawLine( xpos + 10, ypos + 20, xpos + 20, ypos + 20 ); repaint(); } class KeyListenerTester extends JFrame implements KeyListener { public KeyListenerTester() { } @Override public void keyTyped(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { } if (e.getKeyCode() == KeyEvent.VK_LEFT) { } } @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { addX(-10); } if (e.getKeyCode() == KeyEvent.VK_LEFT) { } } @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode…
tagged with: java
tagged with: keylistener

http://stackoverflow.com/a/24680397
has body: Using setFocusable(true) and setFocusableInTouchMode(true) are correct. To fix the two-touch problem created by the latter check for the ACTION_UP event in your touch handler and return false to let the event bubble up which eliminates the extra requestFocus() call: @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP &amp;&amp; !v.hasFocus()) { v.performClick(); } return false; } The hasFocus() check makes this specific to the click-twice problem; if the control already has focus, your actual tap should bring up the list without additional work.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20789407
upvote count: 9
score: 9

http://stackoverflow.com/q/20818927
has comment: http://stackoverflow.com/comment/31218219
upvote count: 5
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20818974
accepted answer: http://stackoverflow.com/a/20818959
has title: How to access a JFrame from anonymous ActionListener for adding a panel in frame?
favorite count: 0
type: Question
score: 5
tagged with: swing
possible better answer: http://stackoverflow.com/a/20819851
has answer: http://stackoverflow.com/a/20819851
tagged with: java
answer count: 3
has body: I want to add a JPanel in a frame if a certain button is clicked and I don't know how to manage that from an anonymous ActionListener. Here is the code: public class MyFrame extends JFrame { JPanel panel; JButton button; public MyFrame() { button = new JButton("Add panel"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { panel = new JPanel(); //here I want to add the panel to frame: this.add(panel), but I don't know //how to write that. In these case "this" refers to ActionListener, not to //frame, so I want to know what to write instead of "this" in order to //refer to the frame } } this.add(button); } Thank you in advance!
has answer: http://stackoverflow.com/a/20818959
tagged with: actionlistener

http://stackoverflow.com/q/20721929
tagged with: java
answer count: 2
upvote count: 7
has answer: http://stackoverflow.com/a/66255774
downvote count: 1
has title: How to remove the last new line (\n)
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/20721945
has body: I have the code below. the if condition is true and it goes into the line inside the IF but when I inspect answerText later, it still has the new line at the end if(answerText.endsWith("\n")){ answerText = answerText.substring(0, answerText.length()-2); }
favorite count: 0
has comment: http://stackoverflow.com/comment/31043418
has comment: http://stackoverflow.com/comment/31043458
type: Question
has comment: http://stackoverflow.com/comment/31043462

http://stackoverflow.com/comment/31172747
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20793464
has text: @AurelioDeRosa At the time when this answer was written, there where no tag about java, only `operators`.

http://stackoverflow.com/a/54564994
has body: Assume only the external representation is of interest. The following worked for me without further ado. It is based on the java.util.Calendar object and on the java.util.Formatter. It seems that a calendar object acts like a date object with a varying time zone instead of a default time zone, and is accepted by the formatter in place of a date. The test code was: Calendar cl = Calendar.getInstance(); cl.setTimeInMillis(System.currentTimeMillis()); System.out.println("cl="+String.format( "%1$ta, %1$td %1$tb %1$tY %1$tT %1$tZ", cl)); cl.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println("cl="+String.format(Locale.ENGLISH, "%1$ta, %1$td %1$tb %1$tY %1$tT %1$tZ", cl)); The result was: cl=Mi, 06 Feb 2019 13:51:41 MEZ cl=Wed, 06 Feb 2019 12:51:41 GMT
type: Answer
answers question: http://stackoverflow.com/q/20762089
score: 0

http://stackoverflow.com/comment/76947466
score: 3
type: AnswerComment
has text: Bug still exists in java version Java(TM) SE Runtime Environment (build 1.8.0_25-b17) on macOs Sierra 10.12.5 (16F73)
type: Comment
comment on: http://stackoverflow.com/a/20807657

http://stackoverflow.com/comment/31025436
has text: What is the error message saying?
score: 1
comment on: http://stackoverflow.com/q/20712044
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31197861
score: 0
type: Comment
type: QuestionComment
has text: I tried to run as admin but still not working
comment on: http://stackoverflow.com/q/20807731

http://stackoverflow.com/comment/31257906
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20839652
has text: Resize is standard property of Component and not of the LayoutManager... at least the documentation says so. But the problem is that I have a lot of components and I don't have time to apply resize to all of them. I have tried overriding paintComponent and resizing it and I managed to resize the window, but components didn't resize right and also, I had problems with mouse events
score: 0

http://stackoverflow.com/comment/31024524
score: 4
type: Comment
type: QuestionComment
has text: `==` does not work on Strings unless they point to the same object reference, java101
comment on: http://stackoverflow.com/q/20711607

http://stackoverflow.com/q/20738912
tagged with: web.xml
type: AnsweredQuestion
score: 3
has title: Java Servlet DB username and password store location
downvote count: 0
tagged with: java
tagged with: servlets
type: Question
has body: I'm totally beginner in servlets. I know I can set init params in web.xml. My question is : Is it good to store DB user and DB password in web.xml for the ease of configuration? OR Shall I store them Hard-coded for security wise? In other words is web.xml visible to end user?
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20739019
upvote count: 3
has answer: http://stackoverflow.com/a/20739019

http://stackoverflow.com/q/20715854
score: 0
tagged with: string-interning
favorite count: 0
has answer: http://stackoverflow.com/a/20900151
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: guava
tagged with: java
has body: I'm creating a few rather big objects and many of them are duplicates. So I thought about using Guava's Interner for them and always work with the interned object only (i.e., each object gets interned just after creation). It occurred to me that equals of those objects is rather slow (and gets used a lot) and that I actually never need it, as a.equals(b) is equivalent to a == b after interning. Unfortunately, the Interner itself uses equals so I have to override it for the single use. I wonder if there's a simple way to have my equals and eat it? Disclaimer: I know about the root of all evil and I'm not sure if optimization on this place is worth the effort. However, I'm interested if the above problem has a nice solution.
tagged with: equality
type: Question
answer count: 2
has title: How to avoid slow equals for interned objects?
has answer: http://stackoverflow.com/a/20715927

http://stackoverflow.com/a/20809233
type: AcceptedAnswer
has body: You can create a forEach loop in your jsp which iterates through each 'map' in the 'model'. For example, &lt;c:forEach items="${model}" var="map"&gt; &lt;div&gt; ${map.name} &lt;br/&gt; ${map.description} &lt;div/&gt; &lt;/c:forEach&gt;
type: Answer
answers question: http://stackoverflow.com/q/20804927
accepted answer of: http://stackoverflow.com/q/20804927
score: 0

http://stackoverflow.com/comment/31204670
score: 0
comment on: http://stackoverflow.com/q/20811665
type: Comment
type: QuestionComment
has text: @ChrisHayes I'm asking if you can see any problems there

http://stackoverflow.com/q/20834162
has answer: http://stackoverflow.com/a/20834277
has answer: http://stackoverflow.com/a/20834260
type: AnsweredQuestion
has body: I was trying to solve a problem of Project Euler with Java. The Problem 4. http://projecteuler.net/problem=4 It said I had to find the largest palindrome made from the product of two 3-digit numbers. So here is the code (just the part that isn't working) : public class Problem4PE { public static void main(String[] args){ int result = 0; Integer output = 0; for (int i = 100; i &lt; 1000; i++) { for (int j = 100; j &lt; 1000; j++) { output = i*j; String strout = output.toString(); StringBuilder stb = new StringBuilder(); char[] chrout = strout.toCharArray(); for (int x = 0; x &lt; chrout.length; x++) { stb.append(chrout[x]); } StringBuilder stres = new StringBuilder(""); for (int k = chrout.length-1; k &gt; -1 ; k--) { stres.append(chrout[k]); } String stbb = stb.toString(); String string = stres.toString(); Boolean bool = stbb.equals(string); if (bool){ result = output; } } } System.out.println(result); } } So aboves output comes out : 580085 But when I submit it, it shows incorrect. I do not understand why. So could you please tell me whether the problem is in code, or I had a mistake in understanding the question.
type: Question
tagged with: conditional-statements
has comment: http://stackoverflow.com/comment/31246897
tagged with: java
possible better answer: http://stackoverflow.com/a/20834260
tagged with: boolean
score: 0
answer count: 2
has title: Why isn't the if statement working?
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31246978
accepted answer: http://stackoverflow.com/a/20834277
tagged with: palindrome
favorite count: 0

spring-mvc
tags question: http://stackoverflow.com/q/20768779
tags question: http://stackoverflow.com/q/20790634
tags question: http://stackoverflow.com/q/20756121
tags question: http://stackoverflow.com/q/20815184
tags question: http://stackoverflow.com/q/20684518
tags question: http://stackoverflow.com/q/20774241
tags question: http://stackoverflow.com/q/20686750
tags question: http://stackoverflow.com/q/20818459
tags question: http://stackoverflow.com/q/20843191
tags question: http://stackoverflow.com/q/20840153
tags question: http://stackoverflow.com/q/20792988
tags question: http://stackoverflow.com/q/20684201
tags question: http://stackoverflow.com/q/20731144
tags question: http://stackoverflow.com/q/20842643
tags question: http://stackoverflow.com/q/20782210
tags question: http://stackoverflow.com/q/20845623
tags question: http://stackoverflow.com/q/20792313
tags question: http://stackoverflow.com/q/20841331
tags question: http://stackoverflow.com/q/20765754
tags question: http://stackoverflow.com/q/20786394
tags question: http://stackoverflow.com/q/20695554
tags question: http://stackoverflow.com/q/20831040
tags question: http://stackoverflow.com/q/20819494
tags question: http://stackoverflow.com/q/20726977
tags question: http://stackoverflow.com/q/20842070
tags question: http://stackoverflow.com/q/20740956
tags question: http://stackoverflow.com/q/20840737
tags question: http://stackoverflow.com/q/20742208
tags question: http://stackoverflow.com/q/20802032
tags question: http://stackoverflow.com/q/20723837
tags question: http://stackoverflow.com/q/20844456
tags question: http://stackoverflow.com/q/20687943
tags question: http://stackoverflow.com/q/20693347
tags question: http://stackoverflow.com/q/20794478
tags question: http://stackoverflow.com/q/20740867
tags question: http://stackoverflow.com/q/20680280
tags question: http://stackoverflow.com/q/20722046
tags question: http://stackoverflow.com/q/20709655
tags question: http://stackoverflow.com/q/20808290
tags question: http://stackoverflow.com/q/20813052
tag name: spring-mvc
tags question: http://stackoverflow.com/q/20762394
tags question: http://stackoverflow.com/q/20733021
tags question: http://stackoverflow.com/q/20695443
tags question: http://stackoverflow.com/q/20746560
tags question: http://stackoverflow.com/q/20804459
tags question: http://stackoverflow.com/q/20805121
tags question: http://stackoverflow.com/q/20821460
tags question: http://stackoverflow.com/q/20716547
tags question: http://stackoverflow.com/q/20792406
tags question: http://stackoverflow.com/q/20787000
tags question: http://stackoverflow.com/q/20750318
tags question: http://stackoverflow.com/q/20770294
type: Tag
tags question: http://stackoverflow.com/q/20732941
tags question: http://stackoverflow.com/q/20834141
tags question: http://stackoverflow.com/q/20704086
tags question: http://stackoverflow.com/q/20725088
tags question: http://stackoverflow.com/q/20742749
tags question: http://stackoverflow.com/q/20698425
tags question: http://stackoverflow.com/q/20822987
tags question: http://stackoverflow.com/q/20720930
tags question: http://stackoverflow.com/q/20775487
tags question: http://stackoverflow.com/q/20735205
tags question: http://stackoverflow.com/q/20836460
tags question: http://stackoverflow.com/q/20684338
tags question: http://stackoverflow.com/q/20713522
tags question: http://stackoverflow.com/q/20819055
tags question: http://stackoverflow.com/q/20836496
tags question: http://stackoverflow.com/q/20684705
tags question: http://stackoverflow.com/q/20804768
tags question: http://stackoverflow.com/q/20735193
tags question: http://stackoverflow.com/q/20733667
tags question: http://stackoverflow.com/q/20809264
tags question: http://stackoverflow.com/q/20804927
tags question: http://stackoverflow.com/q/20706776
tags question: http://stackoverflow.com/q/20811960
tags question: http://stackoverflow.com/q/20728602
tags question: http://stackoverflow.com/q/20798654
tags question: http://stackoverflow.com/q/20734053

http://stackoverflow.com/comment/31209025
comment on: http://stackoverflow.com/a/20813600
score: 0
type: AnswerComment
has text: **MouseMotionListener** worked. Thank you body. :) And i am sorry i could have been more clear on what i want.
type: Comment

http://stackoverflow.com/comment/31018836
type: Comment
type: QuestionComment
score: 2
has text: What language would you like to use?
comment on: http://stackoverflow.com/q/20708624

http://stackoverflow.com/comment/31217395
comment on: http://stackoverflow.com/a/20816659
type: AnswerComment
has text: Hmm there was indeed a typo in the pom. Fixed now.
score: 0
type: Comment

http://stackoverflow.com/q/20831299
tagged with: java
has body: I want to split this two columns on java and put the french words in an arraylist and the English words in an another arraylist , thanks for help bonjour;goodmorning bonsoir;goodevening chat;cat comment;how pourquoi;why
downvote count: 3
type: Question
tagged with: split
linked to: http://stackoverflow.com/q/3481828
upvote count: 0
has title: split words from text using java
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31241626
has comment: http://stackoverflow.com/comment/31241592
type: UnansweredQuestion
score: -3
tagged with: text
has comment: http://stackoverflow.com/comment/33672571
has answer: http://stackoverflow.com/a/20831390
has comment: http://stackoverflow.com/comment/31241603

http://stackoverflow.com/q/20818150
tagged with: java
tagged with: webview
has comment: http://stackoverflow.com/comment/31216956
has title: Ingress Intel App
type: Question
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/31216969
has body: I'm trying to write an app that should show a map: Anything works but It doesn't show the map. I enabled Javascript and anything in my app but it doesn't work. could you take a look at it? package com.timbremer.iimv; import android.content.Context; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.view.inputmethod.InputMethodManager; import android.webkit.CookieManager; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.EditText; public class MainActivity extends ActionBarActivity { private WebView wv; private EditText etlocation; private Button btclose; private Button btgo; private boolean send; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); send = false; WebView wv = (WebView) findViewById(R.id.wv); wv.getSettings().setBuiltInZoomControls(true); CookieManager.getInstance().setAcceptCookie(true); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setLoadWithOverviewMode(true); wv.getSettings().setUseWideViewPort(true); wv.loadUrl("http://www.ingress.com/intel"); wv.getSettings().setGeolocationEnabled(true); wv.getSettings().setSupportZoom(true); wv.getSettings().setAppCacheEnabled(true); etlocation = (EditText) findViewById(R.id.etlocation); Button btgo = (Button) findViewById(R.id.btgo); btgo.setOnClickListener(new View.OnClickListener() { private String location; @Override public void onClick(View v) { location = etlocation.getText().toString(); WebView wv = (WebView) findViewById(R.id.wv); wv.getSettings().setBuiltInZoomControls(true); CookieManager.getInstance().setAcceptCookie(true); wv.getSettings().s…
has comment: http://stackoverflow.com/comment/41463476
type: UnansweredQuestion
tagged with: android
tagged with: ingress-game
has comment: http://stackoverflow.com/comment/31216835
answer count: 0

http://stackoverflow.com/a/20765410
type: Answer
has body: It seems to me that it would be simpler to have the consonants as a string and then use charAt: private static final String CONSONANTS = "bcdfgh...z"; if (CONSONANTS.indexOf(word.charAt(word.length() - 2)) { ... } If you really want to use an array, you could change your array to be in order and then call Arrays.binarySearch. Another alternative would be to create a HashSet&lt;String&gt; of the consonants and use contains on that.
answers question: http://stackoverflow.com/q/20765334
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/54638325
has comment: http://stackoverflow.com/comment/98970201
has comment: http://stackoverflow.com/comment/98962938
score: 39
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20700053
upvote count: 39
has body: A solution for those using Kotlin DSL The solutions added so far are great for the OP, but can't be used with Kotlin DSL without first translating them. Here's an example of how I added a local .JAR to my build using Kotlin DSL: dependencies { compile(files("/path/to/file.jar")) testCompile(files("/path/to/file.jar")) testCompile("junit", "junit", "4.12") } Remember that if you're using Windows, your backslashes will have to be escaped: ... compile(files("C:\\path\\to\\file.jar")) ... And also remember that quotation marks have to be double quotes, not single quotes. Edit for 2020: Gradle updates have deprecated compile and testCompile in favor of implementation and testImplementation. So the above dependency block would look like this for current Gradle versions: dependencies { implementation(files("/path/to/file.jar")) testImplementation(files("/path/to/file.jar")) testImplementation("junit", "junit", "4.12") }

http://stackoverflow.com/a/20825826
has comment: http://stackoverflow.com/comment/31258554
has comment: http://stackoverflow.com/comment/31252483
type: Answer
answers question: http://stackoverflow.com/q/20824945
has body: implement the interface OnClickListener instead of using it as " inner ", and do the work there. Instead of this: Create.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub SQLiteDatabase addition = new SQLiteDatabase(CreateContact.this); // her you ADD (put) the new data to the SQLite// String fname = editfirst.getEditableText().toString(); String lname = editlast.getEditableText().toString(); String mob = editmobile.getEditableText().toString(); String address = editaddress.getEditableText().toString(); addition.add(fname, lname, mob, address); addition.close(); // go back to the main activity after changes took place// Intent k = new Intent(CreateContact.this, MainActivity.class); startActivity(k); } }); Do this: Create.setOnClickListener(this); public class CreateContact extends Activity implements View.OnClickListener { //etc... etc.. @Override public void onClick(View v) { // TODO Auto-generated method stub SQLiteDatabase addition = new SQLiteDatabase(this); // her you ADD (put) the new data to the SQLite// String fname = editfirst.getEditableText().toString(); String lname = editlast.getEditableText().toString(); String mob = editmobile.getEditableText().toString(); String address = editaddress.getEditableText().toString(); addition.add(fname, lname, mob, address); addition.close(); // go back to the main activity after changes took place// Intent k = new Intent(CreateContact.this, MainActivity.class); startActivity(k); } } Edited Your database schema is wrong, the logcat says that there is an syntax error, it should look like this: private static final String DATABASE_CREATE = "CREATE TABLE " + DATABASE_TABLE + "( " + KEY_ROWID + " INTEGER PRIMARY KEY," + KEY_FNAME + " TEXT," + KEY_LNAME + " TEXT," + KEY_MOBILE + " TEXT," + KEY_ADDRESS + " TEXT)"; You forgot to put a comma to separate every key.
score: 0
has comment: http://stackoverflow.com/comment/31258392

http://stackoverflow.com/comment/31268213
has text: There are various ways how to check for integrity. There are also various ways how to misrepresent the integrity to your server. In short, you cannot trust any data sent by the client application. On the other hand, such integrity checks work well when combined with other validation measures.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20845858

http://stackoverflow.com/comment/31183368
type: AnswerComment
has text: Just to clarify point 3 is that i printed it to look how it looks and from that i know how to proceed futher to cut the string in pieces =)
type: Comment
comment on: http://stackoverflow.com/a/20800178
score: 0

http://stackoverflow.com/a/20849694
answers question: http://stackoverflow.com/q/20849681
score: 16
has body: Why not just do List&lt;String&gt; list = new ArrayList&lt;&gt;(map.values());
downvote count: 1
upvote count: 17
type: Answer

http://stackoverflow.com/comment/31178180
comment on: http://stackoverflow.com/q/20797222
has text: As Luggi suggested long is there and even there is BigInteger : Might Helpful http://stackoverflow.com/questions/20772486/data-type-in-c-or-java-for-holding-20-digit-integer
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31112734
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20760128
score: 0
has text: Besides, Strings are passed by value, not by reference. So when you do str = str_buf.deleteCharAt(str.length() - 1).toString(); within an inner recursion it does not change the value of str in the method that called the current method, i.e. the previous recursion

http://stackoverflow.com/comment/31081656
has text: Not sure what you mean with "modifying the container". What you need to do is make the resources (queues, topics, connection manager) available in your JNDI tree. Then your code can get hold of a reference like to any other resource, a JDBC datasource for example. Because Tomcat's JNDI implementation is read-only you have to do it as part of the server configuration that is read during server-startup. In other containers you can publish the resources as needed at runtime.
comment on: http://stackoverflow.com/a/20742938
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/20698890
favorite count: 0
type: UnansweredQuestion
score: 2
has body: On clicking a button in a jsp page, I want to run a batch file. I wrote this code to execute a batch file inside a method, but it's not working. Plz help me out. public String scheduler() { String result=SUCCESS; try { Process p = Runtime.getRuntime().exec("cmd /c start.bat", null, new File("C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\start")); System.out.println("manual scheduler for application.."+p); } catch(Exception e) { } }
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/20699522
type: Question
has answer: http://stackoverflow.com/a/20698966
has title: How to Run a Batch File from Java Code onclicking a Button
answer count: 3
linked to: http://stackoverflow.com/q/1485781
downvote count: 0
has answer: http://stackoverflow.com/a/20699439

http://stackoverflow.com/q/20819993
favorite count: 0
has comment: http://stackoverflow.com/comment/31220078
has answer: http://stackoverflow.com/a/20820593
accepted answer: http://stackoverflow.com/a/20820593
has body: I'm trying to setup a class for Gson to put my information into. Here is what the JSON being read looks like: { "id": 1234, "name": "name" } I want to return the "id" part of the JSON, but I need Gson to put it into a class first, right? Here is how my class looks right now: class getID { private int id; public int getID() { return this.id; } } Here is how I'm trying to put the JSON into this class using Gson: Gson reader = new Gson(); getID myID = reader.fromJson(inputLine, getID.class); Here is where I'm getting the error: System.out.println(myID.getID()); I don't have a good understanding of Gson, but I've used JSON before. Searching this topic I found a lot of information but never one that shows the this simple of JSON being sorted by Gson. Any help would is welcome. EDIT: The error is a null-pointer exception, pointing to the "System.out.println(myID.getID());" The inputLine is the return from an API request in JSON format. It's a one line that looks like {"id":1234,"name":"name"}
has comment: http://stackoverflow.com/comment/31221088
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/31220346
has comment: http://stackoverflow.com/comment/31221115
has comment: http://stackoverflow.com/comment/31221107
score: -1
has title: Class setup for Gson
has comment: http://stackoverflow.com/comment/31220259
has comment: http://stackoverflow.com/comment/31220626
answer count: 1
downvote count: 1

http://stackoverflow.com/q/20808479
accepted answer: http://stackoverflow.com/a/20821575
downvote count: 0
favorite count: 0
has title: Algorithm for generating vibration patterns ranging in intensity in Android?
has body: I am attempting to programmatically generate Android vibration patterns with 'micro pulses' on and off to control how strong the vibration feels to the end user. This is the solution I've seen recommended in a few similar topics, to the problem of the API not providing an interface for controlling the vibration strength (because of how the hardware functions, as I understand it). The algorithm for generating these patterns, however, seems to only be hinted at, but no actual algorithm posted. What I would like to do is, given an input intensity between 0.0f and 1.0f, generate an array following a pattern something like this: (zero intensity) [20,0] [9,1,9,1] ... [3,1,3,1,3,1,3,1,3,1] [2,1,2,1,2,1,2,1,2,1,2,1,2] (half intensity) [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] [1,2,1,2,1,2,1,2,1,2,1,2,1,1] [1,3,1,3,1,3,1,3,1,3] ... [1,9,1,9] (full intensity) [0,20] Any help with writing such an algorithm (or suggestions for a better strategy to meet the same goal)? Edit: I've added a bounty of 100 reputation to the mix :)
has comment: http://stackoverflow.com/comment/31198991
tagged with: android
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20821575
has answer: http://stackoverflow.com/a/20816986
score: 11
has answer: http://stackoverflow.com/a/20893991
type: Question
has comment: http://stackoverflow.com/comment/31199520
tagged with: android-vibration
tagged with: algorithm
tagged with: java
possible better answer: http://stackoverflow.com/a/20893991
has comment: http://stackoverflow.com/comment/31204740
answer count: 3

http://stackoverflow.com/q/20837856
favorite count: 0
has answer: http://stackoverflow.com/a/58541865
upvote count: 176
tagged with: resteasy
has answer: http://stackoverflow.com/a/20838816
has answer: http://stackoverflow.com/a/51370300
possible better answer: http://stackoverflow.com/a/50135534
has answer: http://stackoverflow.com/a/79546992
has answer: http://stackoverflow.com/a/50135534
has title: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
tagged with: spring
has answer: http://stackoverflow.com/a/43979056
has answer: http://stackoverflow.com/a/54153916
score: 176
has answer: http://stackoverflow.com/a/59971392
answer count: 15
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/65499085
type: Question
accepted answer: http://stackoverflow.com/a/20838816
has answer: http://stackoverflow.com/a/69836706
has answer: http://stackoverflow.com/a/59489158
has answer: http://stackoverflow.com/a/57233209
tagged with: jackson
has answer: http://stackoverflow.com/a/55638065
has answer: http://stackoverflow.com/a/61632066
has answer: http://stackoverflow.com/a/76046963
has body: I'm trying to POST a List of custom objects. My JSON in request body is this: { "collection": [ { "name": "Test order1", "detail": "ahk ks" }, { "name": "Test order2", "detail": "Fisteku" } ] } Server side code that handles the request: import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path(value = "/rest/corder") public class COrderRestService { @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response postOrder(Collection&lt;COrder&gt; orders) { StringBuilder stringBuilder = new StringBuilder(); for (COrder c : orders) { stringBuilder.append(c.toString()); } System.out.println(stringBuilder); return Response.ok(stringBuilder, MediaType.APPLICATION_JSON).build(); } } Entity COrder: import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class COrder { String name; String detail; @Override public String toString() { return "COrder [name=" + name + ", detail=" + detail + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]"; } } But an exception is thrown: SEVERE: Failed executing POST /rest/corder org.jboss.resteasy.spi.ReaderException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@6de8c535; line: 1, column: 1] at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:183) at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:88) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:111) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:280) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234) at org.jboss…
downvote count: 0
tagged with: jax-rs

http://stackoverflow.com/q/20828454
has comment: http://stackoverflow.com/comment/31236271
has title: Intent issue (display new form) Android
tagged with: android
has body: Ok I've been looking around for hours. I've tried just about everything and I'm not sure what is going on but I'm getting the issue where it can't find the activity. The activity is in my manifest file. I've tried with .ActivityName and com...ActivityName. I've saved, I've cleaned, I've closed/opened eclipse. It just can't seem to find it. Here's code, maybe I'm missing something? Manifest file: &lt;activity android:name=".Activity2"&gt;&lt;/activity&gt; Listener in MainActivity: View.OnClickListener test = new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this,Activity2.class); startActivity(intent); } }; Activity2: public class Activity2 extends Activity { ImageButton btnTest; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO Auto-generated method stub btnTest= (ImageButton)findViewById(R.id.btnDepressed); btnTest.setOnClickListener(GoTest); } ...etc. I've read so many articles on this from here and other sites. I've watched videos.. I simply don't see what I'm doing wrong. The activity is defined in the manifest, I've tried the intent with the above code, as well as with: new Intent("com.blah.blah.Activity2"); Neither is working. Any ideas?
has comment: http://stackoverflow.com/comment/31235951
has answer: http://stackoverflow.com/a/20828577
tagged with: android-intent
has answer: http://stackoverflow.com/a/20828565
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20828565
has comment: http://stackoverflow.com/comment/31235939
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31236185
possible better answer: http://stackoverflow.com/a/20828577
score: 0

http://stackoverflow.com/q/20727585
answer count: 1
downvote count: 0
has body: How can I read large xlsx files Error comes since I am loading whole excel file in memory.Is there anyway so that I can read excel file in chunks so that memory consumption will reduce? I am using "Aspose Cells for Android" library for reading excel files. Please help. error is java.lang.OutOfMemoryError: [memory exhausted] at dalvik.system.NativeStart.main(Native Method)
has comment: http://stackoverflow.com/comment/31054127
favorite count: 0
tagged with: dalvik
tagged with: android
has comment: http://stackoverflow.com/comment/31095484
has answer: http://stackoverflow.com/a/20727900
upvote count: 3
type: UnansweredQuestion
has title: How to read excel file programmatically (.xlsx) in chunks i.e in group of 5000 rows, in an android application?
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31054211

http://stackoverflow.com/comment/31083379
type: QuestionComment
has text: Arrays indexes are zero-based. The first cell of you array is resultArray[0][0]. If it is a TSV, so you must split on tabs ("\\t") instead of minus signs ("-").
comment on: http://stackoverflow.com/q/20744068
score: 0
type: Comment

http://stackoverflow.com/comment/31167136
has text: Depends on what you want to do, and how. Cross- compilers mean compilation. Bytecode doesn't require additional compilation. Java includes OS hooks, including GUI functionality; you need to compile (again) and use a cross-platform GUI library if you're not using Java.
comment on: http://stackoverflow.com/q/20790900
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31178530
score: 0
comment on: http://stackoverflow.com/a/20797380
type: Comment
has text: Both packages are in the same project. And the build path includes all packages in the project
type: AnswerComment

http://stackoverflow.com/a/20942407
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20829041
has body: Besides what Sotirios suggested above, you can also use Spring's contructor-args dependency injection to initialize the dataSource. So you can modify the constructor to be: public ToDoItemDaoImpl(DataSource dataSource) { this.dataSource = dataSource; insert = new SimpleJdbcInsert(dataSource).withTableName("toDoItem").usingGeneratedKeyColumns("id"); } Then you also need to add the following lines in the bean configuration file: &lt;bean id="toDoItemDaoImpl" class="mypackage.ToDoItemDaoImpl"&gt; &lt;constructor-arg ref="dataSource"/&gt; &lt;/bean&gt;
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31488422
score: 0
comment on: http://stackoverflow.com/q/20838583
type: Comment
type: QuestionComment
has text: Hmm, i tried everything. Now i'm back to 2005 and wrote a solid query. That didnt work either! There is a @Transactional-Annotation but it got ignored i guess, because i get a javax.persistence.TransactionRequiredException :/ WOOW, a hint!

http://stackoverflow.com/q/20705162
favorite count: 0
has comment: http://stackoverflow.com/comment/31219297
has body: When I'm trying to use found solutions to convert from Node to String in javascript, starting from this line var transformer = javax.xml.transform.TransformerFactory.newInstance().newTransformer(); it says Message: (Desired evaluation could not be performed: JavaScript Error: Internal Error: ReferenceError: "javax" is not defined. (JavaScript Error: Internal Error: ReferenceError: "javax" is not defined.) but classes from java* package work OK this works: var writer = new java.io.StringWriter(); Is it possible to convert Node to String without using classes from javax* package? using org.w3c.* is ok though
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31065232
linked to: http://stackoverflow.com/q/2653670
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31064825
type: Question
has answer: http://stackoverflow.com/a/20819314
tagged with: rhino
tagged with: java-5
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31064681
has title: Convert DOM Node to String without using javax.* classes
has comment: http://stackoverflow.com/comment/31065097
has comment: http://stackoverflow.com/comment/31064818
has comment: http://stackoverflow.com/comment/31065180
answer count: 1
tagged with: javascript
accepted answer: http://stackoverflow.com/a/20819314

http://stackoverflow.com/comment/31054248
comment on: http://stackoverflow.com/a/20727431
has text: Thanks Szymon. You are a genius. Appreciate greatly for your help. :)
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31073619
comment on: http://stackoverflow.com/a/20738245
has text: In that case keep only two copies of the map. One is original, and another one is one you create by serializing and dEserializing the original map. Just two copies. Reuse and recycle.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31126224
type: QuestionComment
comment on: http://stackoverflow.com/q/20767462
score: 0
has text: For example, in button2 you should use `android:layout_toLeftOf="@id/button3"` as you already declared `+@id/button3` above it.
type: Comment

http://stackoverflow.com/a/20772616
downvote count: 0
has comment: http://stackoverflow.com/comment/31149185
type: Answer
answers question: http://stackoverflow.com/q/20772486
score: 3
upvote count: 3
has body: Check out The Large Integer Case Study in C++.pdf by Owen Astrachan. I found this file extremely useful with detail introduction and code implementation. It doesn't use any 3rd-party library. I have used this to handle huge numbers (as long as you have enough memory to store vector&lt;char&gt;) with no problems. I have answered a similar question here, where I gave a more detailed introduce.

http://stackoverflow.com/q/20701542
favorite count: 0
type: Question
has title: an attempt was made to request new permissions for a session that has a pending request.Android
tagged with: facebook
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26078831
tagged with: java
has body: I have implemented fb integration and i am getting users details by setting some permissions but it is giving me error java.lang.UnsupportedOperationException: Session: an attempt was made to request new permissions for a session that has a pending request. when i run first time and second time it it is not giving me this exception, i am using the latest fb SDK for integration. I'll post me code. public class MainActivity extends Activity { Button loginbtn; Session session = Session.getActiveSession(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loginbtn = (Button)findViewById(R.id.loginbutton); loginbtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(MainActivity.this,FacebookLogin.class); startActivity(intent); } }); } } public class FacebookLogin extends Activity{ Session.NewPermissionsRequest newPermissionsRequest = new Session .NewPermissionsRequest(this, Arrays.asList("email,user_birthday,user_location,user_hometown,user_about_me,user_relationships")); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.facebooklogin); Session.openActiveSession(this, true, new Session.StatusCallback() { // callback when session changes state @SuppressWarnings("deprecation") @Override public void call(final Session session, SessionState state, Exception exception) { if (session.isOpened()) { // Log.i("session.isOpened", "session.isOpened"); session.requestNewReadPermissions(newPermissionsRequest); // make request to the /me API Request.executeMeRequestAsync(session, new Request.GraphUserCallback() { // callback after Graph API response with user object @Override public void onCompleted(GraphUser user, Response response) { //session.requestNewReadPermissions(newPermissionsRequest); //Sy…
downvote count: 0
accepted answer: http://stackoverflow.com/a/26078831
has comment: http://stackoverflow.com/comment/31032565
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17878500
tagged with: android
score: 1
has comment: http://stackoverflow.com/comment/34009822
tagged with: facebook-graph-api

http://stackoverflow.com/q/20723338
type: UnansweredQuestion
has body: I have a database in mysql with field userId, userName etc,. from here I'm retrieving userid based on some criteria. I have a folder with files and name of the file is some userId . I want to compare retrieved userId with those files and if they match further process those files. I tried this code but its giving number format exception. not able to understand why? package read; import java.io.*; import java.util.*; import java.sql.*; public class read1 { static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/test"; static final String USER = "root"; static final String PASS = "root"; public static void main(String args[])throws Exception{ Connection conn = null; Statement stmt = null; try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL,USER,PASS); System.out.println("Creating statement..."); stmt = conn.createStatement(); String sql; sql = "SELECT userId FROM profile1 where friendCount &gt;200 AND statusCount &gt; 200"; ResultSet rs = stmt.executeQuery(sql); processing p = new processing(); File directory = new File("/home/abc/tweet"); //get all the files from a directory File[] fList = directory.listFiles(); while(rs.next()){ int uid = rs.getInt("userId"); System.out.print("ID: " + uid +"\n"); for (File file : fList){ if(file.isFile()) System.out.println(file.getName()); if(Integer.parseInt(file.getName())== uid) p.process(file.getName()); } } } catch(SQLException e){ e.printStackTrace(); } } } class processing{ void process(String filename)throws Exception{ FileReader fr = new FileReader("/home/abc/tweet/"+filename); BufferedReader br = new BufferedReader(fr); FileWriter wr = new FileWriter("/home/abc/newtweet/"+filename); String s; String str="Text:"; String a[]; BufferedWriter bw = new BufferedWriter(wr); while ((s = br.readLine()) != null) { if (s.startsWith("Text:")) { // worked a= s.split(" "); for(int k=1;k&lt;a.length;…
tagged with: java
has comment: http://stackoverflow.com/comment/31046275
tagged with: mysql
has answer: http://stackoverflow.com/a/20723397
upvote count: 1
has comment: http://stackoverflow.com/comment/31046208
downvote count: 1
has comment: http://stackoverflow.com/comment/31046180
type: Question
has comment: http://stackoverflow.com/comment/31205891
has title: compare filename to an integer
score: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31180223
type: Comment
comment on: http://stackoverflow.com/a/20787006
has text: When I use getDeclaredConstructor() without passing any arguments it gives me an error. But when I pass the arguments that are there for Singleton constructor it again gives an error. How to solve this issue?
type: AnswerComment
score: 0

http://stackoverflow.com/q/20781708
has title: Othello/Reversi minimax algorithm glitch
score: 2
answer count: 0
tagged with: java
tagged with: reversi
has comment: http://stackoverflow.com/comment/31152852
type: Question
has comment: http://stackoverflow.com/comment/31151876
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31153242
downvote count: 0
has comment: http://stackoverflow.com/comment/31154076
has body: I've been working recently on a MiniMax algorithm for a standard 8x8 Othello (Reversi) game on Android in Java. Every log seems to be showing correct values for every node, and yet somehow the algorithm just doesn't choose the optimum move (I compared the behavior with someone else's application, and at some point they differ). There is quite a bit of code to swallow, I'm afraid, but I believe you can do this! First of all, my Algorithm class (from that class I inherit the MiniMax algorithm) : public abstract class Algorithm { /** game instance to which the strategy is applied */ Game game; public Algorithm (Game game) { this.game = game; } /**Finds player's all possible moves for the current state * * @param gb - a game board for which the moves are found * @param player - current player * @return - an array list of possible fields to move */ public ArrayList&lt;Field&gt; findAllPossibleMoves(GameBoard gb, boolean player) { ArrayList &lt;Field&gt; moves = new ArrayList &lt;Field&gt; (); for (int y= 0; y&lt;gb.getHeight();y++) for (int x= 0; x&lt;gb.getWidth();x++) { Field f = new Field (x,y); if (game.isAvailable(gb, f, player)) moves.add(f); } return moves; } /** Searches for the right move * @param gb - game board to do the search on * @param depth maximum depth of search tree * @param player - current player * @return - optimum move (Field) */ public abstract Field findBestMove(GameBoard gb, int depth, boolean player); /**Evaluates the player's current state * * @param gb - game board to be evaluated * @param player - player for which we evaluate * @return - the current rating (int) */ public int evaluate(GameBoard gb) { int rating = 0; int[][] eval_table = { {99, -8, 8, 6, 6, 8, -8, 99}, {-8, -24, -4, -3, -3, -4, -24, -8}, { 8, -4, 7, 4, 4, 7, -4, 8}, { 6, -3, 4, 0, 0, 4, -3, 6}, { 6, -3, 4, 0, 0, 4, -3, 6}, { 8, -4, 7, 4, 4, 7, -4, 8}, {-8, -24, -4, -3, -3, -4, -24, -8}, {99, -8, 8, 6, 6, 8, -8, 99} }; for (int x=0; x&lt;8; x++) for (int y=0;y&lt;8;y++) { if(g…
favorite count: 0
has comment: http://stackoverflow.com/comment/31152199
upvote count: 2
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/20795554
tagged with: javascript
favorite count: 0
has body: I am developing a Analytics Software and there is a need to fetch or read User Behaviour from competitor websites. I am thinking that accessing the information from cookies of the competitor site would be a better option. Is there any alternative to this. Also, How to access cookies from all domains using either JavaScript or Java.
possible better answer: http://stackoverflow.com/a/20795675
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/20795675
has answer: http://stackoverflow.com/a/20795610
has comment: http://stackoverflow.com/comment/31175453
tagged with: cookies
tagged with: session-cookies
upvote count: 1
has title: Accessing Cookies of Other Domains using JavaScript/Java
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31175718
accepted answer: http://stackoverflow.com/a/20795610
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/31081902
has text: `ArrayList` implements `toString` and the JSON library will try to serialize the `Map` contents by iteration, inspecting the key and value types and attempting to call `toString` on them. This process is recursive through all the class fields, resulting in the final JSON object. So as long as each field can be serialized the whole object should serialize to JSON.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20742492
score: 0

http://stackoverflow.com/q/20767536
has answer: http://stackoverflow.com/a/20832834
type: UnansweredQuestion
has title: JTextArea doesn't show native-font emoticons
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/20767575
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31131481
upvote count: 4
answer count: 2
downvote count: 0
tagged with: macos
has comment: http://stackoverflow.com/comment/31127003
has body: When I print a text that contain emoticons using standard output, the emoticons are shown (pic 1). But when I display the text in JTextArea, the emoticons appear as unidentified chars (pic2). How to solve this? I'm on OS X &amp; I used the same font for JTextArea as with other editors. EDIT: I DON'T want to put predefined image emoticons. Rather I want to display the emoticons that are native with fonts. So if I write in any text editor :), I will get an emoticon because the font already has this. I want this to work in JTextArea.
favorite count: 0

http://stackoverflow.com/q/20748102
score: 0
has body: The answers mentioned in How to select specified node within Xpath node sets by index with Selenium? are good enough for my case, but this is not working in selenium RC for me - it doesn't recognize mentioned xPathes with 'element not found' message as well as selenium IDE. Does anybody know how to fix it? Or maybe there are another ways to write correct xpath? I tried: (//table)[1] (.//table)[1] .(//table)[1] Also selenium cannot recognize /descendant-or-self::table[1] thought works well with //descendant-or-self::table[1] which is another expression unfortunately Sorry can not provide actual html, but the problem is that different pages has the same data tables which could be wrapped in different elements for example That is why I trying to use one PageObject AdminSiteDataTable and send table number to it's constructor, which will set xPathes for current PageObject instance. public AdminSiteDataTable(int tableNumber){ dataTableXpath = String.format("(//table)[%d]", tableNumber); dataTableRowByNumberXpath = "//tr[%d]"; dataTableColumnByNumberXpath = "//td[%d]"; dataTableCellByNumberXpath = dataTableXpath + dataTableRowXpath + dataTableColumnXpath; etc. } UPD#1: I found it works in selenium IDE if I use strict xpath like this: xpath=(//table)[1]//..//..//..//div[@class='PaginatorLine'] But it not works with WebDriverBackedSelenium, trying to fix it now. com.thoughtworks.selenium.SeleniumException: The given selector xpath=(//table)[1]//tbody//tr is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression xpath=(//table)[1]//tbody//tr because of the following error: [Exception... "The expression cannot be converted to return the specified type." UPD#2: So the only broken method in WebDriverBackedSelenium is getXpathCount() the rest works fine with this selectors like this: private static final String DATA_TABLE = "xpath=(//table)[%d]"; UPD#3: fixed getXpathCount() like…
linked to: http://stackoverflow.com/q/3674569
has comment: http://stackoverflow.com/comment/31092750
has comment: http://stackoverflow.com/comment/31094366
tagged with: xpath
answer count: 0
type: UnansweredQuestion
tagged with: selenium
has title: Selenium xpath how can I choose node of the set by index?
type: Question
has comment: http://stackoverflow.com/comment/31090838
tagged with: java
has comment: http://stackoverflow.com/comment/31096061

http://stackoverflow.com/comment/31046573
type: Comment
has text: @PM77-1 Dam that codes hard to read...or is it just to early :P
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20723527

http://stackoverflow.com/a/20849854
downvote count: 0
has body: You use the JPanel only to create the graphics (to paint on g2d), it has nothing to do with your problem per se. As images don't have "natural" wrap boundaries (like words or paragraphs) you need to do this yourself. Split the image, i.e. create several images manual at useful boundaries (depending on the content, probably you need to adapt the paint method) and place them on separate pages.
answers question: http://stackoverflow.com/q/20849715
has comment: http://stackoverflow.com/comment/31276806
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/31206193
type: QuestionComment
type: Comment
has text: @astralprojection is right you need to make custom adapter
comment on: http://stackoverflow.com/q/20812421
score: 0

http://stackoverflow.com/comment/31226864
type: AnswerComment
comment on: http://stackoverflow.com/a/20823533
type: Comment
has text: This would be useful, however would require me to re-write my whole game which is too time consuming, is there another way my issue can be resolved?
score: 0

http://stackoverflow.com/a/20783721
answers question: http://stackoverflow.com/q/20783574
has comment: http://stackoverflow.com/comment/31176086
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31154493
has comment: http://stackoverflow.com/comment/31154651
has body: Make sure you have installed a subversion plugin for eclipse which is is compatible with the version you have for tortoise, i.e the eclipse plugin you actually have - if any - is able to read the .svn meta data which was created by the tortoise client. This can happen for example if eclipse plugin is 1.6 and tortoise client is 1.7 or above. When eclipse shows the ~50 projects deselect all and select only the one(s) you want to import, when passed a folder for importing an existing project, eclipse searches recursively for all folders containing a .project file and displays them as projects to be imported. Make a refresh (F5). EDIT From http://tortoisesvn.net/tsvn_1.8_releasenotes.html#compatibility Local Client Compatibility Subversion working copies are sometimes accessed using several different clients, e.g. TortoiseSVN, AnkhSVN, and the svn command line client. Because the working copy format has changed with this release, 1.8 clients cannot access an earlier working copy without first upgrading it. Pre-1.8 clients cannot access 1.8 working copies at all and there is no downgrade option Please upgrade your eclipse svn-kit to the latest version, use this update site.
has comment: http://stackoverflow.com/comment/31154767
accepted answer of: http://stackoverflow.com/q/20783574
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20753422
upvote count: 1
downvote count: 1
score: 0
type: Answer
has body: JNI depends on your application. Sometime you will use the third-part c library. Ant the library may be is not full tested. It will contain bugs of memory leak or invalid memory accessing. There two problems are big issuses of JNI. It will make your application crashed. you can write a simple library in c like: int * a = NULL; *a = 20; and call the code in JAVA. Your JAVA application will down without JVM output, and you can not catch any exception in JAVA.
answers question: http://stackoverflow.com/q/20753058
has comment: http://stackoverflow.com/comment/31101552

http://stackoverflow.com/q/20781558
type: Question
score: 1
tagged with: svn
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/20781628
has answer: http://stackoverflow.com/a/20781587
downvote count: 0
linked to: http://stackoverflow.com/q/6840221
has answer: http://stackoverflow.com/a/20781625
favorite count: 0
has answer: http://stackoverflow.com/a/20781609
type: UnansweredQuestion
answer count: 4
has title: How to explain eclipse that project from svn if I checkout it by tortoise svn?
upvote count: 1
has body: I checkout my project using tortoise svn. I want to import it to eclipse and eclipse svn plugin must to work. If I make java import - eclipse doesn't understand that it is project from svn. svn plugin is installed. UPDATE I try Import-->Team-->Team Projcect Set This thing ask me select FILE. What Do I need to select?
tagged with: tortoisesvn

http://stackoverflow.com/q/20733780
tagged with: notify
has answer: http://stackoverflow.com/a/20734072
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: multithreading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31065328
has comment: http://stackoverflow.com/comment/31065314
tagged with: java
has title: Notifications in elevator simulator in Java
type: Question
accepted answer: http://stackoverflow.com/a/20734072
has comment: http://stackoverflow.com/comment/31065788
has body: I am trying to implement an elevator simulator with Person and Elevator threads that share data in an ElevatorController class. My general implementation is that I have each Person store a controller variable, and from there, they request a ride in the elevator(current floor to some other floor). The controller keeps track of the requests, and the Elevator threads ask the controller for a new assignment(which floors to stop at and direction), which it generates based on the requests. The part I am having trouble with is the notification that the doors are open on a floor. I have tried putting a boolean array in the ElevatorController and have the Person threads call wait() (within a synchronized block on controller.areDoorsOpen) and then calling notifyAll on the areDoorsOpen array from the controller but I keep getting IllegalMonitorStateExceptions. My idea was that when the Person threads are notified (controller does so when it changes an entry in the areDoorsOpen array), they check the boolean array to see if the door is open on their floor (or if they are in the elevator, on their destination floor) and enter (or exit) the elevator or continue waiting. My question is why am I getting this exception on the wait() call in the person runnable. Edit: The relevant code is In the person Runnable, private void waitForElevator() { synchronized (controller.areDoorsOpenOn) { System.out.printf("Person %d is waiting on floor %d to go to floor %d.\n", ID, currentFloor, destinationFloor); while(!controller.areDoorsOpenOn[currentFloor]) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } In the controller class, public boolean[] areDoorsOpenOn = new boolean[numberOfFloors]; public void notifyOpenDoors(int floor) { synchronized (areDoorsOpenOn) { areDoorsOpenOn[floor] = true; notifyAll(); } } public void notifyClosedDoors(int floor) { synchronized (areDoorsOpenOn) { areDoorsOpenOn[floor] = false; notifyAll(); } } The Elevator threads call notifyOpenD…
tagged with: arrays
tagged with: wait

http://stackoverflow.com/comment/31183182
type: QuestionComment
has text: What is the entire stacktrace?
comment on: http://stackoverflow.com/q/20799988
score: 0
type: Comment

http://stackoverflow.com/comment/31185120
score: 3
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20801166
has text: How do you compile the project and what kind of error do you get?

google-app-engine
tags question: http://stackoverflow.com/q/20739722
tag name: google-app-engine
tags question: http://stackoverflow.com/q/20833442
type: Tag
tags question: http://stackoverflow.com/q/20838386
tags question: http://stackoverflow.com/q/20843246
tags question: http://stackoverflow.com/q/20783694
tags question: http://stackoverflow.com/q/20728098
tags question: http://stackoverflow.com/q/20710762
tags question: http://stackoverflow.com/q/20788537
tags question: http://stackoverflow.com/q/20794751
tags question: http://stackoverflow.com/q/20826360
tags question: http://stackoverflow.com/q/20711903
tags question: http://stackoverflow.com/q/20825410
tags question: http://stackoverflow.com/q/20822820
tags question: http://stackoverflow.com/q/20706696
tags question: http://stackoverflow.com/q/20761757
tags question: http://stackoverflow.com/q/20699267
tags question: http://stackoverflow.com/q/20791536
tags question: http://stackoverflow.com/q/20758503
tags question: http://stackoverflow.com/q/20760889
tags question: http://stackoverflow.com/q/20788408
tags question: http://stackoverflow.com/q/20844121
tags question: http://stackoverflow.com/q/20695009
tags question: http://stackoverflow.com/q/20698353
tags question: http://stackoverflow.com/q/20718169
tags question: http://stackoverflow.com/q/20695148

http://stackoverflow.com/comment/31216371
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20817723
has text: That´s pretty much exactly what I was looking for (update2) - only problem so far is a compile error: "Unhandled exception type IllegalAccessException" when adding a newInstance to objects - Btw, shouldn´t I "reset"/reinitialize an object while returning it to the pool?
type: Comment

http://stackoverflow.com/comment/31177675
type: Comment
type: QuestionComment
has text: Do you ever set initialDrawing to true?
comment on: http://stackoverflow.com/q/20796729
score: 0

http://stackoverflow.com/a/20749687
has body: You can use: a1.subList(1, 3).clear(); It has already been discussed here:Why is Java's AbstractList's removeRange() method protected? It might help you to understand better.
downvote count: 0
answers question: http://stackoverflow.com/q/20748848
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/20825627
has answer: http://stackoverflow.com/a/20826090
accepted answer: http://stackoverflow.com/a/20826090
has title: Connect two clients without port forwarding
tagged with: connection
has body: I wonder how to connect two clients over the internet without opening ports on the server side. If this is impossible, how does e.g. Skype establish a connection between the talking people? (Speech goes directly to the clients) Is there a way to use a "master server" where both clients connect to and then getting a direct connection together? Thanks for every answer.
downvote count: 0
type: AnsweredQuestion
tagged with: network-programming
score: 1
tagged with: java
tagged with: multiplayer
type: Question
upvote count: 1
answer count: 1
favorite count: 0
tagged with: port

http://stackoverflow.com/comment/31098782
type: Comment
has text: I'm sorry but I don't know what your variables mean. yourJLabel is the JLabel that is displaying the _ _ _ at the start. userEnteredChar is the character the user entered.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20751632

http://stackoverflow.com/q/20777260
has answer: http://stackoverflow.com/a/20777342
has answer: http://stackoverflow.com/a/20777666
possible better answer: http://stackoverflow.com/a/20777299
has comment: http://stackoverflow.com/comment/31142978
has answer: http://stackoverflow.com/a/20777402
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20777314
has comment: http://stackoverflow.com/comment/31143022
upvote count: 10
downvote count: 1
tagged with: import
score: 9
type: Question
has answer: http://stackoverflow.com/a/20777299
has body: This is a simple question, but I am really bugged by it. I was trying to find a duplicate, and googled it, but I was more surprised when I couldn't find a satisfying answer. import java.util.Scanner; In this statement .Scanner is the class, .util is the name of the package What is java or javax or whatever would stand before the first period in general? UPDATE: I also found this picture: http://www.javatpoint.com/package Is it true?
answer count: 7
has title: Java import statement syntax
has comment: http://stackoverflow.com/comment/31142972
accepted answer: http://stackoverflow.com/a/20777402
favorite count: 0
has answer: http://stackoverflow.com/a/20777311
has answer: http://stackoverflow.com/a/20777338

http://stackoverflow.com/a/20683947
upvote count: 1
answers question: http://stackoverflow.com/q/20683894
has comment: http://stackoverflow.com/comment/30974303
has body: Your calcAveragePrice is returning a List (as the others already mentioned). It also doesn't make any sense though. You create the list at size 0, but then you try to set into the list at an index that wont exist (because the list is empty) and then you return it. This function even if you fix it so it compiles will always throw an IndexOutOfBoundsException unless ind is 0. Most likely you don't want a list at all, if you do want a list you need to use it properly.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/30974427
has comment: http://stackoverflow.com/comment/30974502

http://stackoverflow.com/comment/31091004
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20744459
has text: The newlines are probably there because they were there in the original source. But the source was run through several transformations (unrelated to code page), one which converted control characters to their escape character equivalents, and another which reformatted the code, reinserting the "missing" control characters.

http://stackoverflow.com/q/20836359
has answer: http://stackoverflow.com/a/20837513
has answer: http://stackoverflow.com/a/38957564
tagged with: java
has title: Play video in swing (VLCJ without VLC)
type: Question
upvote count: 4
answer count: 2
tagged with: dll
downvote count: 0
score: 4
tagged with: vlcj
favorite count: 0
has comment: http://stackoverflow.com/comment/31252278
has body: How can I play a video in swing with the library vlcj without having vlc installed? What I have done: 1: Downloaded the vlcj library, vlcj 2.4.1 (zip) and add all to build path: (docs1) 2: Downloaded the libvlc.dll and libvlccore.dll and put them in project folder: (docs2) (docs3) 3: Downloaded a sample video from http:(here video) and put it in project folder: sample_mpeg4.mp43: (docs4) I then created the following class to show the video in swing: public class MediaPlayer extends JPanel { // Declares our media player component private EmbeddedMediaPlayerComponent mediaplayer; // This string holds the media URL path private static String mediapath; private JPanel panel; public MediaPlayer() { String projectPath = System.getProperty("user.dir"); String vlcpath = projectPath; mediapath = projectPath + "\\sample_mpeg42.mp4"; // Check if the .dll is correct File f = new File(vlcpath + "/libvlc.dll"); System.out.println("VLC PATH CORRECT: " + f.exists()); NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), vlcpath); mediaplayer = new EmbeddedMediaPlayerComponent(); panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(mediaplayer, BorderLayout.CENTER); setLayout(new BorderLayout()); add(mediaplayer, BorderLayout.CENTER); } public void play() { mediaplayer.getMediaPlayer().playMedia(mediapath); } public static void main(String[] args) { MediaPlayer mediaplayer = new MediaPlayer(); JFrame ourframe = new JFrame(); ourframe.setContentPane(mediaplayer); ourframe.setSize(720, 560); ourframe.setVisible(true); mediaplayer.play(); ourframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } But getting the error: Exception in thread "main" java.lang.RuntimeException: Failed to load the native library. The error was "Unable to load library 'vlc':... Do I need to have something else/more then the libvlc.dll and libvlccore.dll?
type: UnansweredQuestion
tagged with: swing

gwt
tags question: http://stackoverflow.com/q/20842720
tags question: http://stackoverflow.com/q/20717477
tag name: gwt
tags question: http://stackoverflow.com/q/20682969
tags question: http://stackoverflow.com/q/20719096
type: Tag
tags question: http://stackoverflow.com/q/20831570
tags question: http://stackoverflow.com/q/20680954
tags question: http://stackoverflow.com/q/20817409
tags question: http://stackoverflow.com/q/20836214
tags question: http://stackoverflow.com/q/20768786
tags question: http://stackoverflow.com/q/20729311
tags question: http://stackoverflow.com/q/20774937
tags question: http://stackoverflow.com/q/20737457
tags question: http://stackoverflow.com/q/20685998
tags question: http://stackoverflow.com/q/20844121
tags question: http://stackoverflow.com/q/20815987
tags question: http://stackoverflow.com/q/20698353
tags question: http://stackoverflow.com/q/20703873
tags question: http://stackoverflow.com/q/20709611
tags question: http://stackoverflow.com/q/20837579
tags question: http://stackoverflow.com/q/20747581

http://stackoverflow.com/comment/30973246
score: 0
comment on: http://stackoverflow.com/q/20683260
type: QuestionComment
type: Comment
has text: Why not, you can maka a json out of array and put it in a post param? `new BasicNameValuePair("insertedIDs",new GsonBuilder.create().toJson(mArray));`

http://stackoverflow.com/q/20842959
score: 0
has answer: http://stackoverflow.com/a/20843513
has answer: http://stackoverflow.com/a/21063532
tagged with: config
tagged with: external
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/20843513
has title: Netbeans/java adding external config files
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21063532
tagged with: java
has body: Based on this topic: Netbeans and external configuration files I assume that what I want to do this is possible. But the answer is not really working for me. The code is use know is from the last answer: Copying resources files to build directory... <mkdir dir="${dist.jar.dir}/resources"/> <fileset dir="resources" includes="**"/> But this just creates a dir named: ${dist.jar.dir} with my resources folder and files in it at the same location of my src,dist,build,nbproject folder. But I want it to be in dist, so my dist has, the jar, lib,webfiles and resources. Thanks for any help and clarification.
tagged with: file
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/301283

http://stackoverflow.com/a/20714628
has body: Besides what msknapp said, you can also use @WebListener for the servlet context listener so that you don't have to add the listener to web.xml. Then your listener will look like @WebListener public class SomethingListener implements ServletContextListener { @Inject private final Something something; @Override public void contextInitialized(ServletContextEvent sce) { //put code about something here } }
score: 0
has comment: http://stackoverflow.com/comment/31047424
upvote count: 1
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/31034669
answers question: http://stackoverflow.com/q/20713086
has comment: http://stackoverflow.com/comment/31047360

http://stackoverflow.com/q/20829647
upvote count: 0
has comment: http://stackoverflow.com/comment/31238412
tagged with: java
duplicate of: http://stackoverflow.com/q/20821713
has body: I am trying to split a string twice String example = response; String [] array = example.split("&lt;section&gt;"); System.out.println(array[0]); String [] array2 = example.split("&lt;title&gt;"); System.out.println(array2[2]); I am trying to achieve this by using this code (not successfully), but instead of printing the first split i want to save it and carry on with the 2nd split. whould anyone have a solution to ths problem or better way of going about splitting a string twice? thanks
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/20829720
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/31238343
linked to: http://stackoverflow.com/q/20821713
answer count: 1
downvote count: 1
favorite count: 0
has title: How to split a string twice without an XML parser
has comment: http://stackoverflow.com/comment/31238349
type: UnansweredQuestion

http://stackoverflow.com/comment/30967903
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20680330
score: 4
has text: Are you sure the extra spaces at the start are ignored?

http://stackoverflow.com/q/20760243
tagged with: tcp
tagged with: java
has title: Persistent HTTP connection Java
tagged with: http
type: Question
accepted answer: http://stackoverflow.com/a/20760348
upvote count: 5
answer count: 1
downvote count: 0
has body: I know that when using HttpURLConnection Java tries to reuse the same TCP connection for multiple requests to server unless there is a limitation from server side. Indeed, when I see wireshark log, one of the requestHeaders of HTTP header is Connection: keep-alive. But when server returns data I see a TCP [FIN,ACK] packet being sent back to server from my side. How exactly does this reuse the tcp connection?
tagged with: httpurlconnection
favorite count: 0
has answer: http://stackoverflow.com/a/20760348
score: 5
type: AnsweredQuestion

http://stackoverflow.com/comment/30990948
comment on: http://stackoverflow.com/q/20692174
score: 0
type: Comment
has text: Did you add the sdk to your project?
type: QuestionComment

http://stackoverflow.com/q/20735786
has comment: http://stackoverflow.com/comment/31072144
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/12035215
tagged with: jtable
has body: The problem with my program is that once the "getMP3Tags" method is removed from the main class which is called ""musicManagerUI", and placed within it's own class, the method does not send anything over to the appropriate methods in the "musicManagerUI" class. However, if the "getMP3Tags" method is placed within the "musicManagerUI" class then everything works perfectly. I want to know why this happens and if anyone can help me to resolve this issue, as I don't want to cluster up the "musicManagerUI" class with loads of methods. Here is the constructor for the main class "musicManagerUI": public musicManagerUI() { super ("Music Manager"); initComponents(); handlerClass handler = new handlerClass(); jMenuItem5.addMouseListener(handler); } Here is one the four methods which prints out data to the jTable: public void printArtistName(ArrayList arrayOfArtistNames) { DefaultTableModel model = (DefaultTableModel) jTable2.getModel(); if (arrayOfArtistNames == null) {model.setValueAt("No Artist Names Found", 0, 0);} else { Object [] rowData; rowData = new Object[3]; for (Object x : arrayOfArtistNames) { model.addRow(rowData); model.setValueAt(x, counterArtist, 0); counterArtist++; } } } Here is the code for the mousepressed handler method: public void mousePressed(MouseEvent e) { DefaultTableModel model = (DefaultTableModel) jTable2.getModel(); if (counterArtist == 0){} else if (counterArtist &gt; 0) { model.setRowCount(0); counterArtist = 0; counterTitle = 0; counterAlbum = 0; genre = 0;} String FILE_DIR = "C:\\Users\\Hazzy\\Desktop\\test-data\\"; String FILE_TEXT_EXT = ".mp3"; findCertainExtension fw = new findCertainExtension(); try { fw.getMP3Tags(FILE_DIR); } catch (IOException ex) { System.err.println(" Could Not read file in "); } catch (TagException ex) { System.err.println(" Could Not find tag"); } } And finally the "getMP3Tags" method: public void getMP3Tags( String path ) throws IOException, TagException, try{ File root = new File( path ); File[] list = root.list…
has answer: http://stackoverflow.com/a/20735810
answer count: 1
accepted answer: http://stackoverflow.com/a/20735810
score: 0
tagged with: swing
has title: Method does not load data to jTable when said method is outside of the main GUI class
linked to: http://stackoverflow.com/q/4471187
has comment: http://stackoverflow.com/comment/31069273
type: AnsweredQuestion

http://stackoverflow.com/comment/31247097
has text: @vartika You're welcome. Different frameworks might give different meaning to terms. For example, a Java bean is a simple POJO, but a Spring bean is what I quoted. You just have to know what context you are working in.
type: Comment
comment on: http://stackoverflow.com/a/20834222
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31200611
type: QuestionComment
comment on: http://stackoverflow.com/q/20809502
has text: I suspect the problem is the fact that the `final` keyword on the `System` streams means something different than it does in the entire rest of Java, and it has its own "write-protected" semantics. You may be getting instruction reordering regarding the launching of the thread pool. Try putting in a useless `volatile Object` class variable and calling its `hashCode()` method in between calling `setErr` and initializing your thread pool.
score: 0
type: Comment

http://stackoverflow.com/comment/30972939
comment on: http://stackoverflow.com/a/20683003
type: AnswerComment
has text: There is nothing wrong with the class path as I have added respective jar in my web-Inf/lib.
score: 0
type: Comment

http://stackoverflow.com/q/20782877
answer count: 1
has body: I have done all the installation in order to use smslib. the part that I don't get is what should I do to the smslib.zip that I downloaded? How I can use this library...
type: UnansweredQuestion
tagged with: java
tagged with: smslib
type: Question
has answer: http://stackoverflow.com/a/20783685
score: 0
has title: Do I need to import smslib into eclipse to start using it?
has comment: http://stackoverflow.com/comment/31152446
has comment: http://stackoverflow.com/comment/31201373

http://stackoverflow.com/comment/31066779
type: QuestionComment
comment on: http://stackoverflow.com/q/20734396
has text: Obviously this is not a code problem if it works remotely. You have a network/server config issue.
score: 0
type: Comment

http://stackoverflow.com/a/20783028
has comment: http://stackoverflow.com/comment/31172950
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20782657
has body: The error message indicates that the script, run_time.sh, is missing. I think your script's name should be timer.sh and there is nothing about the content of script. Make sure there is run_timer.sh in current directory. Hope it helps.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20782657
upvote count: 2
has comment: http://stackoverflow.com/comment/31173308

http://stackoverflow.com/a/20810219
has comment: http://stackoverflow.com/comment/31219792
has body: Based on your comment below I modified my example such that it hopefully answers your question. public class TestMain { public static void main(String[] args) throws Exception { MyJFrame myFrameHello = new MyJFrame("Hello", 100, 100); MyJFrame myFrameGoodBye = new MyJFrame("Good Bye", 100, 250); myFrameHello.setVisible(true); myFrameGoodBye.setVisible(true); } private static class MyJFrame extends JFrame { public MyJFrame(String labelStr, int x, int y) { this.labelStr = labelStr; setDefaultCloseOperation(MyJFrame.EXIT_ON_CLOSE); label = new JLabel(" "); getContentPane().add(label, BorderLayout.NORTH); JButton button = new JButton("Click Me"); button.addActionListener(new MyListener()); getContentPane().add(button); setBounds(x, y, 0, 0); pack(); } private JLabel label; private String labelStr; private class MyListener implements ActionListener { public void actionPerformed(ActionEvent e) { label.setText(labelStr); } } } }
type: Answer
answers question: http://stackoverflow.com/q/20808652
accepted answer of: http://stackoverflow.com/q/20808652
has comment: http://stackoverflow.com/comment/31263498
has comment: http://stackoverflow.com/comment/31212479
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31293901
type: AnswerComment
score: 0
type: Comment
has text: Actually, placing this code in to define the doubles and then change a little bit and IT WORKED!! :) Thanks
comment on: http://stackoverflow.com/a/20787040

http://stackoverflow.com/comment/31145895
comment on: http://stackoverflow.com/q/20716551
score: 0
has text: Fiddler2 reveals the actual problem. The java applet trying to connect to ocsp.verisign.com, crl.verisign.com and csc3-2010-crl.verisign.com about 30 times to verify the verisign signature. The signature could not be verified since the machine is working offline to internet. Is there any setting to stop applets from checking certificates when loading from localhost?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20679829
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/30968399
has answer: http://stackoverflow.com/a/20680246
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/20680018
has body: it gets complied and also works for 2 steps after that gives null pointer exception. Q;-> how to allocate memory to multi-dimensional array object on line 48 using vectors or without them ?? import java.util.Scanner; class cpa { Scanner in=new Scanner(System.in); int classes,sec[],n[][]; String name[][][]; float sub1[][][],sub2[][][],per[][][],sectionavg[][],clasavg[],schoolavg; void start() { int choice; System.out.println("Press [1] for creating record\tPress [2] for viewing result\n\t\tPress [3] to exit"); choice=in.nextInt(); if(choice==1) { create(); } else if(choice==2) { view(); } else if(choice==3) { System.out.println("HAVE A NICE TIME..."); } else { System.out.println("INVALID INPUT"); start(); } } void create() { System.out.println("Enter total classes : "); classes=in.nextInt(); clasavg=new float[classes]; for(int i=1;i&lt;=classes;i++) { clasavg[i]=0; System.out.println("HOW MANY SECTIONS FOR "+i+" CLASS"); sec[i]=in.nextInt(); for(int j=1;j&lt;=sec[i];j++) { sectionavg[i][j]=0; System.out.println("ENTER NO OF STUDENT FOR SECTION "+j+" :"); n[i][j]=in.nextInt(); cpa shivalik[][][]=new cpa[classes][sec[i]][n[i][j]];//multi-dimensional OBJECT for(int k=1;k&lt;=n[i][j];k++) { shivalik[i][j][k]= new cpa(); shivalik[i][j][k].getinfo(i,j,k); sectionavg[i][j]+=shivalik[i][j][k].per(i,j,k); } clasavg[i]+=sectionavg[i][j]; } schoolavg+=clasavg[i]; } start(); } float sectionavg(int i,int j){return sectionavg[i][j]/n[i][j];} float clasavg(int i){return clasavg[i]/sec[i];} float schoolavg(){return schoolavg/classes;} void view() { int choice,clasnum,secnum,roll; System.out.println("[1]-&gt; SCHOOL PERFORMANCE\t[2]-&gt; CLASS PERFORMANCE\n[3]SECTION PERFORMANCE\t[4]STUDENT PERFORMANCE\n\t\t[5]EXIT"); choice=in.nextInt(); switch(choice) { case 1:System.out.println("YOUR SCHOOL PERFORMANCE ACCORDING TO RECORDS IS "+schoolavg()+" %");view(); case 2:System.out.println("ENTER THE CLASS NUMBER WHOSE PERFORMANCE YOU WANT TO VIEW :"); clasnum=in.nextInt(); System.out.printl…
answer count: 2
has comment: http://stackoverflow.com/comment/30967195
has title: multidimensional array object memory location
tagged with: arrays
score: 0
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/30967861

http://stackoverflow.com/comment/31084561
type: Comment
comment on: http://stackoverflow.com/a/20744596
score: 0
type: AnswerComment
has text: You are right. Most of its methods are deprecated. But some frameworks still uses it like java Timer.

http://stackoverflow.com/comment/31040156
has text: http://en.wikipedia.org/wiki/Hashtable#Separate_chaining
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20720187

http://stackoverflow.com/comment/31148899
has text: Post link to your image.
comment on: http://stackoverflow.com/q/20780437
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31167315
has text: Thanks, my mistake started with raising the power of two directly with the bits turned on..yours and others here explained well,
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20790933
type: Comment

http://stackoverflow.com/a/20729134
score: 0
type: Answer
has body: You need to add the required Jar files into the classpath
answers question: http://stackoverflow.com/q/20729005

http://stackoverflow.com/a/20756380
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: When you call set.iterator() you create new iterator, that refer on first element. Thus iter.next() return first element every time. Iterator&lt;String&gt; iter = set.iterator() ; void load(){ for(int i = 0 ; i&lt;set.size();i++){ System.out.println("Book"+(i+1)+"\n"); //Iterator&lt;String&gt; iter = set.iterator() ; Books b = hashmap.get(iter.next()); System.out.println(b.toString()); } }
answers question: http://stackoverflow.com/q/20756343

websphere-7
tags question: http://stackoverflow.com/q/20794862
type: Tag
tags question: http://stackoverflow.com/q/20803519
tags question: http://stackoverflow.com/q/20720303
tags question: http://stackoverflow.com/q/20844130
tag name: websphere-7

http://stackoverflow.com/a/20700358
has body: did you set the content-type to application/xml instead of the default application/x-www-form-urlencoded ? or, do you have another endpoint in your application with the following URL Template: x.x.x.x/api/interface/{param} which also consumes PUT requests but does not accept application/xml content type ? (I'm not sure which resource method would be selected by the JAX-RS implementation, though)
answers question: http://stackoverflow.com/q/20699128
has comment: http://stackoverflow.com/comment/31025245
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31004620

http://stackoverflow.com/a/20715927
score: 1
has body: It depends on your use pattern as to where you want to take the performance hit. If you're going to be doing a lot of comparisons after creating an object and you know you have a high occurrence of duplicates, then the flyweight pattern may make sense as all your post-creation comparisons can be done via reference equality. The other thing to consider is space efficiency; you mention they're large objects. What's more important? If you're saving a ton of memory by pooling objects, that may be a win. Profiling your code trying both approaches can also help you make that decision. Edit to add: That said I'm surprised their interner is relying solely on equals(). In my head it would make much more sense to rely on hashcode() and only use equals() for collisions.
has comment: http://stackoverflow.com/comment/31033124
has comment: http://stackoverflow.com/comment/31033053
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20715854

http://stackoverflow.com/comment/30991621
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20685907
has text: I added a breakpoint at Toast.makeText(getApplicationContext(), "Item Clicked", and it is never reached when clicking anything in the drawerLayout http://pastebin.com/BviCdg1i

http://stackoverflow.com/comment/31001833
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20699106
type: Comment
has text: If you choose the first solution, then the URL in the RequestMapping should also be /student.htm. And you also need a `/WEB-INF/jsp/student.jsp` file.

http://stackoverflow.com/comment/55949010
type: AnswerComment
comment on: http://stackoverflow.com/a/30053139
type: Comment
has text: This method doesn't work for me, for some reason. It tries to pass the empty object as the "login: [Object object]" header and the passcode is my function.
score: 0

http://stackoverflow.com/comment/31149925
type: Comment
comment on: http://stackoverflow.com/q/20781234
score: 0
has text: I think the code is fine. You won't be able to test it until midnight (or unless you change the time on your system). According to the documentation, "At midnight, on March 8th, 2002, /foo/bar.log will be copied to /foo/bar.log.2002-03-08."
type: QuestionComment

http://stackoverflow.com/a/20802748
score: 0
has body: The straightforward solution is to implement custom Jackson JSON serializer that will get field names that should be serialized from thread local storage and then serialize only fields which names are presented in that context. For other hand, in controller you can grab all allowed fields names from url and store them into thread local context. Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/20802032
has comment: http://stackoverflow.com/comment/31208853

http://stackoverflow.com/q/20849168
has title: How to detect if a click has happened inside a box
has body: I'm trying to make a box move around with my mouse when I click it, then when I right click it stops following my mouse Code: boolean inBounds(int mouseX, int mouseY) { if (mouseX &lt;= x &amp;&amp; mouseX &gt;= x + width &amp;&amp; mouseY &lt;= y &amp;&amp; mouseY &gt;= y + height) return true; else return false; } private List&lt;Box&gt; shapes = new ArrayList&lt;Box&gt;(60); for (Box shape : shapes) { if (Mouse.isButtonDown(0) &amp;&amp; shape.inBounds(Mouse.getX() - WINDOW_WIDTH, Mouse.getY() - WINDOW_HEIGHT) &amp;&amp; !selected) { selected = true; shape.selected = true; System.out.println("CLicked meh"); } if (Mouse.isButtonDown(1)) { shape.selected = false; selected = false; } if (shape.selected) { shape.Update(Mouse.getDX(), -Mouse.getDY()); } shape.Draw(); } Everything works fine, except when I click nothing happens; no boxes moved. If I replace if (Mouse.isButtonDown(0) &amp;&amp; shape.inBounds(Mouse.getX() - WINDOW_WIDTH, Mouse.getY() - WINDOW_HEIGHT) &amp;&amp; !selected) { selected = true; shape.selected = true; System.out.println("CLicked meh"); } with this if (Mouse.isButtonDown(0) &amp;&amp; **!shape.inBounds(Mouse.getX()** - WINDOW_WIDTH, Mouse.getY() - WINDOW_HEIGHT) &amp;&amp; !selected) { selected = true; shape.selected = true; System.out.println("CLicked meh"); } (Asterisks so you can see changes) I can only move one square, and not even while clicking on it, clicking anywhere moves it. Thanks in advance.
favorite count: 0
accepted answer: http://stackoverflow.com/a/20850833
has comment: http://stackoverflow.com/comment/31288135
type: AnsweredQuestion
tagged with: lwjgl
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20850833
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31274811
answer count: 1
downvote count: 0

http://stackoverflow.com/q/20733251
tagged with: jbutton
type: Question
tagged with: java
has title: Java set buttons names automatically
score: 0
has body: I'm new in Java swing, and I have a problem. I made for-loop for creating buttons and now I want automatically give them names or some kind of marks for future recognition (I will need name of clicked button to make it a variable). How can I give them names in my loop? Thank you. Here is code of my for-loop: for (int aa=1; aa&lt;65; aa++) { JButton button = new SquareButton(""); gui.add(button); button.addActionListener((ActionListener) button); }
has comment: http://stackoverflow.com/comment/31064361
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31066507
has answer: http://stackoverflow.com/a/20733307
tagged with: swing

http://stackoverflow.com/q/20719196
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has body: if a class is defined like public class A implements java.io.Serializable { Example a; Test b; Another c; } while retrieving the state,in which order will it be retrieved? A's object? a? b? c?
answer count: 3
has answer: http://stackoverflow.com/a/20719335
favorite count: 0
tagged with: serialization
possible better answer: http://stackoverflow.com/a/20733049
has answer: http://stackoverflow.com/a/20733049
has title: In Java Serialization if a class has multiple objects (composition) then in what order the state will be retrieved?
upvote count: 1
accepted answer: http://stackoverflow.com/a/20719335
has answer: http://stackoverflow.com/a/20719282

http://stackoverflow.com/comment/30985775
comment on: http://stackoverflow.com/q/20689672
type: Comment
type: QuestionComment
has text: use **List<Character>[][] matrix = new List[N][N];** if you know the size of list in advance then you can use **char matrix[N][N][]**
score: 0

http://stackoverflow.com/comment/31066705
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20734375
has text: What do you mean? A class doesn't have a return type. A method has a return type.

http://stackoverflow.com/a/20797665
type: Answer
has body: They do exactly what they do inside if. Assuming a and b are both of type boolean: a | b is true iff a or b is true (or both). a &amp; b is true iff a and b are both true. !a is true iff a is false. I suspect what's confusing you is the notion that expressions of type boolean can be treated as values just like int and float. There's nothing magical happening here, though. boolean is a type just like int and float. You can have boolean variables, boolean parameters, boolean fields and functions that return boolean. Also note that, with boolean arguments, you are more likely to encounter || and &amp;&amp; than | and &amp;. They are roughly the same, but exhibit short-circuit behaviour. For example, when evaluating the expression f() || g(), if f() returns true, the whole expression will evaluate to true and g() won't even be called since it won't affect the answer. This is faster if g() is slow, but also changes the meaning of the program if g() would have had side effects (like changing global state or printing to the console). In contrast, f() | g() evaluates g() no matter what f() returns.
upvote count: 4
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20797633
score: 4
answers question: http://stackoverflow.com/q/20797633

filewriter
tags question: http://stackoverflow.com/q/20782194
tag name: filewriter
tags question: http://stackoverflow.com/q/20825896
type: Tag

http://stackoverflow.com/comment/31122856
has text: you mean this : while(i < 10000) {int temp = 1; i++;} gets more memory than : int temp; while(i < 10000) {temp = 1, i++} both running on main ? (c++ and java ?)
comment on: http://stackoverflow.com/a/20765924
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20788363
answers question: http://stackoverflow.com/q/20786908
downvote count: 1
upvote count: 4
score: 3
type: Answer
has body: I would recommend one of these two approaches: Make two different images, one with border, one without - for each image that needs this hovering functionality; this is the way button images are usually implemented - separate image for normal, pressed, hovering or whatever If you have a lot of different but same sized images (or "blocks" as you put it) that need this border, it is less work and less memory if you implement a single "border texture", and render it along with the original texture of your "block" when the mouse hovers over it This is my personal opinion, but I never liked shape rendering in libgdx. I forgot how to use the shape renderer, but if you need to set the projection matrix like in nedR's answer, the way that I described would also be faster.

http://stackoverflow.com/comment/31081525
comment on: http://stackoverflow.com/a/20739019
score: 0
type: Comment
has text: @Gimby, yes, that's a very good option for performance benefit
type: AnswerComment

http://stackoverflow.com/q/20722406
tagged with: ssl-certificate
has title: SSL Cerficate - No subject alternative names present
tagged with: cas
favorite count: 0
has body: I am try to generate self sign SSL certificate but get following error in cas sso: java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present I am using open jdk 7 and used following commands: keytool -genkey -alias axyz -keypass changeit -keyalg RSA -ext san=ip:192.168.1.4 keytool -export -alias axyz -keypass changeit -file axyz.crt keytool -import -file axyz.crt -alias axyz -keystore /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/cacerts HostName: vaapdev internal ip address: 192.168.1.4 Public IP address: 108.51.62.36 Not sure where I am going wrong, I tried both 192.168.1.4 and 108.51.62.36 in -ext Tried without -ext parameter.
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20723420
tagged with: ssl
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/52643396

http://stackoverflow.com/comment/31197068
type: AnswerComment
comment on: http://stackoverflow.com/a/20807642
score: 0
has text: plase see my second pic for a copy paste result of your first answer
type: Comment

http://stackoverflow.com/a/20707927
has comment: http://stackoverflow.com/comment/31018024
has body: never mind! I got it working again by removing one of the jars. The thing is, I had them both in there and it was working just fine before :P Mysterious
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20707524
type: Answer
answers question: http://stackoverflow.com/q/20707524

http://stackoverflow.com/comment/33526786
type: AnswerComment
type: Comment
has text: You can either summarize the steps or copy them all. I checked the link and without the images, it doesn't seem very long so you could copy everything.
comment on: http://stackoverflow.com/a/22101798
score: 0

http://stackoverflow.com/q/20847711
answer count: 3
has answer: http://stackoverflow.com/a/20848249
tagged with: serialization
has comment: http://stackoverflow.com/comment/31284975
has answer: http://stackoverflow.com/a/20847841
has comment: http://stackoverflow.com/comment/31275038
upvote count: 1
tagged with: swing
has title: Gui and Serializable Errors
downvote count: 1
has comment: http://stackoverflow.com/comment/31285120
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20855457
accepted answer: http://stackoverflow.com/a/20855457
tagged with: java
has body: Ok,so I need to write a program which creates profiles (simple ones with just a name, photo, status etc.) and it adds friends which exist. It saves the profiles in a file using ObjectOutputStream. Now the problems I am facing so far are: I am getting Serializable Errors and I don't know where they are coming from. Errors that the project gives java.io.NotSerializableException: SocialNetwork at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) The code is about 250 lines so I am gonna add 3 comments with the error description where they are happening. Ctrl + F (Error Here Guys) is the word import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.border.LineBorder; import java.io.*; import java.util.ArrayList; public class SocialNetwork implements Serializable { /** * */ private static final long serialVersionUID = 904698037930887085L; RandomAccessFile raf ; JTextField setStatus ; JTextField addFriend ; JTextField emriProfilit ; JButton changestatus ; JButton setfriend ; JButton changepicture ; JButton add ; JButton delete ; JButton lookup ; JLabel name ; JLabel password ; JPasswordField passwordfield ; JLabel Banner ; SocialProfile profile ; SocialProfile temp ; JLabel profilepicture ; FileOutputStream fileoutput; FileInputStream fileinput ; ObjectOutputStream output; ObjectInputStream input; public SocialNetwork() throws FileNotFoundException{ fileoutput = new FileOutputStream("database.dat",true); fileinput = new FileInputStream("database.dat"); emriProfilit = new JTextField(15); name = new JLabel("Name"); password = new JLabel("Password"); passwordfield = new JPasswordField (7); lookup = new JButton("Lookup"); add = new JButton("Add"); delete = new JButton("Delete"); JPanel p1 = new JPanel() ; p1.setLayout(new FlowLayout()); p1.add(name); p1…
type: Question
possible better answer: http://stackoverflow.com/a/20847841
has comment: http://stackoverflow.com/comment/31271978
tagged with: serializable
favorite count: 0
score: 0

http://stackoverflow.com/q/20725088
possible better answer: http://stackoverflow.com/a/20725108
has answer: http://stackoverflow.com/a/20725109
has answer: http://stackoverflow.com/a/20725108
type: Question
has body: I am trying to figure out whether it is a better idea to keep String Constants as static value or in a properties file. If i keep in properties file, will it be costly to read always from properties file. What will be better in-terms of performance.
has title: Is it better to keep String constant in properties file or as static value
upvote count: 2
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/20725107
has comment: http://stackoverflow.com/comment/31049779
accepted answer: http://stackoverflow.com/a/20725107
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
favorite count: 0

http://stackoverflow.com/q/20731033
has body: I'm new to java rmi and I have issues with synchronization. The server handles a small data base throw files (7 files,each one represents an university), the client when connected gives the name of the university then chooses an option : add a student remove a student update a student search for a student Everything works fine, but I have a problem with synchronization.It doesn't work the way I expected. Say we have 3 files, I created 3 private static Integers to use like this public class CarnetImpl extends UnicastRemoteObject implements Carnet { private String fac; private static Integer univ1=1; private static Integer univ2=1; private static Integer univ3=1; CarnetImpl(String fac) throws RemoteException { this.fac=fac; } public void add(Student e) throws RemoteException { Integer lock=1 switch (fac){ case "univ1": lock=univ1; break; case "univ2": lock=univ2; break; case "univ3": lock=univ3; break; } synchronized(lock){ //creating a file named "fac.txt" (fac can be univ1,2 or3) and adding a student } } } I did the same thing for the other methods. What I expected is that for a given university only one client can use a method,while more than one client can use the same method for different universities at the same time. But after testing it seems that even for different universities a client have to wait for an other to finish to use the method. Example : Client 1 asks the server to add student1 to univ1 (i added a 5' sleep and a println to detect threads behavior ). Before the end of the 5 seconds client 2 asks the server to add(or any other method) student2 to univ2. As client2 asked an add on univ2,I expected that lock will take univ2 so the thread wouldn't wait because univ2 is not locked unlike univ1. Can anyone help me understand ? Any suggestions to get the expected behavior would be most welcome. Thanks.
tagged with: synchronization
tagged with: multithreading
upvote count: 1
accepted answer: http://stackoverflow.com/a/20731122
answer count: 1
tagged with: rmi
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Java RMI- unexpected behavior of threads
favorite count: 0
has answer: http://stackoverflow.com/a/20731122
type: Question

http://stackoverflow.com/comment/31255128
has text: There ARE ways of doing this, but I seriously believe you won't be able to make any Java-based method outperform the VLOOKUP function.
comment on: http://stackoverflow.com/q/20838937
score: 0
type: Comment
type: QuestionComment

awt
tags question: http://stackoverflow.com/q/20722194
tags question: http://stackoverflow.com/q/20758250
tags question: http://stackoverflow.com/q/20799131
tags question: http://stackoverflow.com/q/20681443
tag name: awt
tags question: http://stackoverflow.com/q/20792947
tags question: http://stackoverflow.com/q/20833853
tags question: http://stackoverflow.com/q/20716424
tags question: http://stackoverflow.com/q/20832296
tags question: http://stackoverflow.com/q/20718462
tags question: http://stackoverflow.com/q/20737294
tags question: http://stackoverflow.com/q/20792285
tags question: http://stackoverflow.com/q/20770045
tags question: http://stackoverflow.com/q/20720483
tags question: http://stackoverflow.com/q/20746050
tags question: http://stackoverflow.com/q/20842291
tags question: http://stackoverflow.com/q/20814004
tags question: http://stackoverflow.com/q/20831931
tags question: http://stackoverflow.com/q/20775287
tags question: http://stackoverflow.com/q/20781549
tags question: http://stackoverflow.com/q/20844144
tags question: http://stackoverflow.com/q/20712672
tags question: http://stackoverflow.com/q/20759270
tags question: http://stackoverflow.com/q/20753873
tags question: http://stackoverflow.com/q/20800991
tags question: http://stackoverflow.com/q/20774928
tags question: http://stackoverflow.com/q/20799710
tags question: http://stackoverflow.com/q/20805129
type: Tag
tags question: http://stackoverflow.com/q/20748173
tags question: http://stackoverflow.com/q/20840709
tags question: http://stackoverflow.com/q/20772114
tags question: http://stackoverflow.com/q/20709061
tags question: http://stackoverflow.com/q/20721205
tags question: http://stackoverflow.com/q/20693046

http://stackoverflow.com/comment/31047905
has text: @PM77-1: you're saying nonsense.
score: 1
comment on: http://stackoverflow.com/q/20724247
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20807131
upvote count: 51
has comment: http://stackoverflow.com/comment/109644820
has body: I am trying to check to see if a view is displayed with Espresso. Here is some pseudo code to show what I am trying: if (!Espresso.onView(withId(R.id.someID)).check(doesNotExist()){ // then do something } else { // do nothing, or what have you } But my problem is .check(doesNotExist()) does not return boolean. It is just an assertion. With UiAutomator I was able to just do something like so: if (UiAutomator.getbyId(SomeId).exists()){ ..... }
tagged with: java
has answer: http://stackoverflow.com/a/57968305
has answer: http://stackoverflow.com/a/39276621
has answer: http://stackoverflow.com/a/56257503
has answer: http://stackoverflow.com/a/20811193
type: Question
has title: Espresso: return boolean if view exists
answer count: 8
has answer: http://stackoverflow.com/a/39436238
linked to: http://stackoverflow.com/q/29250506
has answer: http://stackoverflow.com/a/54439258
tagged with: android-testing
favorite count: 0
possible better answer: http://stackoverflow.com/a/39436238
score: 51
tagged with: android
downvote count: 0
has answer: http://stackoverflow.com/a/42988281
tagged with: android-espresso
has answer: http://stackoverflow.com/a/22358865
accepted answer: http://stackoverflow.com/a/20811193
type: AnsweredQuestion

http://stackoverflow.com/comment/31063635
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20730946
score: 1
has text: there are two wrong things, 1. you shouldn't be use NullLayout, 2. have to set LayoutManager to JLabel (primary issue)

http://stackoverflow.com/a/20823069
accepted answer of: http://stackoverflow.com/q/20822987
has comment: http://stackoverflow.com/comment/31226975
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31225911
has comment: http://stackoverflow.com/comment/31226648
downvote count: 0
has comment: http://stackoverflow.com/comment/31226681
has comment: http://stackoverflow.com/comment/31226062
type: Answer
has comment: http://stackoverflow.com/comment/31226172
has body: Your problem is not related to Spring MVC. ${message} is EL (Expression Language). It's a part of Java EE (and a former part of the JSP specification). It does not work on your page for some reason. Try to replace the beginning of your web.xml with the following: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
score: 9
has comment: http://stackoverflow.com/comment/31225985
upvote count: 9
answers question: http://stackoverflow.com/q/20822987
has comment: http://stackoverflow.com/comment/31226078

http://stackoverflow.com/comment/30973954
type: Comment
score: 0
has text: if I add the jar then there are no errors. If I remove the jar then there are errors.
type: AnswerComment
comment on: http://stackoverflow.com/a/20682929

http://stackoverflow.com/a/20807642
type: Answer
accepted answer of: http://stackoverflow.com/q/20807582
answers question: http://stackoverflow.com/q/20807582
has body: If you have to use a RelativeLayout here your solution: <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:gravity="center" android:text="TextView" /> You can also use a LinearLayout if you want: <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:text="TextView" />
has comment: http://stackoverflow.com/comment/31197068
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31217581
type: QuestionComment
has text: Well, your method `getUser()` returns an `ArrayList` . I'd call it `getUsers`
comment on: http://stackoverflow.com/q/20818552
score: 0
type: Comment

jakarta-mail
tags question: http://stackoverflow.com/q/20786375
tags question: http://stackoverflow.com/q/20842190
tags question: http://stackoverflow.com/q/20777194
tag name: jakarta-mail
tags question: http://stackoverflow.com/q/20780495
tags question: http://stackoverflow.com/q/20759424
type: Tag
tags question: http://stackoverflow.com/q/20766044
tags question: http://stackoverflow.com/q/20808653
tags question: http://stackoverflow.com/q/20758032
tags question: http://stackoverflow.com/q/20785818
tags question: http://stackoverflow.com/q/20763675
tags question: http://stackoverflow.com/q/20789418
tags question: http://stackoverflow.com/q/20826948
tags question: http://stackoverflow.com/q/20733913

http://stackoverflow.com/comment/31156681
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20785332
has text: are you using this code in Activity?
score: 0

http://stackoverflow.com/comment/31043376
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20721338
type: AnswerComment
has text: You might want to look into `RandomAccessFile`. It's a bit more complex, but if you learn to use it, it can be helpful for situations like this

http://stackoverflow.com/comment/31045432
comment on: http://stackoverflow.com/a/20703470
score: 2
type: AnswerComment
has text: Actually, the GridPane is annoted with @FXML which means it's created by the FXMLLoader. The way to resolve this would be to make sure the FXML file has a GridPane component with a fx:id set to "grid". There's also the possibility that the Grid does not have the sufficient amount of rows and columns but I'm not sure if that would throw a NPE
type: Comment

http://stackoverflow.com/q/20705826
has answer: http://stackoverflow.com/a/20705923
score: -3
favorite count: 0
has comment: http://stackoverflow.com/comment/31013630
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31013640
answer count: 1
has comment: http://stackoverflow.com/comment/31013635
type: UnansweredQuestion
has title: After calling a method, I'm getting a null value for my array list
upvote count: 1
has body: showMainMenu(); mainChoice = input.nextInt(); switch(mainChoice){ case 1 : showConcertCategories(); concertCategories = input.nextInt(); switch(concertCategories){ case 1 : showMusical(); musical = input.nextInt(); switch(musical){ case 1 : showMyFairLady(); myFairLady = input.nextInt(); switch(myFairLady){ case 1 : System.out.print("Please input number of tickets:"); title = "MY FAIR LADY"; date = "20/01/08"; tickets = input.nextInt(); totalPrice = 90 * tickets; System.out.println("\nBooking Information &lt;All concerts begin at 8pm&gt;"); System.out.println("-----------------------------------------------"); System.out.println("Concert: MY FAIR LADY"); System.out.println("Length: 135 minutes"); System.out.println("Date: 20/01/08"); System.out.println("Number of tickets: "+tickets); System.out.println("Price per ticket: $90.00"); System.out.println("Total: $"+fmt.format(totalPrice)); System.out.println("-----------------------------------------------"); System.out.println("&lt;1&gt;Confirm"); System.out.println("&lt;2&gt;Redo"); System.out.print("Please select your choice&lt;1-2&gt;:"); confirmRedo = input.nextInt(); switch(confirmRedo){ case 1 : System.out.println("\n************************************"); System.out.println("* Your ticket(s) is/are confirmed. *"); System.out.println("************************************"); confirmation[0]=""+title; confirmation[1]=""+date; confirmation[2]=""+tickets; confirmation[3]=""+totalPrice; break; case 2 : showRedo(); break; default: System.out.println("\nPlease select a valid choice."); } } break; default: System.out.println("\nPlease select a valid choice."); } break; case 2 : showClassical(); break; case 3 : showPopMusic(); break; case 4 : break; default: System.out.println("\nPlease select a valid choice."); } break; case 2 : System.out.println("\nThank you for using this service.\n"); System.out.println("Concert Date Tickets Total(S$)"); System.out.println("----------- -------- --------- -----------"); System.out.prin…
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/31016627
type: Question
downvote count: 4
has comment: http://stackoverflow.com/comment/31013632
tagged with: arrays

http://stackoverflow.com/comment/31044763
comment on: http://stackoverflow.com/a/20722665
type: Comment
has text: Ah ok so i can do it with handler and assign a thread to the part of code that makes the .call right?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31088192
comment on: http://stackoverflow.com/q/20746439
type: Comment
has text: http://docs.jboss.org/hibernate/core/4.0/devguide/en-US/html/ch05.html
score: 1
type: QuestionComment

http://stackoverflow.com/comment/31178147
comment on: http://stackoverflow.com/q/20796882
score: 0
has text: Take a look at Spel http://docs.spring.io/spring/docs/3.0.x/reference/expressions.html you can try some regex on the properies.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20758049
has answer: http://stackoverflow.com/a/47523780
answer count: 4
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has title: Difference between an Enterprise application project and a Web project application in Netbeans IDE
tagged with: jakarta-ee
has body: Please I would like to know the major difference between a Jave EE project and a Java Web project in netbeans IDE with respect to the EJB. In fact you can create a web application based on EJB, JPA and JavaServer Faces in Netbeans IDE if you choose the Java Web category. On the other hand you choose the project category as Jave EE project, NetBeans IDE will create 3 sub-projects, e.g: StoreApp (Enterprise Application project), StoreApp-ejb (EJB project), and StoreApp-war (Web project).
score: 3
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/936197
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/20758146
has answer: http://stackoverflow.com/a/27642148
has answer: http://stackoverflow.com/a/20758138
tagged with: jpa
upvote count: 3

http://stackoverflow.com/comment/31204920
type: AnswerComment
comment on: http://stackoverflow.com/a/20811769
type: Comment
has text: @sush pls post it below the op.
score: 0

http://stackoverflow.com/comment/31182239
comment on: http://stackoverflow.com/a/20799477
has text: Why would I say "not suggested due to efficiency reasons"? I absolutely suggest option (1).
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/20841669
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: In your on create method, you need to initialize your sqLiteAdapter (mSQLiteAdapter is a more proper name) . It will be something like:sqLiteAdapter = new SQLiteAdapter(this); If you don't initialize it, you are just calling a null object which throws an exception even though it is defined as that object. Hope that helps
accepted answer of: http://stackoverflow.com/q/20841520
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20841520

http://stackoverflow.com/comment/30998224
type: AnswerComment
score: 0
type: Comment
has text: `StringBuilder` takes strings and jams the together. At the beginning, the `StringBuilder` is empty. After you append `hey`, `StringBuilder` contains `hey`. After you append `\n`, `StringBuilder` contains `hey\n`. `sb.toString` turns the `StringBuilder` into a `String`
comment on: http://stackoverflow.com/a/20696794

http://stackoverflow.com/q/20723797
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I am working on a project in which I am supposed to make a client and the role of that client is to construct a url basis on input passed and make a REST call on the right server. And they can do it in two ways, either making a synchronous call or making an asynchronous call. So now I am not sure what is the right way to do this? Should I make an interface for this with two methods synchronous and asynchronous method and a class that will implement this Interface or should I just make a simple class with these with these two methods inside that? What is the better approach?
tagged with: interface
has title: Synchronous and Asynchronous method in an Interface vs in a Class?
tagged with: asynchronous
type: UnansweredQuestion
upvote count: 1
tagged with: synchronous
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20723947

http://stackoverflow.com/comment/31208359
type: QuestionComment
has text: You should use the debugger to help you debug this...
score: 1
comment on: http://stackoverflow.com/q/20813710
type: Comment

http://stackoverflow.com/q/20829228
has comment: http://stackoverflow.com/comment/56696452
possible better answer: http://stackoverflow.com/a/34472233
has body: I just fail to understand why must one use Runtime.addShutdownHook. If you want to do some cleanup when the jvm exits, why not just overload the finalize method of the daemon class. What is the advantage of using shutdown hook over finalize method. Also there is a deprecated function runFinalizersOnExit. If I set it to false, I believe finalizers won't run. This contradicts the java guarantee that finalizers always run before garbage collections.
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20829327
favorite count: 0
has answer: http://stackoverflow.com/a/34472233
upvote count: 14
tagged with: finalizer
tagged with: shutdown-hook
tagged with: multithreading
score: 14
type: AnsweredQuestion
tagged with: java
has title: shutdown hook vs finalizer method
accepted answer: http://stackoverflow.com/a/20829327

http://stackoverflow.com/comment/31089156
score: 0
type: AnswerComment
type: Comment
has text: @Mohit you could use generics so Arrays.toString() will recieve String[]
comment on: http://stackoverflow.com/a/20732399

http://stackoverflow.com/a/20829048
score: 1
has body: "newStudents" is just an Student instance. Iterate the list and write each item. (list name should begin with a simple letter btw). Also you are adding just one Student to the list. for (Student student: students) { pw.println(student); } You can override toString() of student to get a meaningful string representation.
answers question: http://stackoverflow.com/q/20829001
upvote count: 1
has comment: http://stackoverflow.com/comment/31237797
type: Answer
downvote count: 0

http://stackoverflow.com/a/24454215
score: 0
type: Answer
has body: I found the response for this problem. I just have to verify this: if (obj._is_a("IDL:transaction/ManageDemand:1.0")){ .. } else if (obj._is_a("IDL:transaction/CreateAccount:1.0")){ .. } – Saad Lamarti Dec 19 '13 at 12:48
answers question: http://stackoverflow.com/q/20681909

http://stackoverflow.com/comment/31125778
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20767480
has text: what error you get, can you be more clear please

http://stackoverflow.com/q/20831978
tagged with: java
has comment: http://stackoverflow.com/comment/31243389
has comment: http://stackoverflow.com/comment/31243209
has comment: http://stackoverflow.com/comment/31243284
has title: Why am I able to store a bigger value in Long than allowed? java
has answer: http://stackoverflow.com/a/20831982
type: Question
answer count: 2
tagged with: long-integer
duplicate of: http://stackoverflow.com/q/7093186
has comment: http://stackoverflow.com/comment/31243019
linked to: http://stackoverflow.com/q/7093186
has comment: http://stackoverflow.com/comment/31243250
has comment: http://stackoverflow.com/comment/31243174
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/31243350
has answer: http://stackoverflow.com/a/20832266
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/31243404
upvote count: 4
tagged with: primes
has body: I'm writing a program for encryption, for fun. I ran across something odd, and I'd like some input! Examine this code: private static final String primeNumber = "32416190071"; private String stringKey = ""; private String hexKey = ""; private long longKey; public void example(){ stringKey = primeNumber; longKey = Long.parseLong(primeNumber); } now, if i put longKey = 32416190071;, i get an error stating that i cant put that big of a number in a long. what am I doing wrong, or what is going on? Thanks! Food for thought -_-
score: 2
has comment: http://stackoverflow.com/comment/31243372
linked to: http://stackoverflow.com/q/3757763

http://stackoverflow.com/q/20742350
tagged with: android
score: 2
type: AnsweredQuestion
has title: How can I get events for all NFC types?
upvote count: 2
has comment: http://stackoverflow.com/comment/31081632
type: Question
has answer: http://stackoverflow.com/a/20745685
has body: I currently have an app where the user has to log in to use it. In the near future we might support an NFC chip to log in without entering a username and password. I have absolutely no idea scanning an NFC chip works so I looked up some tutorials and found this one. I copied the code from the tutorial and I think I understand how it works. The problem is that it does not work for the card I have to test with (the onNewIntent method is not called, as opposed to what the tutorial is telling me). The card works (other apps pick it up just fine), so I guess the problem is that it is a different type than the one used in the tutorial. So I changed the xml mentioned in the tutorial into the following: <?xml version="1.0" encoding="utf-8"?> android.nfc.tech.Ndef android.nfc.tech.IsoDep android.nfc.tech.NfcA android.nfc.tech.NfcB android.nfc.tech.NfcF android.nfc.tech.NfcV android.nfc.tech.Ndef android.nfc.tech.NdefFormatable android.nfc.tech.MifareClassic android.nfc.tech.MifareUltralight This is my manifest file: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.NFC" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> <meta-data android:name="android.nfc.action.NDEF_DISCOVERED" android:resource="@xml/nfc_tech_filter" /> I assumed this would scan not only for the Ndef type of chip, but also for all the others. But my app still does not respond when I hold the card to the phone. These are the card details I retrieved by using an NFC scanner app: RF Technology: Type A (ISO/IEC 14443 TYPE A) Tag Type: Mifare Classic 1K ATQA: 0004 SAK: 08 Target technology classes (Android): android.nfc.tech.MifareClassic, andro…
tagged with: java
has comment: http://stackoverflow.com/comment/31081815
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/20745685
favorite count: 0
tagged with: nfc

http://stackoverflow.com/q/20806407
has comment: http://stackoverflow.com/comment/31211149
has title: Hibernate/JPA Auto-Updating my entity master-detail
has comment: http://stackoverflow.com/comment/31211538
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/31194983
type: Question
tagged with: jsf
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31194893
has comment: http://stackoverflow.com/comment/31201479
has comment: http://stackoverflow.com/comment/31194847
tagged with: jpa
has body: I have a relationship @OneToMany with Car --> Tools. Tools are previously registered in System, after they're used in Cars. I have the following code: public void addToolToCar(ActionEvent event){ if (car == null) car = new Car(); Tool tool = findToolByNumer('1234'); tool.setSituation('PUTTED'); car.addTool(tool); /* After adding the first Tool object to Car, everything is fine, but when i try to find the Tool '667', the Hibernate UPDATE in PostgreSQL the Tool '1234'. The BIG problem is that user can choose don't click in "save button" and the Car will not inserted (this is complete normally and often, as a CANCEL action) but the Tool situation was changed, this is a problem for my bussiness rule because when Tool is in "PUTTED" situation, this Tool cannot be used for another Car. And have a wrost situation, the Tool can be removed from the Car list, like: 'car.removeTool('1234'), but as Tool was changed in Database i will have a serius problem of consistence. */ tool = findToolByNumer('667'); tool.setSituation('PUTTED'); car.addTool(tool); } public void save(ActionEvent event){ dao.persist(car); } EDIT1: The addTool method in class Car is very simples, without any mistery public Car(){ tools = new ArrayList&lt;Tool&gt;(); } private List&lt;Tool&gt; tools; ... public void addTool(Tool tool){ tools.add(tool); }
has comment: http://stackoverflow.com/comment/31195045
has comment: http://stackoverflow.com/comment/31195333
has comment: http://stackoverflow.com/comment/31195498

http://stackoverflow.com/comment/30974681
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20683787
has text: @alex2410 Added a layout manager try but with no luck. Any idea why?

http://stackoverflow.com/q/20760889
has comment: http://stackoverflow.com/comment/31124903
has comment: http://stackoverflow.com/comment/31113612
favorite count: 0
has title: Google app engine does not seem to reload java class files
answer count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/31140693
upvote count: 1
has body: I uploaded a version of my app to the GAE with changed java classes and jars. However, According to the behavior of the app, I do not believe GAE reloaded the java classes or libs. For example, I expected it should write a line to the log in the new version but I didn't see it in the log from the app admin console. I tried following methods, but none of them worked: shutdown the instance from the app admin console for that version and let it start a new instance by accessing the url delete the version and re-upload the same version again upload the app using a new (different) version name set the version as the default version make the version not the default version This issue real really drives me crazy. Has anyone had the similar problem before? Am I missing anything with the app? I found this link discussed a similar issue, but without an answer. I even tried disable/enable app mentioned in that post, but still no luck.
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/31183603

http://stackoverflow.com/comment/31248319
comment on: http://stackoverflow.com/q/20834953
has text: The name of the field in the HTML form can be changed from `myfield` to `myfield[]` in order to make arrays possible.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20709217
accepted answer of: http://stackoverflow.com/q/20709177
type: Answer
answers question: http://stackoverflow.com/q/20709177
has body: you need to increment your location after you set something to it.
has comment: http://stackoverflow.com/comment/31020163
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/20723883
type: Question
has answer: http://stackoverflow.com/a/20724503
score: -2
accepted answer: http://stackoverflow.com/a/20724503
downvote count: 2
has title: Connecting botton frontend with listener in backend (the addActionListener
has body: UPDATED: I think the issue might be that I have not added the: addActionListener(this) to the button, but the reason is because it was dragged and dropped. Had I done the GUI declaration everything would have been made in order, yet, I dont know how to fix that if I cannot even modify the code because it is placed there by Netbeans when using SWING. How can I fix that ======BELOW IS THE FULL CODE GENERATED BY SWING AND IT DID NOT INCLUDE THE ADD ACTION LISTENER QUESTION: WHERE CAN I ADD IT HERE BELOW ON PROPERTIES-CODE-WHERE SHOULD I ADD IT?THERE ARE A LOT OF OPTIONS pre-code, post-code, etc To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. */ package gui; import javax.swing.UIManager; /** * * @author Natalochka */ public class Completo extends javax.swing.JFrame { /** * Creates new form Completo */ public Completo() { 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() { jLabel1 = new javax.swing.JLabel(); jToolBar1 = new javax.swing.JToolBar(); button_open = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); textAreaTab1 = new javax.swing.JTextArea(); boton_findfile = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea2 = new javax.swing.JTextArea(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jPan…
answer count: 1
tagged with: jfilechooser
tagged with: java
has comment: http://stackoverflow.com/comment/31048107
has comment: http://stackoverflow.com/comment/31048290
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31047534
has comment: http://stackoverflow.com/comment/31047838
has comment: http://stackoverflow.com/comment/31048176
favorite count: 0

http://stackoverflow.com/comment/50434724
type: AnswerComment
comment on: http://stackoverflow.com/a/20769600
type: Comment
has text: @phani, I think its not only about failing due to compilation errors. its about errors occurring due to test case failed as well.
score: 2

http://stackoverflow.com/a/20756181
upvote count: 2
type: Answer
has body: You should specify this in android:button property of RadioButton is correct you just need to add android:background="@android:color/transparent"
score: 2
answers question: http://stackoverflow.com/q/20756115
downvote count: 0

http://stackoverflow.com/comment/40112166
type: Comment
has text: Do you use the version 1.6 with JOGL 2? http://tinyurl.com/cf47kcb
score: 1
comment on: http://stackoverflow.com/q/20725265
type: QuestionComment

http://stackoverflow.com/comment/31104868
type: Comment
type: QuestionComment
has text: Added the setters as well
comment on: http://stackoverflow.com/q/20755523
score: 0

http://stackoverflow.com/q/20844121
type: Question
score: 0
answer count: 1
tagged with: log4j
has body: I am new to GAE GWT Application. I am developing a GAE - GWT application with spring MVC 3 as service provider and GWT as UI client (I am not comfortable using GWT's RPC concept, so I started using spring) and log4j (v1.2.17) &amp; log4j-gwt-1.0` for logging. Now I need to log the "logs" in a file. But when coding, it seems, GWT accepts ConsoleAppender but not FileAppender or RollingFileAppender. How to configure log4j in GWT to log the "(server)logs" in a separate file? My log4j.properties file # A default log4j configuration for log4j users. # # To use this configuration, deploy it into your application's WEB-INF/classes # directory. You are also encouraged to edit it as you like. # Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=DEBUG, A1 # Configure the console as our one appender log4j.appender.A1=org.apache.log4j.FileAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n log4j.appender.A1.File=/logger.log log4j.appender.A1.MaxFileSize=10MB # Keep one backup file log4j.appender.A1.MaxBackupIndex=1 # tighten logging on the DataNucleus Categories log4j.category.DataNucleus.JDO=WARN, A1 log4j.category.DataNucleus.Persistence=WARN, A1 log4j.category.DataNucleus.Cache=WARN, A1 log4j.category.DataNucleus.MetaData=WARN, A1 log4j.category.DataNucleus.General=WARN, A1 log4j.category.DataNucleus.Utility=WARN, A1 log4j.category.DataNucleus.Transaction=WARN, A1 log4j.category.DataNucleus.Datastore=WARN, A1 log4j.category.DataNucleus.ClassLoading=WARN, A1 log4j.category.DataNucleus.Plugin=WARN, A1 log4j.category.DataNucleus.ValueGeneration=WARN, A1 log4j.category.DataNucleus.Enhancer=WARN, A1 log4j.category.DataNucleus.SchemaTool=WARN, A1 and My code snippet. import org.apache.log4j.Logger; final private static Logger LOGGER = Logger.getLogger("RegistrationController"); Exception : java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class.…
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/20884187
accepted answer: http://stackoverflow.com/a/20884187
tagged with: logging
has title: Is there any way to log logs in file in GAE GWT application?
tagged with: gwt
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/30969138
has text: You will need to use `synchronized(condition)` around `wait`/`notify` calls.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20681102

http://stackoverflow.com/comment/31015628
comment on: http://stackoverflow.com/q/20693227
score: 0
type: Comment
type: QuestionComment
has text: There's a subtle difference in what's the first page they're trying to access versus my first page being an sso-login interface, but it's basically the same in what's wrong. If you read his "Here's what's wrong" section, I basically have the same scenario. Every first sso-login attempt is eventually redirected to the login page. Every subsequent attempt, clicking the exact same link in the exact same identity provider session, works as expected.

http://stackoverflow.com/a/20828724
downvote count: 0
has comment: http://stackoverflow.com/comment/86859699
score: 43
has comment: http://stackoverflow.com/comment/72284854
has comment: http://stackoverflow.com/comment/94280750
has comment: http://stackoverflow.com/comment/86860831
type: Answer
answers question: http://stackoverflow.com/q/20825935
has comment: http://stackoverflow.com/comment/71317769
accepted answer of: http://stackoverflow.com/q/20825935
has body: I don't see any direct API to get node by row column index, but you can use getChildren API from Pane, and getRowIndex(Node child) and getColumnIndex(Node child) from GridPane //Gets the list of children of this Parent. public ObservableList&lt;Node&gt; getChildren() //Returns the child's column index constraint if set public static java.lang.Integer getColumnIndex(Node child) //Returns the child's row index constraint if set. public static java.lang.Integer getRowIndex(Node child) Here is the sample code to get the Node using row and column indices from the GridPane public Node getNodeByRowColumnIndex (final int row, final int column, GridPane gridPane) { Node result = null; ObservableList&lt;Node&gt; childrens = gridPane.getChildren(); for (Node node : childrens) { if(gridPane.getRowIndex(node) == row &amp;&amp; gridPane.getColumnIndex(node) == column) { result = node; break; } } return result; } Important Update: getRowIndex() and getColumnIndex() are now static methods and should be changed to GridPane.getRowIndex(node) and GridPane.getColumnIndex(node).
has comment: http://stackoverflow.com/comment/86861137
has comment: http://stackoverflow.com/comment/44808354
upvote count: 43
type: AcceptedAnswer

http://stackoverflow.com/q/20824730
has comment: http://stackoverflow.com/comment/31228879
has comment: http://stackoverflow.com/comment/31228827
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31228835
has comment: http://stackoverflow.com/comment/31228923
score: 0
has title: no suitable method found for add()
has comment: http://stackoverflow.com/comment/31228936
answer count: 1
tagged with: java-me
has answer: http://stackoverflow.com/a/20824852
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31228857
has body: I am new to java "I get this error "no suitable method found for add()" when ever I try to run my program. Please help. What am I doing wrong? Please note that I am trying to learn how to use interface. Here's exxample: public interface Calculate { int add(int a, int b); } public abstract class Maths extends MIDlet implements CommandListener, Calculate { private Display display; Form mainForm = new Form("Calculator"); Form testForm = new Form("Results"); TextField at = new TextField("A=", "", 10, TextField.NUMERIC); TextField bt = new TextField("B=", "", 10, TextField.NUMERIC); StringItem resultItem = new StringItem("Result =", ""); Command addCommand = new Command("add", Command.SCREEN, 1); public Maths() { display = Display.getDisplay(this); mainForm.append(at); mainForm.append(bt); mainForm.addCommand(addCommand); testForm.append(resultItem); testForm.setCommandListener(this); mainForm.setCommandListener(this); } public void startApp() { Display.getDisplay(this).setCurrent(mainForm); } protected final void addOrderComponent(Component c) { }

http://stackoverflow.com/a/20713123
type: Answer
has comment: http://stackoverflow.com/comment/31237513
answers question: http://stackoverflow.com/q/20712782
has comment: http://stackoverflow.com/comment/31063375
upvote count: 10
has comment: http://stackoverflow.com/comment/31097714
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/31224792
accepted answer of: http://stackoverflow.com/q/20712782
type: AcceptedAnswer
has body: The git log has this entry, from December 2006 (about 9 months after the initial checkin): Added abstract BaseMatcher class that all Matchers should extend. This allows for future API compatability [sic] as the Matcher interface evolves. I haven't tried to figure out the details. But maintaining compatibility and continuity as a system evolves is a difficult problem. It does mean that sometimes you end up with a design that you would never, ever, ever have created if you had designed the whole thing from scratch.

http://stackoverflow.com/q/20745462
tagged with: jar
score: -1
has title: .jar is not working
answer count: 3
has comment: http://stackoverflow.com/comment/31086560
has comment: http://stackoverflow.com/comment/31105542
favorite count: 0
has comment: http://stackoverflow.com/comment/31086094
has answer: http://stackoverflow.com/a/20745613
has answer: http://stackoverflow.com/a/20756230
has answer: http://stackoverflow.com/a/20754225
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31085790
has comment: http://stackoverflow.com/comment/31107147
tagged with: java
type: Question
has body: I have created .jar for my below code in NetBeans, but nothing happens when I double click on the .jar, although everything is working fine from NetBeans: Please help /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * NewJFrame.java * * Created on Dec 2, 2013, 3:17:19 PM */ package codereview; import java.io.IOException; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; //import javax.swing.JOptionPane; /** * * @author sony */ public class NewJFrame extends javax.swing.JFrame { //Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = null; ResultSet rs = null; Statement st = null; PreparedStatement pst =null; public NewJFrame() throws SQLException, ClassNotFoundException { initComponents(); //setIcon(); reset.setEnabled(false); submit.setEnabled(false); //fillCombo(); } /** 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() { jPanel1 = new javax.swing.JPanel(); submit = new javax.swing.JButton(); instruction = new javax.swing.JLabel(); entitytype = new javax.swing.JComboBox(); username = new javax.swing.JTextField(); psswd = new javax.swing.JTextField(); sid = new javax.swing.JTextField(); destination = new javax.swing.JTextField(); install = new javax.swing.JButton(); foldername = new javax.swing.JComboBox(); reset = new javax.swing.JButton(); check = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); data = new javax.swing.JTable(); add = new javax.swing.JButton(); nameentity = new javax.swing.JComboBox(); remove = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); refresh …

http://stackoverflow.com/comment/30995565
comment on: http://stackoverflow.com/q/20695310
has text: By the way, it's called a "discriminant", not a "discriminate".
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/20746053
score: 0
type: Answer
has body: Named queries in JPA are not changeable. They behave like constants. The only thing you can do with them is to define a fixed number of parameters in theirs body. If you want to dynamicly build a query use a normal JPQL query instead of named one.
answers question: http://stackoverflow.com/q/20745988

http://stackoverflow.com/q/20685173
has body: This is my hashmap: protected HashMap&lt;String, HashMap&lt;String, Player&gt;&gt; prisonsPlayers = new HashMap&lt;String, HashMap&lt;String, Player&gt;&gt;(); I try to insert something in it with: prisonsPlayers.put(player.getWorld(), (HashMap&lt;player.getName(), player&gt;)); Erorr I get: Multiple markers at this line - Syntax error, insert ")" to complete Expression - Syntax error on token ")", invalid Expression I know I do something wrong but however I try, what ever I do I don't know how to insert that data to my hashmap.
tagged with: java
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/20685321
has answer: http://stackoverflow.com/a/20685392
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20685273
has comment: http://stackoverflow.com/comment/30976389
type: UnansweredQuestion
has title: Hashmap in hash map try to insert something

http://stackoverflow.com/comment/31020458
type: QuestionComment
type: Comment
has text: You have to return a value. What do you return if `x == 10`?
comment on: http://stackoverflow.com/q/20709459
score: 0

http://stackoverflow.com/comment/31228936
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20824730
has text: I'm not convinced that you understand what any of these things are for, really. In the first place, why are you even creating an interface?

http://stackoverflow.com/a/20778023
has comment: http://stackoverflow.com/comment/31144655
answers question: http://stackoverflow.com/q/20778012
upvote count: 1
has body: That's wrong. The hashCode() function returns an int. So when creating 2^32 + 1 objects, at least one hash code will appear twice. Per default (If you don't overwrite the hashCode() function), objects will have their address in memory as hash code. This is why you get the impression it is unique. You are creating not enough objects to allocate enough memory to get two equal hash codes. How can I make sure the objects that will be generated via cloning, are in-fact completely independent and unique? Independence and uniqueness are different criteria. Independence means simply that an object and its clone do not share state. So if (for example) your Vehicle objects have mutable components, you need to ensure that your clone method clones the components as well. Uniqueness requires more information. Specifically, it depends on what you are using as your "test" for uniqueness. If you are using == as your test for uniqueness, then any implementation of clone that creates a new object will satisfy the requirement. (The normal expectation of clone is that it will create a new object ...) If you are using equals as your test for uniqueness, then it depends on how you define the equals method. The default implementation of equals uses ==. If you override equals to test based on object fields, then if you want the clones to be unique (according to equals) you need some kind of identifier field that serves as the objects identity ... and arrange that your clone method gives each clone a new identifier value. (And that means that simply delegating to Object.clone() is not sufficient.) My question really is, would using the default equals() method to compare my 100000 clones ensure that each one is in-fact unique and equals() will always return false? Yes ... for any reasonable implementation of clone(). The default implementation of Java equals(Object) does the same test as Java ==, and that will only give you true if the two operands are the same object reference.
type: Answer
has comment: http://stackoverflow.com/comment/31144623
downvote count: 0
score: 1

http://stackoverflow.com/comment/31027228
comment on: http://stackoverflow.com/q/20712782
has text: That looks like a way to maintain backward binary compatibility with previous implementations, implementing Matcher directly, but to ensure that nobody does it anymore by breaking source-code compatibility.
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20832516
favorite count: 0
has comment: http://stackoverflow.com/comment/31244687
has comment: http://stackoverflow.com/comment/31244019
has title: how to exclude strings with symbols using Java Regex
has body: I'm looking for a way, using Java regex/regexp, to test if a string has anything but letters, numbers, or _'s in it (no symbols). I tried this, but it accepted all strings. This is not the exact code, but it will work. Pattern pattern = Pattern.compile("[\w]"); //also tried ("\w") Matcher matcher = pattern.matcher(x); if(!matcher.find()){ System.out.println("Valid String"); }else{ System.out.println("Invalid String"); }
tagged with: regex
has comment: http://stackoverflow.com/comment/31245332
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/20832939
score: -1
accepted answer: http://stackoverflow.com/a/20832939
tagged with: symbols
answer count: 1
has comment: http://stackoverflow.com/comment/31243972

http://stackoverflow.com/comment/31126936
score: 0
type: Comment
type: QuestionComment
has text: Update: Changing the command to an array of strings seemed to have no effect on the code. I got exactly the same result.
comment on: http://stackoverflow.com/q/20767490

http://stackoverflow.com/comment/78656197
has text: Why the `+ 48` on your `x_char[i] = (char)(x % 10 + 48)`?
comment on: http://stackoverflow.com/a/20737648
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20843033
possible better answer: http://stackoverflow.com/a/20844134
has comment: http://stackoverflow.com/comment/31263537
score: 6
upvote count: 7
accepted answer: http://stackoverflow.com/a/20843303
downvote count: 1
has comment: http://stackoverflow.com/comment/31263248
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20249723
tagged with: java
duplicate of: http://stackoverflow.com/q/20249723
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31263449
has comment: http://stackoverflow.com/comment/31263963
has comment: http://stackoverflow.com/comment/31263589
has body: This is what I tried: public final class firstObj{ public static void main(String args[]){ Object obj = new Object(); Object obj1 = new Object(); System.out.println(obj); System.out.println(obj1); } } I compiled the program at first and ran it two consecutive times, I got two different outputs: output 1: java.lang.Object@6f548414 java.lang.Object@65ab7626 output 2: java.lang.Object@659c2931 java.lang.Object@6f548414 I want to know why did the JVM swap the second object's location to first object's location When it ran for the second time.., it is quite bewildering..,
has comment: http://stackoverflow.com/comment/31263878
has comment: http://stackoverflow.com/comment/31262810
has title: why is object location swapped in JVM?
has answer: http://stackoverflow.com/a/20843303
has answer: http://stackoverflow.com/a/20844134
has comment: http://stackoverflow.com/comment/31263568
favorite count: 0

http://stackoverflow.com/q/20829891
has answer: http://stackoverflow.com/a/20829918
downvote count: 1
type: Question
score: -1
has title: How can i display my array of obejct on the other method
has body: How can I display my array of object on the other method? I dont know the code. It gives me garbage value or somehow like an address. I used different approach but still garbage value or something @dasfas public class Student { public static void main(String[] args) { menu(); } public static void menu(){ Scanner input = new Scanner(System.in); int choice; do{ System.out.println("CMPE 325 Student Record Holder System"); System.out.println("--------------------------------"); System.out.println("1.Add Student"); System.out.println("2.View Records"); System.out.println("3.Update Students"); System.out.println("4.Get Average"); System.out.println("5.Exit"); System.out.println(); System.out.println("--------------------------------"); System.out.print("Enter your choice: "); choice=input.nextInt();
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/20829927
favorite count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/20798821
has body: Your Query appears to return the same list over and over again for every Class_1 item because id and code never change. I assuming your code should rather look like this: Query qr=s.createQuery("from Class_2 where ID= :f and code= :j order by mark desc"); for( Class_1 a : class1list ) { qr.setParameter( "f", a.id ); qr.setParameter( "j", a.code ); for( Class_2 cls: qr.list() ) { modelclass mdl=new modelclass(cls.getID(),cls.getCode(),cls.getMark()); mdlclasslist.add(mdl); } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20798313
type: Answer
answers question: http://stackoverflow.com/q/20798313
upvote count: 1
score: 1

http://stackoverflow.com/q/20801149
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20801187
accepted answer: http://stackoverflow.com/a/20801187
tagged with: java
tagged with: maven-tomcat-plugin
type: Question
has title: Jetty VS Tomcat Maven Plugin - which one should I use?
tagged with: webserver
score: 0
tagged with: maven-jetty-plugin
answer count: 1
has body: I'm using Tomcat as my production server and I would like to use one of maven plugins in order to run the server from within the IDE. I saw that there are 2 plugins: Tomcat maven plugin and Jetty maven plugin. What are the differences between the two? What are the prons and cons for each?
tagged with: maven

http://stackoverflow.com/q/20730641
has title: JAVA padding string with whitespace (JFrame)
has body: I am writing SWING GUI for some applications. In my application, I have two fields showing some numbers. This is the current result on my JFrame: 12345678 &nbsp;&nbsp;-12,231 1234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-123.000 However, I want it to be like this: 12345678 &nbsp; -12,231 1234 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -123.000 I first calculate the length of the first column and pad the whitespace to make the length I want. But the result is the first one I showed above. It seems that different characters occupy different length when displayed on the JFrame. Any idea about this? Or does it have something to do with the font? Thank you!
has comment: http://stackoverflow.com/comment/31060203
accepted answer: http://stackoverflow.com/a/20733932
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31059461
has answer: http://stackoverflow.com/a/20733932
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20730690
has comment: http://stackoverflow.com/comment/31059460
has answer: http://stackoverflow.com/a/20730690
has comment: http://stackoverflow.com/comment/31059561
score: 0

http://stackoverflow.com/a/20684357
score: 0
type: Answer
has body: You need to update the path property of the polyline (poly.setPath(path)) after updating the path. Looking closer at your code, I am not sure how you expect Latitude and Longitude to update where they are (local to the initialize function). function updateposition(){ path.push(new google.maps.LatLng(Latitude,Longitude)); poly.setPath(path); } here is an example that updates the polyline from computed coordinates based on the time var poly; var Latitude = null; var Longitude = null; var map = null; var path = []; function initialize() { //create map var mapOptions = { zoom: 2, center:new google.maps.LatLng(0,0) } map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); poly = new google.maps.Polyline({ path: path, strokeColor: '#FF0000', strokeOpacity: 1.0, strokeWeight: 2 }); poly.setMap(map); var myVar = setInterval(function(){updateposition()},2000); } function updateposition(){ var date = new Date(); var time = date.getMinutes()*60+date.getSeconds(); Latitude= 45*Math.sin((time-1800)*Math.PI/1800.0) Longitude= (time/10)-180; path.push(new google.maps.LatLng(Latitude,Longitude)); if (path.length == 1) { map.setCenter(path[0]); map.setZoom(8); } else { map.setCenter(path[path.length-1]); } poly.setPath(path); } google.maps.event.addDomListener(window, 'load', initialize);
accepted answer of: http://stackoverflow.com/q/20682039
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20682039

http://stackoverflow.com/a/20837344
score: 1
answers question: http://stackoverflow.com/q/20837285
has body: replace dot with equals symbol Customer a.new Customer(name,custId,numOfPurchases,city);
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/20711360
has comment: http://stackoverflow.com/comment/31024548
has comment: http://stackoverflow.com/comment/31026497
has comment: http://stackoverflow.com/comment/31035860
has comment: http://stackoverflow.com/comment/31034391
has comment: http://stackoverflow.com/comment/31036917
has comment: http://stackoverflow.com/comment/31026053
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: I programmed an interface for a very simple webserver in Java that allows the user to put his own jar-archives into a folder, and when the server starts, they will be loaded. In that archive is a text file which defines the main class etc., but my plugin loader only loads the class defined in the file. So, when I use a second class and want to access it (Example e = new Example() ), it will result in a NoClassDefFoundError-Exception: Exception in thread "main" java.lang.NoClassDefFoundError: de/Ercksen/WebserverPlugin/Plugin/WasWillstDu at de.Ercksen.WebserverPlugin.Plugin.MainPlugin.onEnable(MainPlugin.java:17) at de.Ercksen.Webserver.Webserver.initPlugins(Webserver.java:236) at de.Ercksen.Webserver.Webserver.loadPlugins(Webserver.java:231) at de.Ercksen.Webserver.Webserver.execute(Webserver.java:37) at de.Ercksen.Webserver.Webserver.main(Webserver.java:30) Caused by: java.lang.ClassNotFoundException: Ercksen.WebserverPlugin.Plugin.WasWillstDu at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 5 more Is there a method or something that can simply load all the classes in the .jar-archive? Or any other ideas? My class loader: @SuppressWarnings("unchecked") public static Class&lt;? extends Plugin&gt; loadPluginClass(File file, String path) throws ClassNotFoundException, ClassCastException, IOException { URLClassLoader loader = new URLClassLoader(new URL[] {file.toURI().toURL()}); Class&lt;?&gt; c = loader.loadClass(path); loader.close(); return (Class&lt;? extends Plugin&gt;) c; }
has comment: http://stackoverflow.com/comment/31038024
has comment: http://stackoverflow.com/comment/31026366
score: 1
has comment: http://stackoverflow.com/comment/31036658
favorite count: 0
has title: Java - Using external jar-archives and classes (ClassLoader)
tagged with: classloader
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/31034359
has comment: http://stackoverflow.com/comment/31024453
linked to: http://stackoverflow.com/q/20586067
tagged with: java
has comment: http://stackoverflow.com/comment/31026982

http://stackoverflow.com/a/20745401
has body: best practice would be to list out the columns and then provide the values. Something like this: insert into movie_preferences (userID, movieID,preference,timestamp ) values (1001, 1067, 5, 10000000)
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31086049
has comment: http://stackoverflow.com/comment/31085899
score: 1
answers question: http://stackoverflow.com/q/20745189
upvote count: 1

http://stackoverflow.com/comment/35978025
type: Comment
comment on: http://stackoverflow.com/a/22268837
has text: the question was how to secure Nashorn, not Rhino
score: 3
type: AnswerComment

http://stackoverflow.com/comment/31061207
score: 0
type: Comment
type: QuestionComment
has text: I thought by using parseInt("i1") it would make aa the same value of i1 and therefore revert back to its value, "abc" etc. I guess it just makes a new Integer then?
comment on: http://stackoverflow.com/q/20731401

http://stackoverflow.com/comment/30971433
type: Comment
comment on: http://stackoverflow.com/q/20682263
type: QuestionComment
has text: @guido thanks I've formatted the code to be easier to read. The code is not giving any exceptions it builds and runs ok
score: 0

http://stackoverflow.com/comment/31077308
score: 0
has text: Native events of FireFox 25 are only supported since selenium 2.38. So you need to downgrade firefox or update selenium.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20733957

http://stackoverflow.com/comment/31234483
type: Comment
has text: you're a distributing so many downvotes here ... what about showing us how the thing really works and providing a correct, no, a perfect answer for the OP?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20827352

http://stackoverflow.com/a/20736694
has comment: http://stackoverflow.com/comment/31089126
type: Answer
has comment: http://stackoverflow.com/comment/31103128
answers question: http://stackoverflow.com/q/20736668
has comment: http://stackoverflow.com/comment/31073574
has comment: http://stackoverflow.com/comment/31073784
downvote count: 0
score: 1
has body: Look into Google Cloud Messaging Service: https://developer.android.com/google/gcm/index.html If your messages are less than 4Kb, then you could use this as some sort of IM or Chat application.
upvote count: 1

http://stackoverflow.com/q/20680860
possible better answer: http://stackoverflow.com/a/20696316
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20696316
tagged with: java
accepted answer: http://stackoverflow.com/a/20692716
type: Question
upvote count: 4
answer count: 2
score: 4
tagged with: wsdl
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20692716
has title: SOAP request returned wsdl instead of expected SOAP response
tagged with: soap
tagged with: web-services
tagged with: php
has body: I have a problem with my SOAP request. When I have tried the below soap request to the server then it returns the expected result. Location : https://YOUR_SERVER/apitransactional/services/TransactionalService?wsdl Input: &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.service.apitransactional.emailvision.com/"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;api:openApiConnection&gt; &lt;login&gt;usernaem&lt;/login&gt; &lt;pwd&gt;password&lt;/pwd&gt; &lt;key&gt;security-key&lt;/key&gt; &lt;/api:openApiConnection&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; Output: &lt;soap:Envelope&gt; &lt;soap:Body&gt; &lt;ns2:openApiConnectionResponse&gt; &lt;return&gt;G9X7CsNn3HisxFdwAu4W76mBewQgH9WW-3CyeO9WBMiHXX_u9ufLHDkA-NypiiYFGh7FLbEz2_c1YonjauDs7Jhk9DGvGNSTLMTjdz5wT2V20E4m3axKPzEnjrvzC63ItFzBIYIeYXHxjKf3w9Yxmmhz5SSeXg&lt;/return&gt; &lt;/ns2:openApiConnectionResponse&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; It returns token of this connection. But when I tried to the below request then it returns the whole wsdl file instead of success / fail response. Location: http://api.notificationmessaging.com/NMSOAP/NotificationService?wsdl Input: &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.service.nsapi.emailvision.com/"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;api:sendObjectsWithFullStatus&gt; &lt;arg0&gt; &lt;sendrequest&gt; &lt;content&gt; &lt;entry&gt; &lt;key&gt;1&lt;/key&gt; &lt;value&gt;&gt; &lt;![CDATA[ &lt;table width="600"&gt; &lt;tr&gt; &lt;td&gt; &lt;font size="2" face="Arial"&gt;Our powerful algorithms already found a matching profile that matches your criteria: &lt;br&gt;Celina72&amp;nbsp;&lt;/font&gt; &lt;img src="http://mypath/to/my/image.gif" width="50" height="50" border="0" /&gt; &lt;/td&gt;]]&gt;&lt;/value&gt; &lt;/entry&gt; &lt;/content&gt; &lt;dyn&gt; &lt;entry&gt; &lt;key&gt;firstname&lt;/key&gt; &lt;value&gt;john&lt;/value&gt…

http://stackoverflow.com/q/20787984
tagged with: center
has answer: http://stackoverflow.com/a/20788013
type: Question
score: 0
answer count: 2
tagged with: position
type: UnansweredQuestion
tagged with: android
has body: I have the following code which dynamically creates clickable ImageViews, (depending on what value you can make it 2x2 3x3 4x4 etc...) Everything is working fine except I want the imageViews to be centered, right now they start at the left of the screen. I want the whole collection of imageviews to be in the center of the screen. private void maakLayout() { LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.gravity = Gravity.CENTER_HORIZONTAL; linearLayout.setLayoutParams(layoutParams); setContentView(linearLayout); TextView textView = new TextView(this); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, (2) * 10); textView.setGravity(Gravity.CENTER); LinearLayout.LayoutParams layoutTextParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutTextParams.topMargin = 50; layoutTextParams.bottomMargin = 50; textView.setLayoutParams(layoutTextParams); textViewScore = textView; linearLayout.addView(textView); int k = 0; for (int i = 0; i &lt; RASTER; i++) { LinearLayout linearLayout1 = new LinearLayout(this); //linearLayout1.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(layoutParams); layoutParams1.gravity = Gravity.CENTER_VERTICAL; LinearLayout.LayoutParams layoutImageParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); linearLayout1.setLayoutParams(layoutImageParams); linearLayout.addView(linearLayout1); for (int j = 0; j &lt; RASTER; j++) { ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.back); imageView.setTag(k); imageView.setBackgroundResource(R.drawable.border_gray); LinearLayout.LayoutParams layoutImageParams1 = new LinearLayout.Layo…
has answer: http://stackoverflow.com/a/20788094
tagged with: dynamic
has title: Centering a linearlayout dynamically
tagged with: java

http://stackoverflow.com/comment/31097805
comment on: http://stackoverflow.com/a/20751485
has text: I can call the web service using an HtpWebRequest no problem in a test console app; apparently because I'm able to add the requisite `<system.serviceModel>` configuration element into the console application's app.config. But now that I'm trying to make the call in a DLL (and thus have no app.config), I'm trying to figure out how to programmatically create AND USE said config info in the code. Make sense?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/30977393
score: 1
comment on: http://stackoverflow.com/q/20685709
has text: Just return false the second you find a topping that is not veg.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20786483
has comment: http://stackoverflow.com/comment/31158724
linked to: http://stackoverflow.com/q/25425130
has comment: http://stackoverflow.com/comment/31158630
has comment: http://stackoverflow.com/comment/31158743
has answer: http://stackoverflow.com/a/20786677
has answer: http://stackoverflow.com/a/20786746
tagged with: java-7
downvote count: 0
duplicate of: http://stackoverflow.com/q/25425130
favorite count: 0
score: 6
has answer: http://stackoverflow.com/a/20786544
tagged with: swing
upvote count: 6
has comment: http://stackoverflow.com/comment/31158847
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20786677
has comment: http://stackoverflow.com/comment/31158597
has body: i've been making a countdown program, and i came up with this. package main; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class Gatoo extends JFrame implements ActionListener { private int sec, min, secTot, since = 999; private long lastTime; private JTextField mm = new JTextField(2), ss = new JTextField(2); private JLabel minLab = new JLabel("Minutes:"), secLab = new JLabel( "Seconds:"); private JButton start = new JButton("Start"); private Clip done; private boolean started = false; private static final long serialVersionUID = 4277921337939922028L; public static void main(String[] args) { Gatoo cake = new Gatoo("Title"); cake.pack(); cake.setSize(800, 600); cake.setLocationRelativeTo(null); cake.setDefaultCloseOperation(3); cake.setVisible(true); cake.run(); } public Gatoo(String s) { super(s); setLayout(new FlowLayout()); start.addActionListener(this); add(minLab); add(mm); add(secLab); add(ss); add(start); } @Override public void actionPerformed(ActionEvent e) { started = true; } public void play(File file) throws MalformedURLException, UnsupportedAudioFileException, IOException, LineUnavailableException { AudioInputStream ais = AudioSystem.getAudioInputStream(new File( "lib/done.wav")); DataLine.Info info = new DataLine.Info(Clip.class, ais.getFormat()); done = (Clip) AudioSystem.getLine(info); done.open(ais); done.start(); } public void run() { while (true) { System.out.print("");// needed? if (started) { try { min = Integer.parseInt(mm.get…
tagged with: java
has comment: http://stackoverflow.com/comment/31158573
has comment: http://stackoverflow.com/comment/31158599
has title: Code not executed without a print statement
type: Question
possible better answer: http://stackoverflow.com/a/20786588
has answer: http://stackoverflow.com/a/20786588

http://stackoverflow.com/a/20710543
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20704797
answers question: http://stackoverflow.com/q/20704797
type: Answer
has body: I think there is an error in how you use the counter in takeOrNull(), when you remove the stub, you decrease Length by 1, but don't re-increase it when adding the stub back at the end, since you use addNode() instead of add(). Let's say you added an element successfully, so your queue looks like this: Length is 2 STUB -&gt; FIRST_NODE -&gt; NULL ^ ^ | | Head Tail So now one thread starts doing takeOrNull(), length decreases to 1, Head moves to FIRST_NODE, and since this is the STUB node, it gets re-added to the end, so now you have: Length is 1 FIRST_NODE -&gt; STUB -&gt; NULL ^ ^ | | Head Tail Do you see? Length is 1 now! On the next takeOrNull(), you will get NULL, even if FIRST_NODE is still in the queue and has never been returned... You just (temporarily) lost a piece of data. Further, you can now repeat this ad infinitum and start accumulating nodes. Like if you add three nodes, Length is 4 and you have FIRST, STUB, NEW1, NEW2, NEW3. If you then do three takeOrNull(), you end up with NEW2, NEW3, STUB and Length 1. So this way you end up loosing elements, but I admit to not being completely sure about how this would ever trigger the exception. Let me eat and think about it some more. ;-) EDIT: Ok food did me good, I came up with a sequence that triggers the head null exception. Let's start with a valid queue with one element like before: Length is 2 STUB -&gt; FIRST_NODE -&gt; NULL ^ ^ | | Head Tail Now we have four threads, two that try to takeOrNull() and two that add() concurrently. Both add threads have moved the tail pointer correctly, the first one moved tail from FIRST to SECOND, and then was paused. The second add thread moved then tail from SECOND to THIRD, then updated the old tail's (SECOND's) next pointer, and then incremented the counter and exited. We're left with: Length is 3 STUB -&gt; FIRST_NODE -&gt; NULL SECOND_NODE -&gt; THIRD_NODE -&gt; NULL ^ ^ | | Head Tail Now the two takeOrNull threads wake up and execute, since Length is 3, both will b…

http://stackoverflow.com/a/20718633
has body: Dropwizard is using Jersey 1.x. In Jersey you can throw a WebApplicationException to redirect a user. Also see the answer here: https://stackoverflow.com/a/599131/360594
upvote count: 1
answers question: http://stackoverflow.com/q/20709386
has comment: http://stackoverflow.com/comment/47138889
downvote count: 0
has comment: http://stackoverflow.com/comment/31042404
type: Answer
score: 1

http://stackoverflow.com/comment/31153709
type: Comment
comment on: http://stackoverflow.com/a/20783554
has text: used Xpath//*[@id='cmt']/div/span Error occured :- javax.xml.transform.TransformerException: Unable to evaluate expression using this context at com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:367) at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.eval(XPathImpl.java:208) at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:270) at UrlReadPageDemo1.main(UrlReadPageDemo1.java:31)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/106826491
type: Comment
comment on: http://stackoverflow.com/a/50528595
score: 2
has text: Its worked for me! Thanks if we want ignore all other properties except id then only add @JsonIdentityReference(alwaysAsId=true) otherwise remove @JsonIdentityReference(alwaysAsId=true)
type: AnswerComment

http://stackoverflow.com/a/20810676
has comment: http://stackoverflow.com/comment/31214298
has comment: http://stackoverflow.com/comment/31214126
score: 3
downvote count: 0
has body: You never add your listener to your SwingWorker. Change to: task = new Task(); task.addPropertyChangeListener(listener); The other error you have is that you never update your currentPercent in updateProgress. public void updateProgress(int tick){ currentPercent+=tick; setProgress(currentPercent); } EDIT Well and actually your error is the same in your code (not sscce), you never update your currentPercent value. PropertyChangeListener listener = new PropertyChangeListener(){ public void propertyChange(PropertyChangeEvent event){ if("progress".equals(event.getPropertyName())){ currentPercent = (int)event.getNewValue(); progressBar.setValue(currentPercent); progressBar.setString(Integer.toString(currentPercent)); } } };
has comment: http://stackoverflow.com/comment/31203352
has comment: http://stackoverflow.com/comment/31203180
has comment: http://stackoverflow.com/comment/31214258
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31214603
has comment: http://stackoverflow.com/comment/31203251
accepted answer of: http://stackoverflow.com/q/20809432
upvote count: 3
has comment: http://stackoverflow.com/comment/31202741
has comment: http://stackoverflow.com/comment/31202850
answers question: http://stackoverflow.com/q/20809432
has comment: http://stackoverflow.com/comment/31203630
type: Answer
has comment: http://stackoverflow.com/comment/31203311
has comment: http://stackoverflow.com/comment/31214172

http://stackoverflow.com/q/20777500
has body: I was taking a look at Notch's code from ludum dare(minicraft) and i noticed he uses : private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); So i made a simple test program, and i noticed my perfomance lowers by a lot when compared to the method i was previously using. With this method, just drawing a completely white screen, i get 800 fps and when i draw a test image i get more then 1200, which seems a bit odd. Even if i dont declare anything on the pixels[] and just leave the default one it's still 800 fps. I wonder if someone could explain me the reason for that. This is the test code i wrote and i used fraps to get my fps: public class Test extends Canvas implements Runnable{ private static final long serialVersionUID = 1L; private boolean running = false; public final int HEIGHT = 300; public final int WIDTH = 360; private final int SCALE = 3; private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); private BufferedImage testImage; private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); JFrame frame; public Test(){ Dimension size = new Dimension(WIDTH*SCALE, HEIGHT*SCALE); frame = new JFrame(); this.frame.setResizable(false); this.setPreferredSize(size); this.setMaximumSize(size); this.setMinimumSize(size); this.frame.add(this); this.frame.pack(); this.frame.setLocationRelativeTo(null); this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setFocusable(true); this.frame.setVisible(true); try { testImage = ImageIO.read(new File("res/test.jpg")); } catch (IOException e) { e.printStackTrace(); } for(int i = 0; i &lt; pixels.length; i++){ pixels[i] = 0xffffff; } running = true; } public void run() { while(running){ render(); } } private void render() { BufferStrategy bs = getBufferStrategy(); if(bs == null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGrap…
tagged with: bufferedimage
type: Question
tagged with: graphics
score: 0
has answer: http://stackoverflow.com/a/25767973
answer count: 1
has title: BufferedImage performance
tagged with: jframe
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/62720954
comment on: http://stackoverflow.com/a/20744794
type: AnswerComment
has text: Do I still need to compile any gradle for this? Or this is just a sample. :)
score: 0
type: Comment

http://stackoverflow.com/comment/31070324
type: AnswerComment
type: Comment
has text: Now, i can understand it. when header is matched, adding the next line. when the footer is matched, you are making matched as false. This will add only the lines in between them. cool :) I have rep +1
score: 1
comment on: http://stackoverflow.com/a/20736326

keylistener
tags question: http://stackoverflow.com/q/20768592
tags question: http://stackoverflow.com/q/20720483
tags question: http://stackoverflow.com/q/20725621
type: Tag
tags question: http://stackoverflow.com/q/20819295
tags question: http://stackoverflow.com/q/20837785
tag name: keylistener
tags question: http://stackoverflow.com/q/20727539
tags question: http://stackoverflow.com/q/20715733

http://stackoverflow.com/comment/31171611
has text: @SotiriosDelimanolis Down the Stack? What do you mean? BTW, I solve the problem yesterday by restrict encode to utf-8 in FileInputStream (if you remember it
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20793412

http://stackoverflow.com/comment/30999603
score: 0
type: AnswerComment
has text: Thanks for your input. I manually typed `happy` in notepad, saved as 'abc.txt' in UTF-8 encoding and tried the program. Gives the same non-printable character in the beginning. Is it standard for UTF-8 documents to do so?
type: Comment
comment on: http://stackoverflow.com/a/20697617

http://stackoverflow.com/a/20692822
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20692750
has comment: http://stackoverflow.com/comment/30991924
answers question: http://stackoverflow.com/q/20692750
upvote count: 5
has comment: http://stackoverflow.com/comment/31007100
type: Answer
has comment: http://stackoverflow.com/comment/31002150
downvote count: 0
has comment: http://stackoverflow.com/comment/31007704
has body: You need an interface: interface Closeable { public void close(); } Otherwise you could inspect the Object via reflection.
score: 5

java-io
tags question: http://stackoverflow.com/q/20767984
type: Tag
tags question: http://stackoverflow.com/q/20721050
tag name: java-io

http://stackoverflow.com/a/20736634
has body: Yes, you can. Here is an example of how to embed vert.x in a grails app, which can be run inside Tomcat, https://gist.github.com/pledbrook/2652835.
has comment: http://stackoverflow.com/comment/31108661
has comment: http://stackoverflow.com/comment/31089281
answers question: http://stackoverflow.com/q/20730752
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/20766364
accepted answer of: http://stackoverflow.com/q/20766254
has comment: http://stackoverflow.com/comment/31125596
score: 3
type: Answer
answers question: http://stackoverflow.com/q/20766254
has body: I think you got it almost right, but Bar *bar = [[MyConformingViewController alloc] init]; should be id &lt;Bar&gt; bar = [[MyConformingViewController alloc] init]; because id &lt;Bar&gt; declares an Objective-C object that conforms to the Bar protocol.
upvote count: 3
has comment: http://stackoverflow.com/comment/31123629
has comment: http://stackoverflow.com/comment/31125969
has comment: http://stackoverflow.com/comment/31126971
type: AcceptedAnswer
downvote count: 0

keyboard-events
tags question: http://stackoverflow.com/q/20822738
tag name: keyboard-events
type: Tag

http://stackoverflow.com/comment/31071007
type: QuestionComment
comment on: http://stackoverflow.com/q/20736750
type: Comment
score: 1
has text: OK, MadProgrammer has given the correct answer. You need `super.paint(g);` at the start of the `paint` method.

http://stackoverflow.com/q/20825410
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25888346
upvote count: 1
has answer: http://stackoverflow.com/a/20827921
accepted answer: http://stackoverflow.com/a/20827921
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25888346
favorite count: 0
tagged with: google-app-engine
has title: appengine-web.xml does not contain a <threadsafe> element
type: AnsweredQuestion
has body: Working on an app engine java application I am getting the error in the subject. I have looked at similar questions that say that a true element should be added to appengine-web.xml, but my appengine-web.xml file is auto generted based on app.yaml and the instructions here do not provide any help... I think it might be acheived using the instructions re "Custom XML Output" in that same page but they seem to be missing the part on how to actually do it...

http://stackoverflow.com/comment/31058568
comment on: http://stackoverflow.com/q/20730179
type: Comment
type: QuestionComment
has text: What do you mean by "convert to binary"? What output are you expecting for this example?
score: 1

http://stackoverflow.com/comment/31260506
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20792313
has text: For the production deployment you need to include it as a JAR. For development in Eclipse you can link the projects together and specify it in the *Deployment assembly* settings, which I've mentioned in previous comment (check screenshots in the linked SO question).

http://stackoverflow.com/q/20807887
tagged with: n-queens
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31198815
has title: 8 queen puzzle in prolog with java interface ,i am unable to execute a query
tagged with: prolog
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/20808644
answer count: 1
has body: i am solving 8 queen problem in prolog. i am beginner in prolog. i want to printing the solution list but my query is fail every... anyone can help me ??? package family; import java.util.*; import jpl.*; import jpl.Query; /** * */ public class family { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Query q1 = new Query("consult", new Term[] {new Atom("check.pl")}); System.out.println((q1.hasSolution() ? "succeeded" : "failed")); java.util.Hashtable solution; Variable X = new Variable(); Query q4 = new Query(new Compound("solution", new Term[] { new jpl.Integer(8), X})); System.out.println((q4.hasSolution() ? "succeeded" : "failed")); while ( q4.hasMoreSolutions() ) { solution = q4.nextSolution(); System.out.println( "X = " + solution.get("X")); } } } here is my prolog code solution( Ylist) :- sol( Ylist, [1,2,3,4,5,6,7,8], [1,2,3,4,5,6,7,8], [-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7], [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] ). %sol( [], [], Dy, Du, Dv). sol( [Y | Ylist], [X | Dx1], Dy, Du, Dv) :- del( Y, Dy, Dy1), U is X-Y, del( U, Du, Du1), V is X+Y, del( V, Dv, Dv1), sol( Ylist, Dx1, Dy1, Du1, Dv1). del( Item, [Item | List], List). del( Item, [First | List], [First | List1] ) :- del( Item, List, List1). gen( N, N, [N]). gen( N1, N2, [N1|List]) :- N1 &lt; N2, M is N1+1, gen(M, N2, List). solution( N, S) :- gen(1, N, Dxy), Nu1 is 1-N, Nu2 is N-1, gen(Nu1, Nu2, Du), Nv2 is N+N, gen(2, Nv2, Dv), sol( S, Dxy, Dxy, Du, Dv).
favorite count: 0
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/q/20706783
linked to: http://stackoverflow.com/q/409784
has answer: http://stackoverflow.com/a/61336264
has comment: http://stackoverflow.com/comment/112122317
has answer: http://stackoverflow.com/a/20706988
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/31015366
favorite count: 0
has answer: http://stackoverflow.com/a/63408222
type: Question
has answer: http://stackoverflow.com/a/25234558
has body: Is it possible to put a byte[] (byte array) to JSON? if so, how can I do that in java? then read that JSON and convert that field again to byte[]?
score: 99
has title: Put byte array to JSON and vice versa
has answer: http://stackoverflow.com/a/20706862
has answer: http://stackoverflow.com/a/56712198
accepted answer: http://stackoverflow.com/a/20706988
answer count: 6
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/20706862
upvote count: 99
has comment: http://stackoverflow.com/comment/31039457

http://stackoverflow.com/comment/103723443
type: AnswerComment
has text: You realize how long ago I wrote this. I no longer work at the place where I did this stuff.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20748786

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/20779377
tags question: http://stackoverflow.com/q/20755918

http://stackoverflow.com/comment/31091930
type: Comment
has text: I made it recursive, so I keep checking with the substring function one character at a time. I dont know the input words and I have to deal with them nomatter what the length.
comment on: http://stackoverflow.com/a/20748472
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31248085
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20834538
has text: This isn't possible, because you are not using a `FileInputStream` in your provided code.

http://stackoverflow.com/comment/31114688
has text: Can you tell me in detail where shall I put this code , in the code which I have implemented. This seems confusing without any details.Also in the code no where I have come accross Google drive api used.
type: AnswerComment
comment on: http://stackoverflow.com/a/20760238
type: Comment
score: 0

http://stackoverflow.com/comment/31079407
type: Comment
type: QuestionComment
has text: Please add logging in `onCreate()` of your main activity. See if `onCreate()` is being called when you return to the application via the recent apps screen. If so, you're seeing an Android bug that you'll need to work around.
score: 0
comment on: http://stackoverflow.com/q/20736791

http://stackoverflow.com/a/20794440
has comment: http://stackoverflow.com/comment/31173594
has comment: http://stackoverflow.com/comment/31173627
score: 3
downvote count: 0
has body: The basic problem you have is that you are using the components x/y position where the Graphics context is already translated so that 0x0 is the top/left corner of the component. import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DrawText { public static void main(String[] args) { new DrawText(); } public DrawText() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { setBackground(Color.BLACK); } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(Color.RED); g2d.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2); g2d.drawLine(getWidth() / 2, 0, getWidth() / 2, getHeight()); render(g); g2d.dispose(); } public void render(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.WHITE); Font font = new Font("Verdana", Font.PLAIN, 20); g2d.setFont(font); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FontMetrics fm = g2d.getFontMetrics(); String option = "This is a test"; int x = (getWidth() - fm.stringWidth(option)) / 2; int y = ((getHeight() - fm.getH…
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/20794285
has comment: http://stackoverflow.com/comment/31173695

http://stackoverflow.com/a/20806082
has body: check my eclipse it give output 12 13 12 .The modify method pass-by-value 12 then the i= i + 1; it add one the . package com.demo.swain; public class Demo { public static void main(String[] args) { Integer i = new Integer(12); System.out.println(i); modify(i); System.out.println(i); } private static void modify(Integer i) { i= i + 1; System.out.println(i); } } Output:12 13 12 I strongly talking this code not give output 12 ,12 .
has comment: http://stackoverflow.com/comment/31203427
score: 0
answers question: http://stackoverflow.com/q/20804862
type: Answer
has comment: http://stackoverflow.com/comment/31194678
has comment: http://stackoverflow.com/comment/31194568
has comment: http://stackoverflow.com/comment/31195710

http://stackoverflow.com/q/20816349
has comment: http://stackoverflow.com/comment/31222829
has comment: http://stackoverflow.com/comment/31213330
score: -1
has comment: http://stackoverflow.com/comment/31213147
has comment: http://stackoverflow.com/comment/31213377
answer count: 1
downvote count: 1
has body: Help me to create a class file which consists of JButton and JSlider and Java Graphics. I tried a lot of methods but not working in netbeans 7.2: Jpanel, Jcomponent, paint(), paintComponent(). Can any one give me a class file for example to create that one? My code is here: package floating; import designs.*; import java.awt.*; import javax.swing.*; public class Test extends JFrame { String frame_name; boolean START,PASS; int SPEED=1; JSlider jSlider1 = new javax.swing.JSlider(); JSeparator js=new JSeparator(); JToggleButton jToggleButton1 = new javax.swing.JToggleButton("START"); JToggleButton jToggleButton2 = new javax.swing.JToggleButton("PASS"); Test(String a) { JFrame jf=new JFrame(a); Dimension dim=Toolkit.getDefaultToolkit().getScreenSize(); jf.setSize(dim.width,dim.height-30); jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE); js.setOrientation(SwingConstants.VERTICAL); js.setForeground(Color.red); js.setLocation(dim.width/2,0); js.setPreferredSize(dim); js.setSize(10,dim.height); jf.add(js); jSlider1.setLocation(dim.width-300,20); jSlider1.setSize(250,50); jSlider1.setToolTipText("Set to Seconds"); jSlider1.setMinimum(1);jSlider1.setMaximum(5);jSlider1.setMajorTickSpacing(1);jSlider1.setMinorTickSpacing(1);jSlider1.setValue(1); jSlider1.setPaintLabels(true); jSlider1.setPaintTicks(true); jSlider1.setPaintTrack(true); jSlider1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jSlider1MouseClicked(evt); } }); jf.add(jSlider1); jToggleButton1.setLocation((dim.width/2)+30,25); jToggleButton1.setSize(100,30); jToggleButton1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton1ItemStateChanged(evt); } }); jToggleButton2.setLocation((dim.width/2)+50+100,25); jToggleButton2.setSize(100,30); jToggleButton2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton2ItemSt…
has comment: http://stackoverflow.com/comment/31213369
favorite count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/20816467
type: UnansweredQuestion
tagged with: swing
upvote count: 0
tagged with: java
has title: To create JButton, JSlider and Graphics in a program file
tagged with: jcomponent
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31213415
type: Question

http://stackoverflow.com/comment/31166852
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20790805
score: 0
has text: @user1988876 Right. What I'm saying is that you had it right in the `System.out.println`, but you had it wrong elsewhere.

http://stackoverflow.com/comment/31260632
score: 0
type: AnswerComment
type: Comment
has text: That would only work if `findViewById()` is implemented in Fragment, which it is not. `findViewById()` is only implemented in the Activity.
comment on: http://stackoverflow.com/a/20841842

nio
tags question: http://stackoverflow.com/q/20785409
tags question: http://stackoverflow.com/q/20713016
tags question: http://stackoverflow.com/q/20715945
tags question: http://stackoverflow.com/q/20751041
tag name: nio
type: Tag
tags question: http://stackoverflow.com/q/20692425
tags question: http://stackoverflow.com/q/20694127
tags question: http://stackoverflow.com/q/20697395
tags question: http://stackoverflow.com/q/20752756
tags question: http://stackoverflow.com/q/20724902
tags question: http://stackoverflow.com/q/20740961
tags question: http://stackoverflow.com/q/20743943
tags question: http://stackoverflow.com/q/20746091

http://stackoverflow.com/comment/31254510
score: 0
comment on: http://stackoverflow.com/a/20838298
has text: Is it `readLines` have facility to fetch desired number of rows or just stop after `n` lines, I think it will also load all the lines to memory so it will be problem for big files....
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20733667
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: spring
tagged with: spring-mvc
type: UnansweredQuestion
has title: @Inject adnotation a object dao give null
has answer: http://stackoverflow.com/a/20733685
has body: I get a null pointer exception when trying to inject an object dao in service file. Here is my code: web.xml: contextConfigLocation classpath:/applicationContext.xml, classpath:/hibernateContext.xml applicationContext.xml: <context:component-scan base-package="com.projects.discussion"/> AccountController.java: @Controller @RequestMapping("/users") public class AccountController { @Autowired private AccountService accountService; public String postRegistrionForm(...) { accountService.registerAccount(...); } AccountServiceImpl.java: @Service("accountService") @Transactional(readOnly = true) public class AccountServiceImpl implements AccountService { @Inject private UserDAO userDao; @Transactional(readOnly = false) public boolean registerAccount(User user, Errors errors) { ... userDao.create(user); ... When it comes to registerAccount method in AccountService, stops at userDao.create(). UserDao in the moment is NULL. Why? I tried with @Autowired instead of @Inject, but it didn't help me :( Thank you in advance for your help.

http://stackoverflow.com/comment/31043084
type: Comment
comment on: http://stackoverflow.com/a/20715127
has text: @user3124548: then you are likely doing something wrong, but what is hard to say. Consider editing your question and showing any new code and information at the bottom of your existing question.
type: AnswerComment
score: 0

http://stackoverflow.com/a/20719485
has comment: http://stackoverflow.com/comment/31104931
has comment: http://stackoverflow.com/comment/31060101
score: 0
has comment: http://stackoverflow.com/comment/31052248
has body: Did you try something like this code: myTabhost.getTabWidget() .removeView(myTabhost.getTabWidget() .getChildTabViewAt(myTab)); // myTab is the one you want to close I saw this on this question: Close tab programmatically TabHost Hope you'll have the expected result.
type: Answer
answers question: http://stackoverflow.com/q/20719244

http://stackoverflow.com/a/20731935
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20730915
has comment: http://stackoverflow.com/comment/31061840
type: Answer
has comment: http://stackoverflow.com/comment/31061914
upvote count: 1
has body: You can try to send packages on specific port over the LAN. But for the Internet no.
has comment: http://stackoverflow.com/comment/31061996

http://stackoverflow.com/a/20782984
has comment: http://stackoverflow.com/comment/47616981
has comment: http://stackoverflow.com/comment/31153233
has comment: http://stackoverflow.com/comment/31152929
type: AcceptedAnswer
downvote count: 0
has body: Try this- protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1 &amp;&amp; data != null) { Log.v("TAG", data.getStringExtra("Note")); if(resultCode == RESULT_OK) { listItems.add(data.getStringExtra("Note")); Log.v("TAG", data.getStringExtra("Note")); adapter.notifyDataSetChanged(); listView.invalidateViews(); } if (resultCode == RESULT_CANCELED) { } } }
has comment: http://stackoverflow.com/comment/31152624
type: Answer
has comment: http://stackoverflow.com/comment/31152988
answers question: http://stackoverflow.com/q/20782619
upvote count: 23
accepted answer of: http://stackoverflow.com/q/20782619
score: 23

http://stackoverflow.com/comment/31105157
comment on: http://stackoverflow.com/a/20755743
score: 0
type: AnswerComment
has text: I am running hadoop through Cygwin on windows Platform.Both the namenode and datanode are on the localhost. I just need to know why I can't get any GUI whereas Eclipse can spawn it?
type: Comment

http://stackoverflow.com/comment/31157524
comment on: http://stackoverflow.com/q/20785887
type: Comment
type: QuestionComment
has text: You can read the doc for `contains` and `get`.
score: 0

http://stackoverflow.com/q/20760357
accepted answer: http://stackoverflow.com/a/20760552
type: Question
has answer: http://stackoverflow.com/a/20761072
tagged with: eclipse
has body: I want to change the size of buttons. I want to set a SQUARE type view of each button but unfortunately it is giving a rectangular look. I am getting a square type look only if I set the number of rows to 20 or 25. Right now my GUI looks like the following: . I have tried to change it from buttons[i][j].setMaximumSize(new Dimension( 20, 20)) , Where buttons is the name of array. I have also tried buttons[i][j].setsize but still it has no effect on it. I am setting it from : bPanel.setLayout(new GridLayout(x,y)) and I thing this is the main cause of the problem. Can any one also tell me that how can I set it to layout manager? import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComboBox; import javax.swing.event.*; import javax.swing.JFrame; import sun.util.calendar.Gregorian; public class Final_GUI extends JFrame implements ActionListener { JLabel label; ButtonGroup cbg; JRadioButton radio_1; JRadioButton radio_2; JRadioButton radio_3; JCheckBox checkbox_1; JCheckBox checkbox_2; JCheckBox checkbox_3; JScrollPane scrollpane_1; JComboBox combobox_1; JList list_1; JScrollPane sp_list_1; JComboBox combobox_2; JButton Orange; JButton Exit; JLabel for_text; int x=200; int y=100; int check [][]= new int [x][y]; JFrame frame = new JFrame(); JButton[][] buttons = new JButton[x][y]; JPanel mPanel = new JPanel(); JPanel bPanel = new JPanel(); JPanel cPanel = new JPanel(); JTextArea scoreKeeper = new JTextArea(); int[][] intArray = new int[x][y]; public Final_GUI() { butGen(); score(); Final_GUILayout customLayout = new Final_GUILayout(); getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12)); getContentPane().setLayout(customLayout); label = new JLabel("Shortest Path Finding Algorithm"); getContentPane().add(label); cbg = new ButtonGroup(); radio_1 = new JRadioButton("radio_1", false); cbg.add(radio_1); getContentPane().add(radio_1); radio_2 = new JRadioButton("r…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31114328
has title: How to change the size of button in a Scroll Panel
possible better answer: http://stackoverflow.com/a/20761072
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31113021
has answer: http://stackoverflow.com/a/20760552
tagged with: swing

http://stackoverflow.com/comment/31099101
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20752124
has text: Do you have a JPA Entity defined for User object?

http://stackoverflow.com/comment/31062497
score: 1
has text: +1 There is no `byte` or `short` constants, only `int` (and `long`, `float`, `double`) constants.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20732201

http://stackoverflow.com/a/20819028
score: 1
answers question: http://stackoverflow.com/q/20818906
has body: there are two ways override getPrefferedSize inside class ItemButton use proper LayoutManager, I'd be start with GridLayout
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/a/20747878
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20747663
has body: Try below Gson instance Gson gson = new GsonBuilder().serializeNulls().create();
answers question: http://stackoverflow.com/q/20747663
type: Answer
downvote count: 0
score: 13
upvote count: 13

http://stackoverflow.com/comment/30991834
type: Comment
has text: It's simple code, I've just added event handler that is removing tab from TabPane via setOnClosed(event); method. Nothing special. I'm just wondering if this is correct behavior.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20693073

http://stackoverflow.com/a/20701884
has comment: http://stackoverflow.com/comment/31006463
upvote count: 2
score: 2
has body: long milliSeconds=1228061700000l; DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); //change your date time formate as required Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); System.out.println(formatter.format(calendar.getTime()));
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20701820
answers question: http://stackoverflow.com/q/20701820

http://stackoverflow.com/comment/31025427
type: QuestionComment
comment on: http://stackoverflow.com/q/20711914
has text: @JBNizet If I replace the file's name in code to a `.jpg` one in the same folder, then it loads up file. So the problem must be that `.ico` file can't be read..
score: 0
type: Comment

http://stackoverflow.com/comment/31273388
has text: You may want to avoid using deprecated classes (such as `Vector`). A `List` would work better.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20848358
type: Comment

http://stackoverflow.com/comment/31154291
score: 0
comment on: http://stackoverflow.com/q/20783996
has text: If i try whole 10 more errors pop-up ...can u give a answer for my code .... PS:: im using support fragment manager
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/30997819
score: 0
has text: Hi Yury, Thanks for your quick response! After creating a new string with specific encoding also my special characters are escaping. Any idea behind this..
type: Comment
comment on: http://stackoverflow.com/a/20696519
type: AnswerComment

http://stackoverflow.com/a/20825232
type: Answer
answers question: http://stackoverflow.com/q/20823798
downvote count: 0
score: 5
has body: To add to @Philippe Marshall's correct answer and your comment - REQUIRES_NEW will create a new transaction, independent from the first one. They are not nested. The first transaction is suspended while the second is active. Once the second transaction commits, the first one is resumed. You do not have to setRollbackOnly() manually. Most PersistenceExceptions will do that if needed. You will gain nothing by rolling back transactions that you don't have to. For example, when querying data, you may get a NoResultException or a NonUniqueResultException. They do not cause a transaction to be rolled back as there is no risk of inconsistencies between the persistence context and the DB. You do not need to specify neither @TransactionAttribute(REQUIRED) nor @TransactionManagement(TransactionManagementType.CONTAINER)- both are the default settings. EDIT: to answer your further questions: I am assuming @TransactionAttribute(REQUIRES_NEW) on method2 and therefore two separate transactions. If there is an Exception that leads to the rollback of the transaction in method2, the transaction from method1 will not be rolled back if the Exception is caught. If the Exception is not caught, both transactions will be rolled back. When setting the rollback flag on a transaction, it does not matter whether it happens before or after DB operations, since the entire transaction is rolled back. Once method2 returns, it's transaction is committed. Rolling back or committing the transaction from method1 afterwards has no influence on the results of the first transaction. A general advice - do not catch Throwable - it is much too broad and you might swallow exceptions which you would rather let propagate to the surface.
type: AcceptedAnswer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/20823798

http://stackoverflow.com/a/20697690
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20697638
has comment: http://stackoverflow.com/comment/31001195
has comment: http://stackoverflow.com/comment/30999689
upvote count: 1
has body: Personally, I would do this: if(string.toLowerCase().contains(" name")){ //Random Name generator } EDIT: Upon further revision, I believe regex to be the answer, the regex "\bname\b" would work but you would need to escape it for java so "\\bname\\b" ... @JosefN's answer is the one you want..
has comment: http://stackoverflow.com/comment/30999587
type: Answer
has comment: http://stackoverflow.com/comment/30999677

http://stackoverflow.com/a/20723613
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31046915
has comment: http://stackoverflow.com/comment/31046645
has comment: http://stackoverflow.com/comment/31046590
type: Answer
has body: If it compiles on ubuntu with just ant, there is no need for either maven or eclipse. The problem is likely that the PATH variable does not include the jdk. Look into c:\Programs\Java and find the javadoc.exe. Its directory must go into PATH. To set the dir in PATH, go to (roughly, have no windows around) computer / properties / advanced / environment variables / system and find the PATH variable. Append the directory you found by using semicolon as the separator.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20723437
has comment: http://stackoverflow.com/comment/31046830
accepted answer of: http://stackoverflow.com/q/20723437
upvote count: 1

http://stackoverflow.com/a/20724503
has body: public Completo() { initComponents(); this.button_open.addActionListener(new ActionListener() { ... }); }
answers question: http://stackoverflow.com/q/20723883
type: Answer
has comment: http://stackoverflow.com/comment/31048476
score: 0
has comment: http://stackoverflow.com/comment/31048445
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20723883
has comment: http://stackoverflow.com/comment/31048424

http://stackoverflow.com/comment/31077501
type: QuestionComment
comment on: http://stackoverflow.com/q/20740678
has text: That's what Java decided.
score: 0
type: Comment

http://stackoverflow.com/q/20714320
tagged with: 2d
tagged with: java
has answer: http://stackoverflow.com/a/20714358
score: 0
answer count: 1
has title: Pixels not Aligned Correctly
accepted answer: http://stackoverflow.com/a/20714358
type: AnsweredQuestion
has body: I'm attempting to align my pixels for a game I am going to make, however, I can't seem to get them correct. My frame is 500x500px and I'm painting a 20x20 pixel at 250x 250y, however it does not look center at all: (Can't embed image) http://puu.sh/5TkCa.png I double checked that it was at 250, 250 using g.fillRect(250, 250, 20, 20); Am I missing something?
type: Question
tagged with: graphics

http://stackoverflow.com/comment/31164315
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20789418
has text: i have edited the post with error
score: 0

http://stackoverflow.com/comment/31130371
type: Comment
type: QuestionComment
has text: @Amulya Khare yes i want to remove all d characters
score: 0
comment on: http://stackoverflow.com/q/20769908

http://stackoverflow.com/comment/31196908
has text: for best results use `<T extends Comparable<? super T>>`
comment on: http://stackoverflow.com/q/20793082
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/20752722
has answer: http://stackoverflow.com/a/20752815
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31099733
has title: Cannot access components using reference
has comment: http://stackoverflow.com/comment/31099676
possible better answer: http://stackoverflow.com/a/20752815
tagged with: java
has answer: http://stackoverflow.com/a/20752800
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31101507
score: 0
accepted answer: http://stackoverflow.com/a/20752800
has body: I cannot make a reference to the class Colours from the class Square. I have created a reference before, but this seems to be happening when the class extends another class such as Canvas in this case. Here is my code: Colours: import java.awt.*; import javax.swing.*; public class Colours extends Canvas { Colours(){ JPanel menupn; ButtonGroup group; JRadioButton square; JRadioButton rect; JRadioButton circle; JFrame frame; JPanel sqpn; JPanel crpn; JPanel rtpn; Circle Circle; Rect Rect; Square Square; Circle = new Circle(); Rect = new Rect(); Square = new Square(this); menupn = new JPanel(); group = new ButtonGroup(); square = new JRadioButton("Square"); rect = new JRadioButton("Rectangle"); circle = new JRadioButton("Circle"); frame = new JFrame("Colours"); frame.setSize(1000,500); frame.setLayout(null); group.add(square); group.add(circle); group.add(rect); group.setSelected(square.getModel(),true); square.addActionListener(Square); circle.addActionListener(Circle); rect.addActionListener(Rect); menupn.setLayout(new GridLayout(3,1)); menupn.add(square); menupn.add(circle); menupn.add(rect); menupn.setBounds(0, 360, 1000, 100); this.setBackground(new Color(255,255,255)); this.setBounds(0,0,1000,400); frame.add(menupn); frame.add(this); frame.setVisible(true); } public void paint(Graphics g){ g.fillRect(0,0,50,50); g.fillOval(100,100,50,50); g.fillRect(200,200,100,50); } public static void main(String[] args) { Colours Colours = new Colours(); } } Shape: import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JTextField; import javax.swing.JPanel; import javax.swing.JLabel; public class Square implements ActionListener { Colours Colours; JPanel panel; JTextField colfld1; JTextField colfld2; JTextField colfld3; JTextField locx; JTextField locy; Square(Colours Colours){ this.Colours = Colours; } public void actionPerformed(ActionEvent e) { panel = new JPanel(); colfld1 = new JTextField(3); colfld2 = new JTextF…

http://stackoverflow.com/q/20766430
downvote count: 2
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20766449
score: -1
tagged with: arraylist
answer count: 3
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20766528
has title: Java: How do I do indexOf in an arraylist while looking for two arguments
has answer: http://stackoverflow.com/a/20766435
has body: I am currently writing a Java BlueJ project to create a poker game, and i need to set up a class for a Hand that's holding cards. I've set up a deck class that just basically generates 52 cards in order. each card has two parameters, a rank, and a suit. What i do in my hand class is I take a random card from the deck (or rather create one), and just so that I don't have copies, I want to be able to remove that card from the Deck. seeing as the cards produced are random, I'm not sure how i can take that card and remove it from the deck. Is there any way to take the card I just generated into my hand and take it out of my Deck using remove() and/or indexOf? (Keep in mind that both the deck and the hand class are ArrayLists)
tagged with: java

http://stackoverflow.com/comment/31201010
has text: I understand but it would be better for you to just post the requirements and some initial code and let people help you. The way you did it is post a generic title, with some very bad/incomplete code. That's not helping people help you. That's why people are voting your question down.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20809620

http://stackoverflow.com/comment/31108219
type: Comment
score: 2
has text: Voting on posts is one of the main features of this site. It doesn't require being the person who asked the question, or a moderator (like me.) Further, when people explain their vote, it's a good idea to at least think about what they've said. And finally, it's *required* that you be polite.
type: AnswerComment
comment on: http://stackoverflow.com/a/20756260

http://stackoverflow.com/q/20792111
type: Question
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/31169267
answer count: 1
has comment: http://stackoverflow.com/comment/31169300
has comment: http://stackoverflow.com/comment/31190527
type: UnansweredQuestion
tagged with: interface
has title: Java interface and extending ArrayList
has comment: http://stackoverflow.com/comment/31169308
tagged with: java
has answer: http://stackoverflow.com/a/20792327
has body: I am trying to understand Java and I found this code in a text book: public EArrayList filt(Func a) { } where apply is in an interface called Func I understood that this method applies a function filter on a list and returns a new list filtered. However I can't understand why Object elem is used. I tried the code and it won't work if I rename Object. Also I can't understand the following line: if((Boolean)a.apply(elem) == true) (what does Boolean stand for apart from return type) Can someone send me a good link to understand better how this works since I searched a lot about interfaces and never came across this format.

http://stackoverflow.com/comment/31129754
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20768720
has text: StringBuffer guarantees that multiple concurrent calls on the object are done one by one, but nothing more. So what is your need?

http://stackoverflow.com/q/20782009
has answer: http://stackoverflow.com/a/20782111
has answer: http://stackoverflow.com/a/20782055
has title: I want to get value from one method in one class to another class
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20783478
tagged with: methods
type: Question
tagged with: class
tagged with: get
score: 0
answer count: 3
has body: I want to get value from one method in one class to another class. i.e get vale of myinput from method run in connection.class to another variable in another class called search.class connection.class public final void run(){ ...................................................... .................................... String myinput=inputLine.substring(5); movedata(myinput); System.out.println("Database selected: "+myinput);} handleCommand(inputLine); } } catch (Exception e) { e.printStackTrace(); } finally { SessionContext.unset(); } owConnection.close(); } public String movedata(String myinput){ return myinput; } I wish to get the value of myinput into another class called search.class

http://stackoverflow.com/a/20841907
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20798096
type: Answer
upvote count: 6
has body: I build to Android 4.3 and it worked like a charm.
score: 6
accepted answer of: http://stackoverflow.com/q/20798096

http://stackoverflow.com/comment/105747416
comment on: http://stackoverflow.com/a/59803391
score: 0
has text: True, assuming you don't override `toString()`
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20744456
has comment: http://stackoverflow.com/comment/31084459
has body: Is it possible to recover source code of java classes (not all), after build in Maven?? I have got compiled jar, but I deleted two classes of my code.. Thx for helping.
favorite count: 0
tagged with: maven
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31084167
has answer: http://stackoverflow.com/a/20744649
tagged with: eclipse
type: Question
has title: Is it possible to recover classes source code from Maven jar?
tagged with: recover
downvote count: 0
has comment: http://stackoverflow.com/comment/31084127
accepted answer: http://stackoverflow.com/a/20744649
answer count: 1

http://stackoverflow.com/comment/31012721
has text: try this: ` /foo ` and then visit `${host}:${port}/${app_context}/foo`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20705003

http://stackoverflow.com/comment/31018316
has text: Ummm, a simple while loop would do?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20708358

http://stackoverflow.com/comment/31240653
has text: @user2864740 null if the end of the stream has been reached. How is the stream reached? Is it reached because I press enter after the y or n answer at the prompt function?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20830637

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/20750774

http://stackoverflow.com/q/20805723
tagged with: java
has comment: http://stackoverflow.com/comment/31193520
type: Question
answer count: 2
has body: I'm trying to make a simple countdown from a text edit. I then created the edit text and the recovery value contained in it and then I made a while. follows the code. while(counter&lt;second) { Toast.makeText(getBaseContext(), "Countdown: "+counter++, Toast.LENGTH_LONG).show(); counter++; if(counter==second) { break; } } The variable second is an int String seconds = editText.getText().toString(); second = Integer.valueOf(seconds); When I execute my code malfunctioning showing the wrong numbers. where is the error(s)?
score: 0
has answer: http://stackoverflow.com/a/20805800
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20805834
has title: simple countdown in a toast using edit text
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/20745168
has title: How to use two web methods for two different operations using Restful webservices?
possible better answer: http://stackoverflow.com/a/20745216
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20745216
answer count: 3
has body: I am using Jersey Restful webservices. I have below web method to get the results. @Path("/persons") public class PersonWS { private final static Logger logger = LoggerFactory.getLogger(PersonWS.class); @Autowired private PersonService personService; @GET @Path("/{id}") @Produces({MediaType.APPLICATION_XML}) public Person fetchPerson(@PathParam("id") Integer id) { return personService.fetchPerson(id); } @DELETE @Path("/{id}") public void deletePerson(@PathParam("id") Integer id) { return personService.deletePerson(id); } } In above Jersey RESTful webservice, i have two web methods one for get and one more for delete with same number of parameters. In above case will there be any ambiguity? If not what should be the URIs for both of the methods? Thanks! Thanks!
has answer: http://stackoverflow.com/a/20745317
tagged with: jersey
has answer: http://stackoverflow.com/a/20745271
tagged with: rest
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20745317
type: Question
tagged with: web-services

http://stackoverflow.com/comment/31152844
has text: how to remove child element from xml?
score: 0
comment on: http://stackoverflow.com/q/20782400
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20700629
has comment: http://stackoverflow.com/comment/31007002
upvote count: 1
has comment: http://stackoverflow.com/comment/31007577
downvote count: 0
has comment: http://stackoverflow.com/comment/31007542
has comment: http://stackoverflow.com/comment/31007642
has body: Try to dismiss your progressdialog at the start of your onPostExecute method. @Override protected void onPostExecute(List&lt;Map&lt;String, Object&gt;&gt; result) { super.onPostExecute(result); if (Loading.isShowing()){ Loading.dismiss(); } ..........//your code .................}
type: Answer
has comment: http://stackoverflow.com/comment/31007605
answers question: http://stackoverflow.com/q/20700531
score: 1

http://stackoverflow.com/q/20843401
has title: how to pass an object to another object in java
favorite count: 0
has comment: http://stackoverflow.com/comment/31263371
has comment: http://stackoverflow.com/comment/31263422
has comment: http://stackoverflow.com/comment/31263448
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/31263535
tagged with: java
accepted answer: http://stackoverflow.com/a/20843683
has comment: http://stackoverflow.com/comment/31263454
has comment: http://stackoverflow.com/comment/31263583
has comment: http://stackoverflow.com/comment/31263393
has comment: http://stackoverflow.com/comment/31263562
type: Question
tagged with: object
possible better answer: http://stackoverflow.com/a/20843502
score: -2
has answer: http://stackoverflow.com/a/20843502
has comment: http://stackoverflow.com/comment/31263518
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/31263447
has comment: http://stackoverflow.com/comment/31263349
has body: I am new to java in general but I am having a lot of trouble with objects specifically. I have a project to pass an object to another object. I've looked all over the internet for help, my online java textbook doesn't explain objects in detail. So my question is, how would you pass an object to another object. -Thank you in advance
has answer: http://stackoverflow.com/a/20843683
has comment: http://stackoverflow.com/comment/31263425

http://stackoverflow.com/comment/31131828
comment on: http://stackoverflow.com/q/20770702
score: 0
has text: @MartinWun what is line 81 `MainPlyaer.java`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20790746
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31166696
has comment: http://stackoverflow.com/comment/31167019
has comment: http://stackoverflow.com/comment/31166857
tagged with: bit
tagged with: integer
has comment: http://stackoverflow.com/comment/31166733
has answer: http://stackoverflow.com/a/20790923
has title: clarification needed on Java's 32-bit integer representation system?
has comment: http://stackoverflow.com/comment/31167015
score: 1
tagged with: java
tagged with: bit-manipulation
has body: I need some clarifications regarding the binary representation of decimal in Java (or any other language for that matter). pardon, if this is too basic, but I need to understand it thoroughly. x = 31 is represented in Java 32 bit as: x — &gt; 00000000 00000000 00000000 00011111 // the binary to decimal conversion is achieved by: 2^4+2^3+2^2+2^1+2^0=31 Now, if you consider all the bits turned on, except the signed bit (most significant bit), we get y -&gt; 01111111 11111111 11111111 11111111 and binary to decimal conversion by summing powers of 2 will be: 2^31+2^30………+2^3+2^2+2^1+2^0=4294967295. however, if you do: System.out.println(Integer.parseInt("1111111111111111111111111111111",2)); you get: 2147483647 which is 2^31-1 so it means, the when 31 bits are turned on, I do not get the additive sum of the powers of 2. why is this? may be I did not understand something, if some one could clarify that will be very helpful. In case this helps: All the two raise powers till 31 are in this list: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648] EDIT: I corrected the y-representation, now it has 32 bits, but if you calculate the 31 bits that are turned on with summing the powers, you would get 4294967295. I have one liner in python here &gt;&gt;&gt; reduce(lambda x,y: x+y, [pow(2,i) for i in range(32)]) 4294967295
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20790805
has answer: http://stackoverflow.com/a/20790933
has comment: http://stackoverflow.com/comment/31167001
accepted answer: http://stackoverflow.com/a/20790805
has comment: http://stackoverflow.com/comment/31166973
has comment: http://stackoverflow.com/comment/31166698
possible better answer: http://stackoverflow.com/a/20790923
answer count: 3
has comment: http://stackoverflow.com/comment/31166868
has comment: http://stackoverflow.com/comment/31166802

http://stackoverflow.com/a/20835732
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31341774
has comment: http://stackoverflow.com/comment/31328368
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31295150
accepted answer of: http://stackoverflow.com/q/20832271
answers question: http://stackoverflow.com/q/20832271
score: 2
downvote count: 0
has body: You need to download mysql-connector-java-5.1.13-bin.jar and then set your classpath. here the link to download
has comment: http://stackoverflow.com/comment/31328357

http://stackoverflow.com/comment/31118115
has text: For performing operations on Entities we use Dao's (Data access objects.) Dao can be EJB. But for holding data you should create DTO's. That DTO's aren't container managed, so you can have multiple independed instances of it. `Stock is a bean that hold the logic for managing a stock` - that's right, but Stock shouldn't contain stock. This should be different object, and not EJB.
comment on: http://stackoverflow.com/a/20763327
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20830760
score: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: audio
has title: Libgdx AssetsManager - Sounds Loaded but "Not Loaded Error"?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31243477
has comment: http://stackoverflow.com/comment/31244522
type: Question
has answer: http://stackoverflow.com/a/20833551
has body: When using LibGDX's AssetsManager, I've implement an AssetsManager for managing Sounds, and made it global. The files are all located within ../data/sounds/.* (example: ../data/sounds/buttons/buttonl.mp3) Then I load sound files into the manager, and then include some code to play those sounds. Code below: public final class Sounds { private static HashMap&lt;String, HashMap&lt;String, String&gt;&gt; entries = new HashMap&lt;String, HashMap&lt;String, String&gt;&gt;(); private static HashMap&lt;String, String&gt; currentPackage = new HashMap&lt;String, String&gt;(); public static Sound sound; public Sounds() { addPath( "Main", "bgm", "data/sounds/main/title.mp3", "buttonl", "data/sounds/buttons/buttonl.mp3", "buttonh", "data/sounds/buttons/buttonh.mp3"); //... More paths with more sound assets } public static boolean addPath(String packageName, String... args) { if(!entries.containsKey(packageName)) { entries.put(packageName, new HashMap&lt;String, String&gt;()); for(int i = 0; i &lt; args.length; i ++) entries.get(packageName).put(args[i], args[++i]); return true; } return false; } public static void loadSoundAssets(String packageName) { for(String str : entries.get(packageName).values()) s_manager.load(str, Sound.class); s_manager.finishLoading(); } public static boolean play(String file) { if(currentPackage.containsKey(file)) { sound = s_manager.get(file, Sound.class); sound.play(); return true; } return false; } } After creating the Sound class in a higher class with public class Game implements ApplicationListener{ public Sounds gameSounds = new Sounds(); public Screen currentScreen = new MainMenuScreen(); //... More class variables and methods public void render() { currentScreen.update(); } } The problem comes when I call public class MainScreen() extends Screen { public MainScreen() { Sounds.loadSoundAssets("Main"); //... More constructor variables and methods } //... Class variables and methods public void update() { if(s_manager.update()) { if(play.getBoun…
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/20833551
answer count: 1
downvote count: 0

http://stackoverflow.com/q/20718289
has answer: http://stackoverflow.com/a/20718369
tagged with: java
has body: I've been searching everywhere for how to take input from the keyboard. I can find a ton of resources for how to modify what keylistener does on key press, I can find how to add it to a swing text line, and plenty of other miscellaneous things about it. But I can't find out how to actually put it in a file and use it. For now I just want to have a main class whose main function just has an endless loop, and everytime you press a key it prints "Key _ has been pressed". How do I do this? I've made a MyKeyListener that extends KeyAdapter that includes the system.out.print of the string under keyPressed (I assume this is workable). But what do I put in the main class to actually use it? Including it and initializing isn't enough. Here is my key listener file : ` import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; public class GKeyListener extends KeyAdapter { public void keyPressed(KeyEvent e){ System.out.println("Key Pressed: " + e.getKeyChar()); } public void keyReleased(KeyEvent e){ System.out.println("Key Released: " + e.getKeyChar()); } public void keyTyped(KeyEvent e){ System.out.println("Key Typed: " + e.getKeyChar()); } Here is a main file im working with and don't know where to go from: import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.event.KeyEvent; public class tempMain { public static void main(String[] args){ while(true){ GKeyListener listen =new GKeyListener(); //addKeyListener(listen); } }
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20718368
score: 0
has comment: http://stackoverflow.com/comment/31036991
favorite count: 0
type: UnansweredQuestion
has title: Java: How do you actually use KeyListener?
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/31109666
type: QuestionComment
has text: This can maybe help you http://www.mkyong.com/spring-security/spring-security-form-login-using-database/
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20758479

sftp
tags question: http://stackoverflow.com/q/20802815
tag name: sftp
type: Tag
tags question: http://stackoverflow.com/q/20724938
tags question: http://stackoverflow.com/q/20782194
tags question: http://stackoverflow.com/q/20824386

http://stackoverflow.com/comment/31028349
has text: The values I receive when I print "policyCount" and "itemAmount" are 0, which is wrong. Sorry, I should've clarified that in the original post.
comment on: http://stackoverflow.com/q/20713355
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20716407
upvote count: 33
has body: JPA itself doesn't care whether the collection is initialized or not. When retrieving an Order from the database with JPA, JPA will always return an Order with a non-null list of OrderLines. Why: because an Order can have 0, 1 or N lines, and that is best modeled with an empty, one-sized or N-sized collection. If the collection was null, you would have to check for that everywhere in the code. For example, this simple loop would cause a NullPointerException if the list was null: for (OrderLine line : order.getLines()) { ... } So it's best to make that an invariant by always having a non-null collection, even for newly created instances of the entity. That makes the production code creating new orders safer and cleaner. That also makes your unit tests, using Order instances not coming from the database, safer and cleaner.
score: 33
answers question: http://stackoverflow.com/q/20715143
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20715143
type: Answer
has comment: http://stackoverflow.com/comment/90448572

http://stackoverflow.com/a/20841933
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31262508
accepted answer of: http://stackoverflow.com/q/20841855
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31262927
upvote count: 1
answers question: http://stackoverflow.com/q/20841855
has comment: http://stackoverflow.com/comment/31261964
has body: while (read) { synchronized (buffer) { try { bytes = inputStream.blockingRead(buf); Your problem is not in reading often; it is in blocking. You acquire the monitor on buffer and then enter a blocking I/O call. You spend precious little time outside of that call, thus outside of the synchronized block. Advice: First read from port outside of synchronized, then acquire the monitor to transfer the data to a shared structure.

http://stackoverflow.com/comment/31114123
comment on: http://stackoverflow.com/a/20755146
type: Comment
has text: Oh, that's what you mean. Projecting points is doable, but implementing a surface plot (http://goo.gl/CteZjO) which can move/rotate from scratch is way too much work. I'm sure there are libraries that take care of it.
score: 0
type: AnswerComment

http://stackoverflow.com/a/20767987
upvote count: 3
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20767966
has body: AssertionError isn't being thrown. Add -ea (enabling assertions) to the Java command arguments when running your application.
answers question: http://stackoverflow.com/q/20767966
score: 3

http://stackoverflow.com/comment/31203998
has text: 1 question i'm trying to do the getter and setter found a cool tutorial in java brain. can i still get the value of name even if i dont have an input text in the login i mean the name that im getting is only found in the database not in log in page.so how can i set that value o setter to get the value of name from the database?
comment on: http://stackoverflow.com/a/20811126
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31109802
type: QuestionComment
comment on: http://stackoverflow.com/q/20758424
score: 1
has text: A POJO is specifically any plain object which doesn't follow a coding standard such a JavaBean.
type: Comment

http://stackoverflow.com/q/20790112
answer count: 1
downvote count: 0
favorite count: 0
tagged with: sockets
has title: Make socket wait for input from JTextArea
has comment: http://stackoverflow.com/comment/31165487
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31165590
tagged with: network-programming
upvote count: 1
has answer: http://stackoverflow.com/a/20790229
accepted answer: http://stackoverflow.com/a/20790229
has body: I am trying to learn a bit more about networking, sockets, udp etc.. // main method: Socket clientSocket = new Socket("localhost", 10007); PrintWriter clientSocketOutputStream = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader clientSocketInputStream = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); Scanner userInputReader = new Scanner(System.in); String providedInput; while ((providedInput = userInputReader.nextLine()) != null) { clientSocketOutputStream.println(providedInput); displayOnConsole("You have provided text: " + providedInput); String responseFromTheServer = clientSocketInputStream.readLine(); System.out.println("Server has responded: " + responseFromTheServer); System.out.println(waitingForInputText); } // rest of the code... So this little code I have works well. ( I have a ServerSocket which runs fine on localhost ). However now I am trying to do this by GUI, not by commandline. I have a simple JTextArea, and a JButton. I am stuck at: while ((providedInput = userInputReader.nextLine()) != null) How can I invoke the clientSocketOutputStream, everytime I hit the Jbutton and print the text from the JTextArea? Shall I put a dead while(true) loop just to make sure the socket is waiting? Something tells me there must be another way.

http://stackoverflow.com/comment/31162362
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20788399
score: 2
has text: I would suggest reading a good intro to java book.

http://stackoverflow.com/comment/31167001
comment on: http://stackoverflow.com/q/20790746
score: 0
has text: @SotiriosDelimanolis: please see my edit, that typo of mistakenly including an extra one, does not make it invalid
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20713341
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/20713450
has answer: http://stackoverflow.com/a/20713398
has answer: http://stackoverflow.com/a/20713590
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
downvote count: 4
has body: Recently I've got an interesting problem with getting json string out of the object using gson library. My object has a simple form: class MyObject{ public String myString = "{\"payload\":\"test\"}"; setters &amp; getters } The value of myString is a json string. So when I'm trying to use MyObject myObject = new myObject(); Gson gson = new Gson(); String payload = gson.toJson(myObject); I got an exception saying: Failed to process Expression Evaluation "json:payload". So it looks like gson is trying to parse the value of the field in myObject, which is unexpected and weird. How can I prevent gson to try to parse value of my variable? Thanks, Laura.
upvote count: 0
has comment: http://stackoverflow.com/comment/31028106
favorite count: 0
has title: How can I prevent gson to try to parse value of my variable?
answer count: 3
has comment: http://stackoverflow.com/comment/31028586

http://stackoverflow.com/a/20810845
downvote count: 0
has comment: http://stackoverflow.com/comment/31244868
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31203208
answers question: http://stackoverflow.com/q/20810798
has body: You are creating an ActionListener, but you give it nothing to listen to. Fortunately, JButton, through its AbstractButton superclass, has an addAction method. Create an Action instance, usually through its concrete implementation AbstractAction, and add it to the button. The advantage of Action over ActionListener is that you can add it to JMenuItems too.
upvote count: 1

http://stackoverflow.com/comment/31072425
comment on: http://stackoverflow.com/q/20737376
score: 0
has text: @ElliottFrisch No it is not working...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31043526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20721787
score: 1
has text: Okay Pshemo that was smart said, didn't think about that, sorry.

http://stackoverflow.com/comment/31082514
type: AnswerComment
score: 0
type: Comment
has text: I know that.. if we have explicit constructor in any class.. that will overtake the default implicit constructor.
comment on: http://stackoverflow.com/a/20743159

http://stackoverflow.com/comment/36345448
comment on: http://stackoverflow.com/q/20750972
type: Comment
type: QuestionComment
score: 0
has text: I got problem with parsing tags with HtmlUnit. I just posted it(http://stackoverflow.com/questions/23661147/loading-elements-with-object-tag-in-htmlunit) before I got here. Did you solve your problem?

http://stackoverflow.com/a/20826888
has body: Java supports tail-recursive calls, but AFAIK it doesn't optimize them away. I think it's the Scala compiler that is simply capable of this, not the JVM itself. Check out the @tailrec annotation in Scala to see what more the compiler is capable of :) But regardless of whether Java/JVM optimizes tail-recursion away, your function would be harder to optimize than necessary. Look at this: int sum(List&lt;Integer&gt; integers) { return sum(integers, 0); } int sum(List&lt;Integer&gt; integers, int sumSoFar) { if (integers.isEmpty()) return sumSoFar; else return sum( integers.subList(1, integers.size()), sumSoFar + integers.get(0) ); } See, I've added an overloaded sum with a so-far calculated sum parameter. This way when you recur in the else branch you don't need the actual stack frame any more - you got all you need as function arguments in the recursive call. In your snippet the stack frame would probably have to exist as long as the recursive call..
upvote count: 21
downvote count: 1
answers question: http://stackoverflow.com/q/20826786
accepted answer of: http://stackoverflow.com/q/20826786
score: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/97858419
type: Answer
has comment: http://stackoverflow.com/comment/31237376
has comment: http://stackoverflow.com/comment/31238084

http://stackoverflow.com/a/20796119
has comment: http://stackoverflow.com/comment/47275824
has comment: http://stackoverflow.com/comment/31176763
downvote count: 0
answers question: http://stackoverflow.com/q/20796046
upvote count: 51
score: 51
has body: Classloader hierarchy Whenever a new JVM is started the bootstrap classloader is responsible to load key Java classes (from java.lang package) and other runtime classes to the memory first. The bootstrap classloader is a parent of all other classloaders. Consequently, it is the only one without a parent. Next comes the extension classloader. It has the bootstrap classloader as parent and is responsible for loading classes from all .jar files kept in the java.ext.dirs path–these are available regardless of the JVM’s classpath. The third and most important classloader from a developer’s perspective is the system classpath classloader, which is an immediate child of the extension classloader. It loads classes from directories and jar files specified by the CLASSPATH environment variable, java.class.path system property or -classpath command line option. ClassLoader Namespace In Java a class is uniquely identified using ClassLoader + Class as the same class may be loaded by two different class loaders. Class A loaded by ClassLoader A != Class A loaded by ClassLoader B How is it helpful? It is helpful for defining different protection and access policies for different classloaders. Take an example of applet which is loaded using a different classloader, you would not want a third party application all access to your resources. So for security its important to maintain different namespaces.
type: Answer
has comment: http://stackoverflow.com/comment/31176484

http://stackoverflow.com/comment/31131512
type: Comment
has text: In that case, I think you asked the wrong Question. See this Q&A for some alternatives: http://stackoverflow.com/questions/10536221/fetching-maven-artifacts-programmatically
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20767808

http://stackoverflow.com/a/20781192
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20781060
has body: You can use xml for loading the words like below: res/values/strings.xml: <?xml version="1.0" encoding="utf-8"?> Mercury Venus Earth Mars In class file: Resources res = getResources(); String[] planets = res.getStringArray(R.array.planets_array); Source

http://stackoverflow.com/comment/30972645
comment on: http://stackoverflow.com/a/20682841
has text: Nevertheless, the advice you gave is sound :)
score: 0
type: AnswerComment
type: Comment

postorder
type: Tag
tag name: postorder
tags question: http://stackoverflow.com/q/20744203

http://stackoverflow.com/comment/31068977
type: AnswerComment
has text: BTW, I'm using NetBeans 7.3.1
type: Comment
comment on: http://stackoverflow.com/a/20700831
score: 0

http://stackoverflow.com/q/20712427
has body: I would like to know if it is possible to use ctags to extract class usage from within Java methods. So far, I was able to only use it to get a listing of methods and instance variables but not which classes are utilized within methods. E.g. ... public void doSomething(MyClass myClassInst) { int someVar = myClassInst.getSomeVar(); System.out.println("Some var is " + someVar); } ... Right now all I get is a recognition of the method declaration. But I would like to extract that doSomething is also utilizing the classes MyClass and System but not just to parse the text but also know the full class address including the package (java.lang.System and com.mypackage.MyClass). In order to be able to extract this kind of metadata, ctags would need to have access to the compiler's abstract syntax tree and I am not sure if it does that or it simply does text parsing of the source code. Is there a way to accomplish what I am trying to do using ctags or does it eclipse the scope of its functionality?
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31578588
has answer: http://stackoverflow.com/a/24681672
favorite count: 0
has comment: http://stackoverflow.com/comment/31577756
has title: Extracting class usage from within Java methods using ctags
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/31658954
has comment: http://stackoverflow.com/comment/31658497
upvote count: 6
has comment: http://stackoverflow.com/comment/31690087
tagged with: java
has comment: http://stackoverflow.com/comment/31654964
has comment: http://stackoverflow.com/comment/31659373
tagged with: ctags
type: Question
tagged with: abstract-syntax-tree

http://stackoverflow.com/a/66416302
upvote count: 3
has body: in kotlin you can inline fun &lt;reified T&gt; parseData(row :String): T{ return Gson().fromJson(row, object: TypeToken&lt;T&gt;(){}.type) }
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/20773850

http://stackoverflow.com/a/20809013
type: Answer
has comment: http://stackoverflow.com/comment/31207359
has comment: http://stackoverflow.com/comment/32854206
has comment: http://stackoverflow.com/comment/31206053
has comment: http://stackoverflow.com/comment/31207598
has comment: http://stackoverflow.com/comment/31206919
has comment: http://stackoverflow.com/comment/31206043
score: 22
has comment: http://stackoverflow.com/comment/31206297
upvote count: 22
has comment: http://stackoverflow.com/comment/31206164
downvote count: 0
has body: Well, I'm not sure if Marko was intentional in replicating the original mistake. TL;DR; new instance is not used, gets eliminated. Adjusting the benchmark reverses the result. Don't trust faulty benchmarks, learn from them. Here's the JMH benchmark: @OutputTimeUnit(TimeUnit.MICROSECONDS) @BenchmarkMode(Mode.AverageTime) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 3, time = 1) @Fork(3) @State(Scope.Thread) public class Chars { // Source needs to be @State field to avoid constant optimizations // on sources. Results need to be sinked into the Blackhole to // avoid dead-code elimination private String string; @Setup public void setup() { string = "12345678901234567890"; for (int i = 0; i &lt; 10; i++) { string += string; } } @GenerateMicroBenchmark public void newChar_DCE(BlackHole bh) { int len = string.length(); for (int i = 0; i &lt; len; i++) { Character c = new Character(string.charAt(i)); } } @GenerateMicroBenchmark public void justChar_DCE(BlackHole bh) { int len = string.length(); for (int i = 0; i &lt; len; i++) { Character c = Character.valueOf(string.charAt(i)); } } @GenerateMicroBenchmark public void newChar(BlackHole bh) { int len = string.length(); for (int i = 0; i &lt; len; i++) { Character c = new Character(string.charAt(i)); bh.consume(c); } } @GenerateMicroBenchmark public void justChar(BlackHole bh) { int len = string.length(); for (int i = 0; i &lt; len; i++) { Character c = Character.valueOf(string.charAt(i)); bh.consume(c); } } @GenerateMicroBenchmark public void newChar_prim(BlackHole bh) { int len = string.length(); for (int i = 0; i &lt; len; i++) { char c = new Character(string.charAt(i)); bh.consume(c); } } @GenerateMicroBenchmark public void justChar_prim(BlackHole bh) { int len = string.length(); for (int i = 0; i &lt; len; i++) { char c = Character.valueOf(string.charAt(i)); bh.consume(c); } } } ...and this is the result: Benchmark Mode Samples Mean Mean error Units o.s.Chars.justChar avgt 9 93.051 0.365 us/op o.s.Chars.ju…
has comment: http://stackoverflow.com/comment/31206763
answers question: http://stackoverflow.com/q/20807388
has comment: http://stackoverflow.com/comment/31207470

http://stackoverflow.com/q/20711607
type: Question
tagged with: multithreading
tagged with: android
has title: Null exception in Thread
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31024524
has comment: http://stackoverflow.com/comment/31024510
answer count: 1
has comment: http://stackoverflow.com/comment/31024639
has comment: http://stackoverflow.com/comment/31024624
has answer: http://stackoverflow.com/a/20712094
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31024483
has body: Before you search algorithm in the file manager. What is wrong? import java.io.File; public class SearchThread extends Thread { MainActivity ob = new MainActivity(); Search ob2 = new Search(); String searchString = new String(); String stringDirectory = new String(); public SearchThread(String string, String directory) { searchString = string; stringDirectory = directory; start(); } public void run() { File directory = new File(stringDirectory); search(directory.listFiles()); } public void search(File[] directory) { for(File a : directory) { if(a.isDirectory()) { search(a.listFiles()); } else if(ob2.cutFormat(a.getName()) == searchString) { ob.giveMeString(a.getAbsolutePath()); } } } } Message in log: 12-21 00:28:40.550 13147-13298/com.example.myproject E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-256 java.lang.NullPointerException at com.example.myproject.SearchThread.run(SearchThread.java:21) 12-21 00:28:40.558 471-482/? E/SurfaceFlinger﹕ #### captureScreenImplLocked Line number 21: " public void search(File[] directory) {" I pass from another class path from where to start as a string, and the string with the name of the item I'm looking for.
has comment: http://stackoverflow.com/comment/31024565

http://stackoverflow.com/comment/31097975
comment on: http://stackoverflow.com/q/20750932
has text: `public Boolean getBoolean(int index){ System.out.println(watcherMap.get(index).getClass()); return (boolean) watcherMap.get(index); }` I tried this, before the crash, nothing is printed, but it says it's on that line.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/20711185
downvote count: 0
has comment: http://stackoverflow.com/comment/31024144
has answer: http://stackoverflow.com/a/20711570
has comment: http://stackoverflow.com/comment/31024033
favorite count: 0
accepted answer: http://stackoverflow.com/a/20711344
has comment: http://stackoverflow.com/comment/31024050
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/20711344
has body: I'm not used to working with really large datasets and I'm kind of stumped here. I have the following code: private static Set&lt;String&gt; extractWords(BufferedReader br) throws IOException { String strLine; String tempWord; Set&lt;String&gt; words = new HashSet&lt;String&gt;(); Utils utils = new Utils(); int articleCounter = 0; while(((strLine = br.readLine()) != null)){ if(utils.lineIsNotCommentOrLineChange(strLine)){ articleCounter++; System.out.println("Working article : " + utils.getArticleName(strLine) + " *** Article #" + articleCounter + " of 3.769.926"); strLine = utils.removeURLs(strLine); strLine = utils.convertUnicode(strLine); String[] temp = strLine.split("\\W+"); for(int i = 0; i &lt; temp.length; i++){ tempWord = temp[i].trim().toLowerCase(); if(utils.validateWord(tempWord)){ words.add(tempWord); System.out.println("Added word " + tempWord + " to list"); } } } } return words; } This basically gets a huge text file from the BufferedReader where each line of text is a text from an article. I want to make a list of unique words in this text file, but there are 3.769.926 articles in there, so the word count is quite immense. From what I understand about Sets, or specifically HashSets, this should be the man for the job so to speak. Everything runs quite smoothly at first, but after 500.000 articles it starts slowing down a bit. When it reaches 700.000 its beginning to get slow enough that it basically stops for a second of two before going on again. There's a bottleneck here somewhere, and I can't see what it is.. Any ideas?
has comment: http://stackoverflow.com/comment/31025090
tagged with: java
has answer: http://stackoverflow.com/a/20711352
tagged with: set
type: Question
has comment: http://stackoverflow.com/comment/31025618
tagged with: hashset
has title: Significant slower processing as Set size goes beyond 500.000
upvote count: 2
has comment: http://stackoverflow.com/comment/31023791
answer count: 3
has comment: http://stackoverflow.com/comment/31024003
possible better answer: http://stackoverflow.com/a/20711352

http://stackoverflow.com/a/20752175
type: AcceptedAnswer
has body: The class is called HappyFace not test
type: Answer
accepted answer of: http://stackoverflow.com/q/20752123
answers question: http://stackoverflow.com/q/20752123
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/20691757
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/20691864
has body: ArrayList is not synchronized. But there's a way the get a synchronized one as mentioned in java.util.ArrayList's JavaDoc: List list = Collections.synchronizedList(new ArrayList(...)); In java.util.Collections JavaDoc you can read that "It is imperative that the user manually synchronize on the returned list when iterating over it:" synchronized(list) { Iterator i = list.iterator(); // Must be in synchronized block while (i.hasNext()) foo(i.next()); } Using a synchronized ArrayList results in additional work, why not use a java.util.Vector instead? Is there an advantage in using this approach? I found this question on http://www.coderanch.com/ and I'm sharing its great answer here from the same post.
has comment: http://stackoverflow.com/comment/31015518
tagged with: java
downvote count: 3
tagged with: thread-safety
type: Question
has comment: http://stackoverflow.com/comment/30989568
answer count: 1
has comment: http://stackoverflow.com/comment/31015173
tagged with: arraylist
has answer: http://stackoverflow.com/a/20691864
has comment: http://stackoverflow.com/comment/30990164
tagged with: synchronization
favorite count: 0
linked to: http://stackoverflow.com/q/11282627
tagged with: multithreading
upvote count: 6
has title: Why do we still need external synchronization when a synchronizedList() or Vector is already synchronized?

http://stackoverflow.com/q/20700530
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/910374
tagged with: java
has answer: http://stackoverflow.com/a/20700613
has answer: http://stackoverflow.com/a/20700706
score: 16
tagged with: keyword
type: Question
has comment: http://stackoverflow.com/comment/31006293
tagged with: transient
has answer: http://stackoverflow.com/a/20700585
tagged with: modifier
accepted answer: http://stackoverflow.com/a/20700665
has body: I have an issue related to the transient keyword's use before the private modifier in java . variable declaration: transient private ResourceBundle pageResourceBundle; My class looks like this : public class LoginViewModel extends AbstractViewModel { transient private ResourceBundle pageResourceBundle; @AfterCompose public void afterCompose(@ContextParam(ContextType.VIEW) Component view) { initializeLoginValues(); boolean timeout = BooleanUtils.toBoolean(getHttpServletRequest().getParameter("timeout")); if (timeout) { Messagebox.show(pageResourceBundle.getText("MSG_SESSION_HAS_EXPIRED_PLEASE_LOGIN"), pageResourceBundle.getText("LABEL_ALERT"), Messagebox.OK, Messagebox.ERROR); } view.getPage().setTitle(CsdcLicence.get().getApplicationName()); } I have some questions. 1.why use the transient keyword before a private variable? 2.what is the purpose of using this keyword?
has comment: http://stackoverflow.com/comment/31005467
has title: Why use the `transient` keyword in java?
possible better answer: http://stackoverflow.com/a/20700706
downvote count: 1
upvote count: 17
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/20700665
has comment: http://stackoverflow.com/comment/66140004
has comment: http://stackoverflow.com/comment/31004048
duplicate of: http://stackoverflow.com/q/910374

http://stackoverflow.com/q/20718462
has body: I use an AffineTransform class to transform my image and I need to have a position of image after translation and rotation. How to achieve that? public void rotateImage(ImageObserver o, Graphics g, int x, int y) { AffineTransform at = new AffineTransform(); at.translate(x, y); at.rotate(Math.toRadians(deegres),ramie1.getWidth()/2,0); Graphics2D g2 =(Graphics2D) g; g2.drawImage(image, at, null); }
favorite count: 0
tagged with: java-2d
has comment: http://stackoverflow.com/comment/31037178
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Get position image after Rotation with AffineTransform
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31037253
tagged with: affinetransform
type: Question
has comment: http://stackoverflow.com/comment/31037179
has comment: http://stackoverflow.com/comment/31040015
downvote count: 0
tagged with: awt

http://stackoverflow.com/comment/31156827
type: AnswerComment
has text: Will this code block my main thread for one second (not desired behavior)?
type: Comment
comment on: http://stackoverflow.com/a/20785508
score: 0

http://stackoverflow.com/q/20710762
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/31023190
has comment: http://stackoverflow.com/comment/31023601
downvote count: 0
accepted answer: http://stackoverflow.com/a/20721843
tagged with: jackson
has comment: http://stackoverflow.com/comment/31022979
has comment: http://stackoverflow.com/comment/31023138
answer count: 1
has body: I've been searching to find an answer/workaround for this issue for some time now. The problem is when converting a Json String into a Java Object, an Exception is thrown along the lines of "Reflection is not allowed on private java.lang.Throwable java.lang.Throwable.cause". I understand that GAE is a sandboxed envrionment so I am unable to push the boundaries as much as I would like however, I am keen to not have to resort to writing my own deserializer. The reason being the data types I am working with are quite complex, so writing my own deserializer would not only be time consuming, but would defeat the point of using frameworks such as Jackson and GSON. Below is the code sample for both Jackson and GSON, both implementations work locally (not sanboxed) and not when deploying to GAE. Jackson: public class JsonConverterJackson { private static final ObjectMapper mapper = new ObjectMapper().setVisibility(PropertyAccessor.FIELD, Visibility.NON_PRIVATE); /** This method deserializes the specified Json into an object of the specified class. * @throws IOException * @throws JsonMappingException * @throws JsonParseException * */ public static &lt;T&gt; T convertFromJson(String toConvert, Class&lt;T&gt; clazz) throws JsonParseException, JsonMappingException, IOException{ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper.readValue(toConvert, clazz); } /** * This method serializes the specified object into its equivalent Json representation. * @throws JsonProcessingException */ public static String convertToJson(Object toConvert) throws JsonProcessingException{ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper.writeValueAsString(toConvert); } GSON: public class JsonConverter { private static final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create(); //private static final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.PRIVATE).setDateFormat("y…
has comment: http://stackoverflow.com/comment/31022912
favorite count: 0
upvote count: 2
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/20721843
has title: Jackson and GSON unusable with Google App Engine
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/32430979
tagged with: reflection
tagged with: java

http://stackoverflow.com/q/20798391
tagged with: primes
type: Question
has answer: http://stackoverflow.com/a/48916786
has comment: http://stackoverflow.com/comment/31180325
has answer: http://stackoverflow.com/a/51195352
has title: What is wrong with my isPrime method?
has answer: http://stackoverflow.com/a/20798434
accepted answer: http://stackoverflow.com/a/20798440
tagged with: java
has answer: http://stackoverflow.com/a/20798437
answer count: 13
score: 12
has answer: http://stackoverflow.com/a/37922722
has answer: http://stackoverflow.com/a/28466231
tagged with: function
has answer: http://stackoverflow.com/a/20798431
has answer: http://stackoverflow.com/a/20798451
has answer: http://stackoverflow.com/a/62689230
favorite count: 0
possible better answer: http://stackoverflow.com/a/37922722
has answer: http://stackoverflow.com/a/20798432
has answer: http://stackoverflow.com/a/20798440
has answer: http://stackoverflow.com/a/39933470
has answer: http://stackoverflow.com/a/20798513
has body: This is my isPrime method: private static boolean isPrime(int num) { if (num % 2 == 0) return false; for (int i = 3; i * i &lt; num; i += 2) if (num % i == 0) return false; return true; } I put isPrime(9) and it returns true. What is wrong with the method?
type: AnsweredQuestion
upvote count: 14
downvote count: 2
tagged with: methods

http://stackoverflow.com/comment/31041506
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20719350
has text: http://lpaste.net/97334 There is the errormessage and further down is how the file looks. Lines that start with * or / are comments. there are no errors in gateprog.java. That is the file that was given to us. We are not to alter it.
score: 0

http://stackoverflow.com/q/20793415
has comment: http://stackoverflow.com/comment/31171568
type: Question
accepted answer: http://stackoverflow.com/a/20793637
has comment: http://stackoverflow.com/comment/31172133
answer count: 1
favorite count: 0
upvote count: 3
score: 0
has comment: http://stackoverflow.com/comment/31171574
tagged with: reactor
tagged with: keyword
has title: java - Usage of 'of' keyword when defining a method
has comment: http://stackoverflow.com/comment/31171690
has comment: http://stackoverflow.com/comment/31171613
has body: In the Reactor code I could see something like /** * Create a {@link Tuple1} with the given object. * * @param t1 The first value in the tuple. * @param &lt;T1&gt; The type of the first value. * @return The new {@link Tuple1}. */ public static &lt;T1&gt; Tuple1&lt;T1&gt; of(T1 t1) { return new Tuple1&lt;T1&gt;(t1); } What is this 'of' keyword?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31172046
tagged with: java
has answer: http://stackoverflow.com/a/20793637
downvote count: 3

http://stackoverflow.com/q/20845200
has answer: http://stackoverflow.com/a/20845325
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/20845249
score: 0
answer count: 2
tagged with: layout
favorite count: 0
tagged with: ui-design
has body: Am trying to achieve the below layout on Android (Target API 18, min API 8) Am relatively new to Android &amp; came up with below layout file (activity_main.xml). I know a bit about Linear versus Relative layout and would highly appreciate if anyone can provide some input in this direction. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/task_name" android:textSize="14sp" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignTop="@+id/textView1" android:ems="10" android:hint="@string/task_name_hint" android:inputType="text" /&gt; &lt;DatePicker android:id="@+id/dpResult" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textView1" android:layout_marginTop="8dp" /&gt; &lt;RadioGroup android:id="@+id/priority_radios" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/dpResult" android:inputType="text" android:orientation="horizontal" &gt; &lt;RadioButton android:id="@+id/first" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/first_radio" /&gt; &lt;RadioButton android:id="@+id/second" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/second_radio"/&gt; &lt;RadioButton android:id="@+id/third" android:layout_width="wrap_content" an…
has title: Android form based layout
tagged with: android
possible better answer: http://stackoverflow.com/a/20845325
accepted answer: http://stackoverflow.com/a/20845249

http://stackoverflow.com/a/20838170
has comment: http://stackoverflow.com/comment/31254448
has comment: http://stackoverflow.com/comment/31254155
type: Answer
answers question: http://stackoverflow.com/q/20837502
has body: The first EACCES (Permission denied) is because you didn't have the internet permission in manifest: &lt;uses-permission android:name="android.permission.INTERNET" /&gt; After adding that you get ANR application not responding. It's because you block the UI thread for 5 seconds or more. You shouldn't do network requests on the UI thread but use a background thread for them. AsyncTask is probably the easiest way to offload operations to a backgrond thread. (Since your targetSdkVersion is 18 which is higher than 11, you should also get NetworkOnMainThreadException for doing network operations on the UI thread - I guess you have suppressed that exception in code you're not showing.) Generally, doing JDBC database connections from a mobile client is a bad idea. JDBC protocols are designed for high-throughput low-latency networks for example in a data center. Mobile data networks are slow and unreliable to use JDBC efficiently. Instead, create a web service for your remote database operations and connect your mobile app to the web service.
has comment: http://stackoverflow.com/comment/31254105
score: 0

http://stackoverflow.com/q/20807192
tagged with: base64
type: AnsweredQuestion
has body: I am trying to use GZIPInputStream in Java to decompress image data coming from my .NET application (which compresses in GZIP format). The image data is transferred as base64 strings because it is synced over as XML text. I was under the assumption that the stream would read into the buffer passed into .read() parameters until the buffer was saturated. It is not working as I had expected, i.e., the .read() only reads let's say, 800 or so bytes per read operation. This is not a problem for small images but for big ones, like 800 KB it takes a very long time to decompress. I have written a small test sample to showcase this: import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; public class GZIPtest { public static void main(String[] args) throws IOException { String b64img = "[binary]"; ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPOutputStream gzos = new GZIPOutputStream(bos); gzos.write(b64img.getBytes()); gzos.close(); byte[] compressed = bos.toByteArray(); ByteArrayInputStream bis = new ByteArrayInputStream(compressed); GZIPInputStream gzis = new GZIPInputStream(bis); int bufSize = 8192; byte[] decompressed = new byte[bufSize]; int read = gzis.read(decompressed); String s = new String(decompressed, 0, read); while (read != -1) { decompressed = new byte[bufSize]; read = gzis.read(decompressed); String tmp = ""; if (read != -1) { tmp = new String(decompressed, 0, read); s += tmp; } } gzis.close(); if (b64img.equals(s)) System.out.print("EQUAL"); System.exit(0); } } b64img is the base64 representation of this image. It is a simple 6 KB image, so running this program shouldn't take very long. If you step through the read process you will see that it does not saturate the decompressed byte buffer. I used the print statement to see if the compressed/decompressed strings were equal, as my own test to see if GZIP was working properl…
answer count: 1
favorite count: 0
type: Question
upvote count: 2
has title: GZIPInputStream .read() limitations
has comment: http://stackoverflow.com/comment/31196323
has answer: http://stackoverflow.com/a/20885391
tagged with: java
tagged with: compression
has comment: http://stackoverflow.com/comment/31196491
accepted answer: http://stackoverflow.com/a/20885391
score: 2
tagged with: gzip
downvote count: 0

http://stackoverflow.com/comment/31188891
comment on: http://stackoverflow.com/a/20800728
score: 0
type: AnswerComment
has text: Lools like you are using very old version on Spring Integration: http://projects.spring.io/spring-integration ...
type: Comment

http://stackoverflow.com/comment/31055699
score: 0
comment on: http://stackoverflow.com/q/20728451
type: Comment
type: QuestionComment
has text: Nothing is printed, It just terminates my process in Eclipse.

http://stackoverflow.com/comment/31007413
has text: @GopalRao I added it to the post.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20702210
type: Comment

web
tags question: http://stackoverflow.com/q/20833800
tags question: http://stackoverflow.com/q/20834262
type: Tag
tags question: http://stackoverflow.com/q/20772837
tags question: http://stackoverflow.com/q/20767732
tags question: http://stackoverflow.com/q/20681570
tags question: http://stackoverflow.com/q/20754627
tags question: http://stackoverflow.com/q/20732806
tags question: http://stackoverflow.com/q/20804522
tags question: http://stackoverflow.com/q/20815183
tag name: web

http://stackoverflow.com/comment/30967591
score: 0
comment on: http://stackoverflow.com/a/20680098
type: Comment
has text: @user2864740, that's correct. :)
type: AnswerComment

http://stackoverflow.com/comment/31099610
score: 0
comment on: http://stackoverflow.com/q/20752725
type: Comment
type: QuestionComment
has text: Guys, occur is basically a count i.e. numbers so that is fine.. More code has been added to the Question.

http://stackoverflow.com/a/20820756
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20820608
type: Answer
has body: The simple answer is - you can't. Even if you could detect thread context switches it happens far too often to usefully logged. A better question would be to look at why you need to know. If there is a problem there post it as a question and we can solve the real issue.
downvote count: 0

http://stackoverflow.com/q/20817308
tagged with: javascript
has comment: http://stackoverflow.com/comment/31215107
tagged with: jquery
has comment: http://stackoverflow.com/comment/31216249
has comment: http://stackoverflow.com/comment/31215390
tagged with: utf-8
favorite count: 0
type: AnsweredQuestion
has body: I have a standard HTML5-type client/server set up. The server side is all Java, and the client side is JavaScript. Using ajax I send queries and receive replies. Up to now, I've had no problems with JSON.parse(data). However, I have a new user who entered her last name using Chinese characters. This is causing a "JSON.parse: bad control character in string literal" error on the client side. The server builds a reply as follows (exception handling omitted): JSONObject jsono = new JSONObject(); jsono.put("last_name", last_name); jsono.put("first-name", first_name); String response = jsono.toString(); The client receives something like: {"last_name":"Smith","first_name":"Bob"} The reply is displayed on a web page which is set to &lt;meta charset="utf-8"&gt;: var theResult = JSON.parse(data); $('#first_name').html(theResult.first_name); This works just fine. However, for the Chinese user, the client receives {"last_name":"唐","first_name":"Bob"} and this causes the json.parse error. I've now started looking at other characters. For example, Andr&eacute;s does not cause an error, but also does not display properly. It looks like Andr�s. So, I'm clearly missing something. Could someone enlighten me where the problem lies (e.g., is it server side? client side? JavaScript? jquery? html?) and how to solve it?
has answer: http://stackoverflow.com/a/20818215
upvote count: 5
accepted answer: http://stackoverflow.com/a/20818215
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31216924
has comment: http://stackoverflow.com/comment/31215159
type: Question
has title: Why do Chinese characters in JSON cause "bad control character" error with JSON.parse?
has comment: http://stackoverflow.com/comment/31216684
score: 5
has comment: http://stackoverflow.com/comment/31216927
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31185337
score: 1
has text: You should really have your date data in your database in date format, not String
comment on: http://stackoverflow.com/q/20801249
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20767290
tagged with: swing
has comment: http://stackoverflow.com/comment/31125367
has title: How do i change the font size of JPanel
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/20767328
accepted answer: http://stackoverflow.com/a/20767352
tagged with: java
has answer: http://stackoverflow.com/a/20767328
tagged with: jpanel
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/31125357
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31129392
has body: I am trying to create a JPanel with varying font sizes, without using JLabels. Below is a representation of what the code looks like. public class MyPanel extends JPanel{ public MyPanel(string title){ JFrame frame = new JFrame(title); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public void paintComponent(Graphics graphics){ graphics.drawString("Some Text",100,100); // Should decrease font size graphics.drawString("Some Smaller Text",200,200); // Should increase font size graphics.drawString("Some Bigger Text",300,300); } }
linked to: http://stackoverflow.com/q/7434845
tagged with: size
has answer: http://stackoverflow.com/a/20767352
upvote count: 3
tagged with: fonts
has comment: http://stackoverflow.com/comment/31125361
has answer: http://stackoverflow.com/a/20767341

http://stackoverflow.com/a/20701489
type: Answer
answers question: http://stackoverflow.com/q/20700800
has body: Try this out. It give you the desired output first using a map then converting back to a list import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class test1 { public static void main(String[] args) { List&lt;String&gt; input = new ArrayList&lt;String&gt;(); input.add("2013-07-31,A,47"); input.add("2013-06-28,A,52"); input.add("2013-05-31,A,63"); input.add("2013-07-31,B,47"); input.add("2013-06-28,B,54"); input.add("2013-05-31,B,91"); input.add("2013-07-31,C,78"); input.add("2013-06-28,C,24"); input.add("2013-07-31,D,99"); input.add("2013-05-31,D,82"); Map&lt;String, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); for (String s : input) { String[] tokens = s.split(","); if (!map.containsKey(tokens[1])) { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add(tokens[2]); map.put(tokens[1], list); } else { ArrayList&lt;String&gt; list = map.get(tokens[1]); list.add(tokens[2]); map.put(tokens[1], list); } } ArrayList&lt;String&gt; newList = new ArrayList&lt;String&gt;(); for (Map.Entry&lt;String, ArrayList&lt;String&gt;&gt; entry : map.entrySet()) { StringBuilder sb = new StringBuilder(); sb.append(entry.getKey() + ","); for (String s : entry.getValue()) { sb.append(s + ","); } newList.add(sb.toString()); } Collections.sort(newList); for (String s : newList) { System.out.println(s); } } } Output A,47,52,63, B,47,54,91, C,78,24, D,99,82, Sorry, I just notices your NOTE, but I wasn't really able to understand what you meant by it, so I'm not really sure about how to go about producing the zeroes
score: 0
has comment: http://stackoverflow.com/comment/31005778

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/20703222

http://stackoverflow.com/comment/31138878
type: Comment
comment on: http://stackoverflow.com/a/20774933
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/43888/discussion-between-shayan-pourvatan-and-raghunandan)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31106658
score: 0
type: Comment
has text: But I am retrieving the db value(strtime),how should I pass this in javascript? if you could show me
type: AnswerComment
comment on: http://stackoverflow.com/a/20756630

http://stackoverflow.com/a/20761112
type: Answer
has body: This is what you want. SELECT * FROM table_name ORDER BY id DESC LIMIT 1
answers question: http://stackoverflow.com/q/20761020
downvote count: 2
score: -2
upvote count: 0

glassfish-4
tags question: http://stackoverflow.com/q/20792406
type: Tag
tag name: glassfish-4

http://stackoverflow.com/comment/31042623
has text: I changed some code, removed the extends Client but things don't work correctly if I do setTextView() in onCreate because it goes before Net has finished recieving the object I need.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20721390

http://stackoverflow.com/comment/31056632
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20729057
has text: @MarounMaroun Good remark :)
score: 0

http://stackoverflow.com/comment/31104848
type: Comment
type: QuestionComment
has text: `pt-createaccount` is not a link but a `li`. I can imagine that it could be the problem for Selenium. Have you tried to use `driver.findElement(By.linkText("Create account")).click();` ?
comment on: http://stackoverflow.com/q/20755246
score: 0

http://stackoverflow.com/a/21186552
has comment: http://stackoverflow.com/comment/31982741
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31958707
has comment: http://stackoverflow.com/comment/31981944
has comment: http://stackoverflow.com/comment/31981778
answers question: http://stackoverflow.com/q/20829860
type: Answer
has comment: http://stackoverflow.com/comment/31905821
upvote count: 16
accepted answer of: http://stackoverflow.com/q/20829860
has comment: http://stackoverflow.com/comment/31923827
has body: The short answer is: there isn't an equivalent, because C++ does things differently. There's no point arguing about this, it's just the way things are. If you don't like this, use a different language. The long answer is: there is an equivalent but it's going to make you a little unhappy, because while Java's model of containers and algorithms is heavily based around inheritance, C++'s isn't. C++'s model is heavily based around generic iterators. Let's say, to take your example, that you want to implement a set. Ignoring the fact that C++ already has std::set, std::multiset, std::unordered_set and std::unordered_multiset, and that these are all customisable with different comparators and allocators, and the unordered ones have customisable hash functions, of course. So let's say you want to reimplement std::set. Perhaps you're a computer science student and you want to compare AVL trees, 2-3 trees, red-black trees and splay trees, for example. How would you do this? You would write: template&lt;class Key, class Compare = std::less&lt;Key&gt;, class Allocator = std::allocator&lt;Key&gt;&gt; class set { using key_type = Key; using value_type = Key; using size_type = std::size_t; using difference_type = std::ptrdiff_t; using key_compare = Compare; using value_compare = Compare; using allocator_type = Allocator; using reference = value_type&amp;; using const_reference = const value_type&amp;; using pointer = std::allocator_traits&lt;Allocator&gt;::pointer; using const_pointer = std::allocator_traits&lt;Allocator&gt;::const_pointer; using iterator = /* depends on your implementation */; using const_iterator = /* depends on your implementation */; using reverse_iterator = std::reverse_iterator&lt;iterator&gt;; using const_reverse_iterator = std::reverse_iterator&lt;const_iterator&gt; iterator begin() const; iterator end() const; const_iterator cbegin() const; const_iterator cend() const; reverse_iterator rbegin() const; reverse_iterator rend() const; const_reverse_iterato…
has comment: http://stackoverflow.com/comment/31923843
has comment: http://stackoverflow.com/comment/31905938
score: 16

shunting-yard
tags question: http://stackoverflow.com/q/20826518
tag name: shunting-yard
type: Tag
tags question: http://stackoverflow.com/q/20687388

http://stackoverflow.com/a/20775939
has comment: http://stackoverflow.com/comment/40532753
answers question: http://stackoverflow.com/q/20774620
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Problem solved. I had to rip off startProgressUpdater() from onProgressChanged() and put it into onStopTrackingTouch().
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20774620

http://stackoverflow.com/comment/31125749
comment on: http://stackoverflow.com/q/20767490
score: 0
type: Comment
type: QuestionComment
has text: Sometimes we cannot get what we want. Sometimes we can... I would use **kermit** for [this](http://www.columbia.edu/kermit/ckscripts.html).

http://stackoverflow.com/q/20776885
has comment: http://stackoverflow.com/comment/31160076
has comment: http://stackoverflow.com/comment/31142287
tagged with: swing
has answer: http://stackoverflow.com/a/20776910
has title: Take JSpinner back to the last valid value on loss of focus
tagged with: jspinner
has comment: http://stackoverflow.com/comment/31171163
tagged with: java
has comment: http://stackoverflow.com/comment/31142252
type: Question
has body: How can I make the JSpinner go back to the last valid value when it loses focus and also when I press the spinner arrow button?
downvote count: 2
score: -2
answer count: 1
tagged with: focus
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31173224

http://stackoverflow.com/comment/31198460
has text: You don't have any idea about it?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20808388

http://stackoverflow.com/a/20701901
answers question: http://stackoverflow.com/q/20701793
score: 0
has body: Inside the bin of the java folder there is an application jvisualvm.exe ( in case of Windows platform). Execute that, you will be able to monitor threads.
type: Answer

http://stackoverflow.com/comment/30979757
has text: you could refer a bean and inside that bean you could assign a list.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20686467
type: Comment

http://stackoverflow.com/comment/31215159
score: 0
has text: As Mehran said, it's not JSON or JavaScript. It's almost certainly an encoding problem. If the encoding is correct and everything knows what that encoding is, that works. (Example: http://jsbin.com/eParenUK/1/edit). So for example, if your JSON is returned to the browser using the Windows-1252 charset (or UTF-16, or...) instead of UTF-8...
comment on: http://stackoverflow.com/q/20817308
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20727626
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20727539
downvote count: 0
has body: Don't add KeyListener within the paint method Dont call repaint, or any method that might call repaint from within in paint method. Try to avoid mixing heavy weight (Canvas) and light weight (JFrame) components, they have issues with z-ordering and painting Do call super.paintXxx Unless you have a particular reason for doing so, avoid using AWT components and use Swing components instead, you'll generally get better support When changing the state of one of you graphics objects (Face), you should call repaint to encourage the UI to be updated

http://stackoverflow.com/a/20839533
has comment: http://stackoverflow.com/comment/31256532
type: Answer
has body: You need to map bean members to json keys. You can use: Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create(); Or: @SerializedName("c4w_code") private String c4wCode; For your error, you need to give date format: Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .setDateFormat("yyyy-MM-dd HH:mm:ss") .create();
answers question: http://stackoverflow.com/q/20839402
score: 0

http://stackoverflow.com/comment/31175295
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20795488
has text: In stack trace, I am getting the exception of unexpected token and envelope in SoapSerializable, I have edited my Question.
score: 0

http://stackoverflow.com/comment/31162042
type: Comment
type: QuestionComment
score: 2
has text: @MarkoTopolnik, all Swing components are responsible for painting the entire background. That is what the opaque property means. If you don't paint the background you can be left with painting artifacts. For example see [Backgrounds With Transparency](http://tips4java.wordpress.com/2009/05/31/backgrounds-with-transparency/) which tries to explain how the opaque property works for a component.
comment on: http://stackoverflow.com/q/20787800

http://stackoverflow.com/comment/31199591
type: AnswerComment
has text: You can use the extended Euclidean algorithm, or use [Hensel's lemma](http://en.wikipedia.org/wiki/Hensel%27s_lemma#Hensel.27s_Lemma_for_p-adic_Numbers). The latter is easiest to implement: first set `x = a = 31` and then repeat `x = x*(2-a*x)` until it converges, up to five times.
type: Comment
comment on: http://stackoverflow.com/a/20808893
score: 0

http://stackoverflow.com/comment/31083865
type: Comment
has text: at String[] value = me.getValue(); it gives an error "cannot convert objects into strings"
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20732443

http://stackoverflow.com/q/20817309
answer count: 1
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31215039
tagged with: android-studio
accepted answer: http://stackoverflow.com/a/20817312
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20817312
has body: I get a NPE when I try to launch the App. I don't know what causes it. The App should show a map at a website. Then the User can easily type his location into the edittext and submit it to the webpage. Here is my Code: package com.timbremer.iimv; import android.content.Context; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.view.inputmethod.InputMethodManager; import android.webkit.CookieManager; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.EditText; public class MainActivity extends ActionBarActivity { private WebView wv; private EditText etlocation; private Button btclose; private Button btgo; private boolean send; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); send = false; etlocation = (EditText) findViewById(R.id.etlocation); btgo.setOnClickListener(new View.OnClickListener() { private String location; @Override public void onClick(View v) { location = etlocation.getText().toString(); WebView wv = (WebView) findViewById(R.id.wv); wv.getSettings().setBuiltInZoomControls(true); CookieManager.getInstance().setAcceptCookie(true); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setLoadWithOverviewMode(true); wv.getSettings().setUseWideViewPort(true); wv.loadUrl("http://www.ingress.com/intel"); wv.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { if(!send) { view.loadUrl("javascript:{" + "document.getElementById('adress').value='" + l…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31215028
has title: IllegalStateException in my Android app caused by Theme.AppCompat

http://stackoverflow.com/q/20728207
tagged with: java
has body: I am new in android , I am trying to integrate Facebook sdk to share a link and image , but i am unable to achieve this functionality . my code is private UiLifecycleHelper uiHelper; private static String APP_ID = "8975555558745832"; private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { // onSessionStateChange(session, state, exception); } }; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.share); uiHelper = new UiLifecycleHelper(this, callback); uiHelper.onCreate(savedInstanceState); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() { @Override public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) { Log.e("Activity", String.format("Error: %s", error.toString())); } @Override public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) { Log.i("Activity", "Success!"); } }); } @Override protected void onResume() { super.onResume(); uiHelper.onResume(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } And finally i calling this this code to show share diolouge FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this) .setLink("https://developers.facebook.com/android") .build(); uiHelper.trackPendingDialogCall(shareDialog.present()); Thanks .
type: Question
score: 3
has answer: http://stackoverflow.com/a/20730002
has title: how to integrate Facebook share Diolouge to attach Url and image?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: facebook
upvote count: 3

http://stackoverflow.com/comment/30987268
comment on: http://stackoverflow.com/a/20689922
has text: @user3118927 I updated my answer. Though this is as far as I'll go, this is your homework and it appears that you should do some reading ;)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20794751
score: 118
has answer: http://stackoverflow.com/a/20807657
has comment: http://stackoverflow.com/comment/75508350
type: UnansweredQuestion
tagged with: java
downvote count: 2
type: Question
has body: Have a simple Google App Engine Web Application Project on Eclipse Kepler on Mac OS X with java version "1.7.0_45" Running into the following : objc[5398]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. when I try to run as web application on localhost Possibly related to the following issue : https://code.google.com/p/googleappengine/issues/detail?id=10046 Any help would be useful.
has answer: http://stackoverflow.com/a/21705733
has comment: http://stackoverflow.com/comment/44724353
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33655594
answer count: 2
upvote count: 120
has title: Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined
linked to: http://stackoverflow.com/q/18794573
has comment: http://stackoverflow.com/comment/37363948
favorite count: 0
duplicate of: http://stackoverflow.com/q/18794573
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/73556686

http://stackoverflow.com/comment/31062710
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20732277
type: Comment
has text: actually the OPs way is correct, the declared color is now an application resource and can be used anywhere.

http://stackoverflow.com/q/20773214
linked to: http://stackoverflow.com/q/10600670
has comment: http://stackoverflow.com/comment/31135705
accepted answer: http://stackoverflow.com/a/20775389
has comment: http://stackoverflow.com/comment/31136616
has comment: http://stackoverflow.com/comment/31135951
linked to: http://stackoverflow.com/q/14018394
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20775389
tagged with: java
has comment: http://stackoverflow.com/comment/31135834
type: Question
has title: Getting the 10 latest entries in SQL
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/31135658
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/31135876
has body: I'm trying to get the the ten latest entries in my sqlite database. I need to fetch only one entry at a time instead of those ten entries at once. Until now, i was doing this: "SELECT " + sql + " FROM " + TABLE_NAME + " WHERE _id = (SELECT max(_id)-2 FROM " + TABLE_NAME + ")"; For every entry i need, i was just doing ...max(_id)-x but this does not work, if some entries are deleted at some time. The id's have some gaps (like 1, 2, 4, 8, ...). So after some research i was trying something like this: "SELECT * FROM (SELECT " + sql + ", rank() over (order by max(_id) desc) rk FROM " + TABLE_NAME + " GROUP BY " + sql + ") t WHERE rk = 2" this approach however crashes with the following message android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: select * from (select price, rank() over (order by max(_id) desc) rk from refuels group by price) t where rk = 2 How can I get this done? Thanks in advance

http://stackoverflow.com/a/20737743
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20737541
downvote count: 0
score: 1
has body: For the first method: public ArrayList&lt;Integer&gt; letsMap(){ ArrayList&lt;Integer&gt; iArray = new ArrayList&lt;&gt;(maxBagSize + 1); int w; for(int i = 0; i &lt; ourBags.size(); i++){ w = ourBags.get(i).foo; iArray.set(w, iArray.get(w) + 1); } return iArray; } And for the second: public boolean comp(SearchState search){ boolean cool = false; if(search.unBaggedItems.equals(this.unBaggedItems)){ ArrayList&lt;Integer&gt; mine = letsMap(); ArrayList&lt;Integer&gt; theirs = search.letsMap(); cool = true; for(int i = 0; i &lt; maxBagSize; i++){ if(mine.get(i).compareTo(theirs.get(i)) != 0){ cool = false; break; } } } return cool; }

http://stackoverflow.com/a/20683635
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20683267
has body: Did you try debug on another code ? Maybe you press RUN( SHIFT+F10) while need to press DEBUG(SHIFT+F9).
has comment: http://stackoverflow.com/comment/30975075

http://stackoverflow.com/comment/31140236
type: QuestionComment
comment on: http://stackoverflow.com/q/20775166
has text: Don't compare String with !=. Here you should use relHref.length()>0 .
score: 0
type: Comment

http://stackoverflow.com/q/20795499
linked to: http://stackoverflow.com/q/2372825
has answer: http://stackoverflow.com/a/20795615
duplicate of: http://stackoverflow.com/q/2372825
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20795643
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20795659
has title: How do I replace white spaces to nbsp?
tagged with: replace
answer count: 3
tagged with: string
favorite count: 0
has body: How do I convert any white spaces to nbsp? This doesn't seem to work for me: String temp = "This is practice"; temp = temp.replaceAll(" ", "nbsp"); It is literally adding the string nbsp in, how do I make it so it actually counts as a no break space?
type: UnansweredQuestion

instantiation
type: Tag
tags question: http://stackoverflow.com/q/20702055
tag name: instantiation
tags question: http://stackoverflow.com/q/20772895
tags question: http://stackoverflow.com/q/20835705

http://stackoverflow.com/a/20702704
has comment: http://stackoverflow.com/comment/31008052
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20702622
has body: As a Set is not ordered by definition, there is no way to order a Set, so (as you do it) you have to use an ordered data structure. However you do not need to care about the problem you see at all, Java will not perform a deep copy of the Set if you perform addAll, it will just copy references which uses nearly no RAM. So your addAll Solution is a clean and correct one.
has comment: http://stackoverflow.com/comment/31008001
has comment: http://stackoverflow.com/comment/31008100

http://stackoverflow.com/a/20734543
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/20734527
has body: The way you have it now you have a unidirectional dependency. In other words, company depends on employee. However, employee knows nothing about the company it belongs to. You can simply add a company field to employee and every time you create an employee or add it to a company's employeeList, remember to update both sides of the now bidirectional dependency. Note that Java naming conventions state that type names should start with a capitalized letter.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20734527
type: Answer

http://stackoverflow.com/comment/31049520
comment on: http://stackoverflow.com/q/20724938
has text: I suppose, that for security reason, FreeSSHd "chroot" to defined path so "C:\SFTP" is actually / for it. It knows nothing below this directory. I do not think that it is an problem. You can upload file to "/" and it appears in "C:\SFTP". Is it true?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/31207853
type: Comment
has text: @MartijnCourteaux - Yes, once I have used this one in my application but forget it, just google it and find it.
type: AnswerComment
comment on: http://stackoverflow.com/a/20812898
score: 0

http://stackoverflow.com/q/20750767
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/20753754
downvote count: 0
possible better answer: http://stackoverflow.com/a/20804081
has answer: http://stackoverflow.com/a/20804081
tagged with: lotus-notes
favorite count: 0
has body: I have this java agent that processes a huge amount of documents that it could run overnight. The problem is that I need the agent to retry if the network got suddenly disconnected briefly. The retry could have a maximum number. int numberOfRetries = 0; try { while(nextdoc != null) { // process documents numberOfRetries = 0; } } catch (NotesException e) { numberOfRetries++; if (numberOfRetries &gt; 4) { // go back and reprocess current document } else { // message reached max number of retries. did not successfully finished } } Also, of course I do not want to actually retry the whole process. Basically I need to continue on the document it was processing and move on to the next loop
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/20753754
type: AnsweredQuestion
has title: How to catch "NotesException: Notes error: Remote system no longer responding" and retry?

http://stackoverflow.com/comment/30989365
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20691569
type: Comment
has text: Ohhhhhh!! Now I get it! Thank you very very very much sir! :D

http://stackoverflow.com/q/20813397
has title: The naming of constants; Type or Name first?
possible better answer: http://stackoverflow.com/a/20813445
has comment: http://stackoverflow.com/comment/31207848
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31207816
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20813460
tagged with: variables
favorite count: 0
accepted answer: http://stackoverflow.com/a/20813431
has answer: http://stackoverflow.com/a/20813445
has body: Something that has bugged me for a long time is the naming of constants. For example a path to saved images on disk: PATH_IMAGES And a url to saved images: URL_IMAGES But I can also use IMAGES_PATH and IMAGES_URL. The same applies for normal variable names: users_screen or screen_users for a screen that displays a list of users. Is there a standard for which part should come first? Of course if possible type should not be included in the variable name. But there are many cases in which this isn't possible.
tagged with: constants
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20813431
tagged with: java
type: Question

http://stackoverflow.com/a/20739137
has comment: http://stackoverflow.com/comment/31081292
upvote count: 4
has comment: http://stackoverflow.com/comment/31095534
has comment: http://stackoverflow.com/comment/31076369
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20732328
has comment: http://stackoverflow.com/comment/31083544
has body: Read this documentation for JBoss 7.1 Remote EJB invocations via JNDI - EJB client API or remote-naming project Add to classpath jboss-client.jar from $JBOSS_HOME/bin/client Invoker.java Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); properties.put(Context.PROVIDER_URL,"remote://127.0.0.1:4447"); // username properties.put(Context.SECURITY_PRINCIPAL, "user"); // password properties.put(Context.SECURITY_CREDENTIALS, "password"); // This is an important property to set if you want to do EJB invocations via the remote-naming project properties.put("jboss.naming.client.ejb.context", true); // create a context passing these properties return new InitialContext(properties); Main.java // lookup the bean SpeakerRemote speaker = (SpeakerRemote) context.lookup("myapp/myejbmodule/SpeakerBean!test.SpeakerRemote); System.out.println( speaker.sayAPhrase( "Hello, World!" ) ) Other approach: EJB invocations from a remote client using JNDI Add to classpath file jboss-ejb-client.properties jboss-ejb-client remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false #if you test on local machine remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER remote.connections=default remote.connection.default.host=127.0.0.1 remote.connection.default.port = 4447 remote.connection.default.username=user remote.connection.default.password=password Invoker.java final Hashtable&lt;String, String&gt; props = new Hashtable&lt;String, String&gt;(); props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); return new InitialContext(props); Main.java SpeakerRemote speaker = (SpeakerRemote) context.lookup("ejb:myapp/myejbmodule/SpeakerBean!test.SpeakerRemote); System.out.println( speaker.sayAPhrase( "Hello, World!" ) )
score: 4
has comment: http://stackoverflow.com/comment/31084315

jtable
tags question: http://stackoverflow.com/q/20754543
tags question: http://stackoverflow.com/q/20716424
tags question: http://stackoverflow.com/q/20734738
tags question: http://stackoverflow.com/q/20833517
tags question: http://stackoverflow.com/q/20846099
tags question: http://stackoverflow.com/q/20829473
type: Tag
tags question: http://stackoverflow.com/q/20775623
tags question: http://stackoverflow.com/q/20784040
tags question: http://stackoverflow.com/q/20729475
tags question: http://stackoverflow.com/q/20735786
tags question: http://stackoverflow.com/q/20831782
tags question: http://stackoverflow.com/q/20779646
tags question: http://stackoverflow.com/q/20747848
tags question: http://stackoverflow.com/q/20710501
tags question: http://stackoverflow.com/q/20847467
tag name: jtable
tags question: http://stackoverflow.com/q/20688938
tags question: http://stackoverflow.com/q/20683502
tags question: http://stackoverflow.com/q/20840762
tags question: http://stackoverflow.com/q/20839146
tags question: http://stackoverflow.com/q/20739558
tags question: http://stackoverflow.com/q/20680482
tags question: http://stackoverflow.com/q/20727534
tags question: http://stackoverflow.com/q/20687139
tags question: http://stackoverflow.com/q/20830437
tags question: http://stackoverflow.com/q/20721798
tags question: http://stackoverflow.com/q/20692540
tags question: http://stackoverflow.com/q/20811842
tags question: http://stackoverflow.com/q/20841568
tags question: http://stackoverflow.com/q/20810727
tags question: http://stackoverflow.com/q/20688267
tags question: http://stackoverflow.com/q/20768645
tags question: http://stackoverflow.com/q/20833853
tags question: http://stackoverflow.com/q/20701600

http://stackoverflow.com/q/20723320
has comment: http://stackoverflow.com/comment/31057489
answer count: 1
has answer: http://stackoverflow.com/a/20723444
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/31059004
has title: How can I check if a charset of a string is the same as the charset of the device's set language
tagged with: android
linked to: http://stackoverflow.com/q/11309026
linked to: http://stackoverflow.com/q/13144250
downvote count: 0
type: UnansweredQuestion
has body: I want to detect if a string contains characters that are not in the device's language characters Is it possible? Some of my app users write in arabic, the rest write in english. I need to translate text only when the text is in arabic and the user's device is in english or the other way around
duplicate of: http://stackoverflow.com/q/13144250
has comment: http://stackoverflow.com/comment/31046134
has comment: http://stackoverflow.com/comment/31048345
tagged with: java
type: Question
score: 5

http://stackoverflow.com/q/20776544
upvote count: 1
has title: Java not parameterizing Collections
has answer: http://stackoverflow.com/a/20776568
has answer: http://stackoverflow.com/a/20776569
has comment: http://stackoverflow.com/comment/31141677
favorite count: 0
has answer: http://stackoverflow.com/a/20776573
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4166966
downvote count: 0
has comment: http://stackoverflow.com/comment/31141722
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31141690
type: Question
has body: So I've noticed that doing something like: LinkedList list = new LinkedList(); Gives you a warning from the compiler, so I was always taught that the correct way was: LinkedList&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;(); But I've noticed that doing LinkedList&lt;Integer&gt; list = new LinkedList&lt;&gt;(); Doesn't throw a warning either, although I don't quite understand why. Could someone explain to me the difference between these last two examples, and if one is preferable to another, either style wise or just practically?
answer count: 3

http://stackoverflow.com/q/20820769
has answer: http://stackoverflow.com/a/20868056
has comment: http://stackoverflow.com/comment/31221778
has comment: http://stackoverflow.com/comment/31222912
tagged with: sqlexception
tagged with: derby
has comment: http://stackoverflow.com/comment/31223104
score: 0
answer count: 1
has body: I have written a test program that makes a Derby connection and creates the necessary tables if they do not exist. But once I run the programme I can't rerun it again because the exception I have brought. I think that I should add a finilize method to the current singletone class and close the connection there. Is it the solution? But anyway I consider the possiblity of the program crash and exiting from the program in an abnormal manner. In that case how can I force to close the other instances of the connection to the database safely and make my own connection? public class DBTest { public static void main(String[] args) { DBConnection.getInstance(); } } public class DBConnection { private static DBConnection ourInstance = new DBConnection(); private Connection connection; public static DBConnection getInstance() { return ourInstance; } private DBConnection() { String driver = "org.apache.derby.jdbc.EmbeddedDriver"; String dbName="C:/Users/Puk/IdeaProjects/DerbyTest/database/Ablauf"; String connectionURL = "jdbc:derby:" + dbName + ";create=true"; try { Class.forName(driver); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { connection = DriverManager.getConnection(connectionURL); } catch (SQLException e) { e.printStackTrace(); } createTables(); } private void createTables(){ Statement s; try { s = connection.createStatement(); s.execute("CREATE TABLE category ( id SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY \n" + "\t(START WITH 0, INCREMENT BY 1), title VARCHAR(100))"); } catch (SQLException e) { e.printStackTrace(); } } } java.sql.SQLException: Failed to start database 'C:/Users/Puk/IdeaProjects/DerbyTest/database/Ablauf' with class loader sun.misc.Launcher$AppClassLoader@1830e4a7, see the next exception for details. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) at org.…
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31221958
tagged with: database-connection
has title: How can I shut down a Derby connection that has been made by another program?
tagged with: java
has comment: http://stackoverflow.com/comment/31223347
has comment: http://stackoverflow.com/comment/31221693
has comment: http://stackoverflow.com/comment/31223318
type: Question

http://stackoverflow.com/comment/31152626
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20782951
has text: Good point.. I forgot that... I want use it with java

http://stackoverflow.com/comment/31259000
comment on: http://stackoverflow.com/a/20840820
score: 0
type: AnswerComment
type: Comment
has text: Would Java even create a default constructor in this case? I thought that constructor was only made if the programmer didn't supply any other constructors.

http://stackoverflow.com/comment/30981761
type: AnswerComment
comment on: http://stackoverflow.com/a/20686954
score: 0
type: Comment
has text: @JimMischel I updated my answer to first find the row

http://stackoverflow.com/a/20821025
score: 0
has comment: http://stackoverflow.com/comment/31222368
has comment: http://stackoverflow.com/comment/31222540
has comment: http://stackoverflow.com/comment/31222777
type: Answer
has body: Listener, being an ActionListener through its inheritance hierarchy, public class Listener implements ActionListener { needs to implement an actionPerfomed(ActionEvent) method @Override public void actionPerformed(ActionEvent e) { // implement it } However, since you seem to be adding an anonymous ActionListener, just don't have your Listener class implement ActionListener. Remove that bit.
answers question: http://stackoverflow.com/q/20820966

http://stackoverflow.com/comment/31015571
has text: Thanks @JVMATL! This is a great catch. I was aware of this technique and it's cache friendliness, but, totally missed it here. It did increase the performance for me by 20x at least.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20705206
type: Comment

http://stackoverflow.com/q/20828050
upvote count: 2
has title: Android - Checking if editText is >3 before and after user input
accepted answer: http://stackoverflow.com/a/20828067
type: Question
has answer: http://stackoverflow.com/a/20828055
tagged with: java
has answer: http://stackoverflow.com/a/20828067
has body: I have some code where I need a "Create Account" button to be disabled if an editText field has less than 3 char in it. If the User enters 3 chars, then the button should enable itself so that it can be used. I have constructed the if else statement that disables the button if there are less than 3 char in the editText field, BUT on input, when the user inserts 3 char, it does not re-evaluate to see if the statement is true so the button of course stays disabled. Once the user enters 3 char into the edit text field, the button should enable itself. Button buttonGenerate = (Button) findViewById(R.id.btnOpenAccountCreate); userInitials = (EditText) findViewById(R.id.etUserChar); if (userInitials.getText().toString().length() &gt; 3) { // Account Generator Button buttonGenerate.setEnabled(true); // enable button; buttonGenerate.setOnClickListener(new OnClickListener() { //Do cool stuff here @Override public void onClick(View v) { } });// END BUTTON } else { // If UserInitials is empty, disable button Toast.makeText(this, "Please enter three(3) characters in the Initials Field ", Toast.LENGTH_LONG) .show(); buttonGenerate.setEnabled(false); // disable button; }// END IF ELSE
linked to: http://stackoverflow.com/q/16566658
answer count: 2
downvote count: 0
tagged with: button
favorite count: 0
possible better answer: http://stackoverflow.com/a/20828055
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: android-edittext

http://stackoverflow.com/comment/31196903
score: 0
type: Comment
has text: Do you have a link with good material regarding these custom borders?
comment on: http://stackoverflow.com/a/20806853
type: AnswerComment

rot13
tags question: http://stackoverflow.com/q/20730373
tag name: rot13
type: Tag

http://stackoverflow.com/comment/108436422
type: Comment
has text: I call it a programmatic way to solve an problem. Excellent solution.
comment on: http://stackoverflow.com/a/25118544
type: AnswerComment
score: 0

http://stackoverflow.com/a/20700520
upvote count: 3
answers question: http://stackoverflow.com/q/20700447
has comment: http://stackoverflow.com/comment/31005054
score: 3
accepted answer of: http://stackoverflow.com/q/20700447
has comment: http://stackoverflow.com/comment/31004801
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: For Drawing a circle in Swing: public class CirclePanel extends JPanel { @Override protected void paintComponent(Graphics g) { //Adding super.paintComponent.... super.paintComponent(g); g.drawOval(0, 0, g.getClipBounds().width, g.getClipBounds().height); } } For adding text inside the circle you can use GridBagLayout.i.e. CirclePanel panel = new CirclePanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints cl; cl = new GridBagConstraints(); cl.gridy = 0; panel.add(new JLabel("Hello"), cl); Here is the Link in that you can use swing to draw a circle using Canvas. Draw canvas with color and text

http://stackoverflow.com/comment/31275815
comment on: http://stackoverflow.com/a/20846284
score: 1
has text: Try wrapping that solution in a loop with >= 10000 iterations and a much longer stream string. This will give a better scaled timing result than just 0. Be sure to only include the needed items inside the outer performance loop, timing and setup can be done outside that loop.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31239866
comment on: http://stackoverflow.com/q/20830304
has text: my input from .txt file is something like this statistics a1 population1: [4.23 +9.98 15 +3.23 +9.98 29] population2: [20 +6.5 13 +1.23 +2.98] .
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31002074
has text: I also have a file which needs to be read. Which directory should that be in? Currently it's in the Testing folder but it isn't working. However it executes fine when I'm using eclipse
comment on: http://stackoverflow.com/a/20699072
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31243492
has text: Are you sure that the class is packaged in the war file?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20832187
type: Comment

http://stackoverflow.com/comment/31039605
type: QuestionComment
has text: check the first code block i wrote, that is how i created the database, is there anything missing ?
comment on: http://stackoverflow.com/q/20719840
score: 0
type: Comment

http://stackoverflow.com/comment/31131853
comment on: http://stackoverflow.com/q/20770151
has text: No, I can't. They belong to my client. You will have to take my word for it. But if you would like to show us some code, we may be able to find the bug in it for you.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20752899
type: Answer
has body: Quite the opposite in fact - it is actually good practice. Remember that using generics is a technique to avoid coding mistakes by catching as many mistakes as possible at compile time. By tightening the specificity of your BinarSearchTree interface you are actually making it more difficult for people to misuse it accidentally. Not only that but their mistakes will be discovered at compile time.
score: 1
answers question: http://stackoverflow.com/q/20752515
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20752515

http://stackoverflow.com/comment/31799965
comment on: http://stackoverflow.com/a/20990878
score: 1
type: AnswerComment
has text: @M.Mimpen Since this is thread-local context, switching to another thread will not affect the previous thread's context. In the implementation, one would need to use `thread_local`, `__thread`, or `__declspec(thread)` in C/C++, and `ThreadLocal` in Java.
type: Comment

http://stackoverflow.com/q/20812125
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31205784
has comment: http://stackoverflow.com/comment/31205930
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/20812610
favorite count: 0
tagged with: hibernate-mapping
has body: I'm trying to use criteria for select the values from many-to-one releationship mapped field.But i'm getting errororg.hibernate.QueryException: could not resolve property:part_id of:. Please see my pojo classes and advise what is the wrong here. Criteria partCriteria = session.createCriteria(PartFeatureVersion.class); partCriteria.add(Restrictions.eq("part_id",part.getPart_id())); @Entity @Table(name="DBO.PART_FEATURE_VERSION") public class PartFeatureVersion { private Part part; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="part_id") public Part getPart() { return part; } @Entity @Table(name="DBO.PART") public class Part { private String part_id; private Set&lt;PartFeatureVersion&gt; partfeatureversion = new HashSet&lt;PartFeatureVersion&gt;(0); @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="PART_ID") public String getPart_id() { return part_id; } @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy="part") public Set&lt;PartFeatureVersion&gt; getPartfeatureversion() { return partfeatureversion; } if create getters/setters in PartFeatureVersion pojo class , its giving error as org.hibernate.MappingException: Repeated column in mapping for entity:PART_ID (should be mapped with insert="false" update="false").
has comment: http://stackoverflow.com/comment/31205996
tagged with: java
possible better answer: http://stackoverflow.com/a/23445485
tagged with: orm
upvote count: 1
has answer: http://stackoverflow.com/a/23445485
has comment: http://stackoverflow.com/comment/31205473
has comment: http://stackoverflow.com/comment/31206397
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20812610
has comment: http://stackoverflow.com/comment/31205619
has title: Hibernate Criteria - org.hibernate.QueryException: could not resolve property:
tagged with: criteria
tagged with: hibernate

http://stackoverflow.com/comment/31477377
has text: Thanks for you reply. I have removed the disconnect and it did not make a difference. However I have discovered more information by reading the tcpdump and have updated my original question with additional information.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20939822
type: Comment

jdbc
tags question: http://stackoverflow.com/q/20768645
tags question: http://stackoverflow.com/q/20699511
tags question: http://stackoverflow.com/q/20756864
tags question: http://stackoverflow.com/q/20780990
tags question: http://stackoverflow.com/q/20683316
tags question: http://stackoverflow.com/q/20771486
tags question: http://stackoverflow.com/q/20818300
tags question: http://stackoverflow.com/q/20771691
tags question: http://stackoverflow.com/q/20689397
tags question: http://stackoverflow.com/q/20719514
tags question: http://stackoverflow.com/q/20743263
tags question: http://stackoverflow.com/q/20739880
tags question: http://stackoverflow.com/q/20820193
tags question: http://stackoverflow.com/q/20742666
tags question: http://stackoverflow.com/q/20772636
tags question: http://stackoverflow.com/q/20845977
tags question: http://stackoverflow.com/q/20760848
type: Tag
tags question: http://stackoverflow.com/q/20813030
tags question: http://stackoverflow.com/q/20844065
tags question: http://stackoverflow.com/q/20797752
tags question: http://stackoverflow.com/q/20769197
tags question: http://stackoverflow.com/q/20810703
tags question: http://stackoverflow.com/q/20723711
tags question: http://stackoverflow.com/q/20707524
tags question: http://stackoverflow.com/q/20779583
tags question: http://stackoverflow.com/q/20834020
tags question: http://stackoverflow.com/q/20824464
tags question: http://stackoverflow.com/q/20694250
tags question: http://stackoverflow.com/q/20741713
tags question: http://stackoverflow.com/q/20799988
tags question: http://stackoverflow.com/q/20700058
tags question: http://stackoverflow.com/q/20695570
tags question: http://stackoverflow.com/q/20798178
tags question: http://stackoverflow.com/q/20842422
tags question: http://stackoverflow.com/q/20716169
tags question: http://stackoverflow.com/q/20742115
tags question: http://stackoverflow.com/q/20801008
tags question: http://stackoverflow.com/q/20832271
tags question: http://stackoverflow.com/q/20696242
tags question: http://stackoverflow.com/q/20742794
tags question: http://stackoverflow.com/q/20827149
tags question: http://stackoverflow.com/q/20681352
tags question: http://stackoverflow.com/q/20723025
tags question: http://stackoverflow.com/q/20775165
tags question: http://stackoverflow.com/q/20801249
tags question: http://stackoverflow.com/q/20799496
tags question: http://stackoverflow.com/q/20731470
tags question: http://stackoverflow.com/q/20730394
tags question: http://stackoverflow.com/q/20698677
tags question: http://stackoverflow.com/q/20768905
tags question: http://stackoverflow.com/q/20748046
tags question: http://stackoverflow.com/q/20745189
tag name: jdbc
tags question: http://stackoverflow.com/q/20745010
tags question: http://stackoverflow.com/q/20816947
tags question: http://stackoverflow.com/q/20719840
tags question: http://stackoverflow.com/q/20791925
tags question: http://stackoverflow.com/q/20747682
tags question: http://stackoverflow.com/q/20797540
tags question: http://stackoverflow.com/q/20791477
tags question: http://stackoverflow.com/q/20820769

http://stackoverflow.com/comment/31054698
type: Comment
comment on: http://stackoverflow.com/a/20727885
has text: The problem with this approach is that you can overflow the numeric range of the underlying integer types, assuming the rational type is based on integers. If it's based on doubles (which seems odd), then you could still get loss of precision if the product exceeds the precision of the significand of a double (53 bits).
type: AnswerComment
score: 0

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/20772121
tags question: http://stackoverflow.com/q/20822750

http://stackoverflow.com/a/20739987
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/20739605
downvote count: 0
has comment: http://stackoverflow.com/comment/31076957
has body: Your understanding isn't quite correct. Catching an exception handles it, and after the catch is completed, flow will continue after the try/catch, unless you throw another exception, or re-throw the exception. This might explain it better: try { // Happy case flow here ... throw new PayboxFault(...); // If an exception is thrown, the remainder of the `try` block is skipped } catch (Exception e) { // The exception is now handled ... // Unless a new exception is thrown, or the caught exception re-thrown } finally { // Code here should always be called after the try OR catch block executes, // Finally is called even if the catch re-throws } // Code after the try-catch-finally executes if the try completes successfully // OR if the exception is handled in the catch, but not if the catch re-throws
score: 5

http://stackoverflow.com/comment/30995990
score: 0
type: Comment
type: QuestionComment
has text: @EJP Seems reasonable. If you add this as an answer I will accept it.
comment on: http://stackoverflow.com/q/20694951

http://stackoverflow.com/comment/57092500
has text: @StuartMarks: I understand that `dropXXX` and `takeXXX` are more popular terms but I can personally live with the more SQL-esque `limitXXX` and `skipXXX`. I find this new asymmetry much more confusing than the individual choice of terms... :) (btw: Scala also has `drop(int)` and `take(int)`)
score: 3
comment on: http://stackoverflow.com/a/32304570
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20824962
downvote count: 0
has comment: http://stackoverflow.com/comment/31229579
has body: What is the difference between these two object declarations? They are not the same as you are trying to compare the both. First case is you are not creating any Object of A, just initializing it to null. Later you are creating an Object for A with new. Coming to the memory aspect there no such leak here. Garbage collector do the stuff when you are no references to your Object. //code A a = null; //codes a.something() // NullpointerException case 2 //code A a = null; //codes a = new A(); a.something() // No NullpointerException
answers question: http://stackoverflow.com/q/20824943
has comment: http://stackoverflow.com/comment/31229511
type: Answer
has comment: http://stackoverflow.com/comment/31229276
has comment: http://stackoverflow.com/comment/31229548
upvote count: 3
has comment: http://stackoverflow.com/comment/31246035
has comment: http://stackoverflow.com/comment/31230402
has comment: http://stackoverflow.com/comment/31229204
has comment: http://stackoverflow.com/comment/31230961
score: 3
accepted answer of: http://stackoverflow.com/q/20824943
has comment: http://stackoverflow.com/comment/31229171
has comment: http://stackoverflow.com/comment/31229208
has comment: http://stackoverflow.com/comment/31230348
has comment: http://stackoverflow.com/comment/31229416
type: AcceptedAnswer

http://stackoverflow.com/comment/31161831
score: 0
type: QuestionComment
type: Comment
has text: @SotiriosDelimanolis So i should determine it just by argument name equality ?
comment on: http://stackoverflow.com/q/20787976

http://stackoverflow.com/q/20796870
tagged with: struts2
has comment: http://stackoverflow.com/comment/31177720
answer count: 1
downvote count: 0
has body: I want to maintain length of contact number(Like mobile number in between 10 and 12 digits number ). When I used String type I got but it allows alphabets along with numbers also. I want to prevent alphabets. How can I do with integer. Below is my code: @StringLengthFieldValidator(type=ValidatorType.FIELD,message="contact should contain min of 10 numbers and max 12 numbers",minLength="10",maxLength="12") private String contact; Now I want for Integer type to do the same as above. How can I do @ ? private int contact;
favorite count: 0
has title: Validations in Struts2 for Integer value?
tagged with: regex
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/20797325
type: Question
tagged with: struts-validation
has answer: http://stackoverflow.com/a/20797325

http://stackoverflow.com/comment/31210270
score: 0
type: Comment
has text: http://stackoverflow.com/questions/11386057/netbeans-7-1-unable-change-to-ui-language
comment on: http://stackoverflow.com/a/20811495
type: AnswerComment

http://stackoverflow.com/q/20848858
answer count: 3
has comment: http://stackoverflow.com/comment/31274309
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20850399
has body: Perhaps a newbie question, but I could not find an answer on this one. Question: Do Eclipse workspaces depend on a specific Eclipse version (and analgously: do Eclipse projects depend on a specific Eclipse version)? For Example, on a workspace created with Eclipse 3.x, should I only work with Eclipse 3.x or can I also work on this workspace with Eclipse 4.x.
tagged with: java
has comment: http://stackoverflow.com/comment/31275433
tagged with: eclipse
has answer: http://stackoverflow.com/a/20852206
linked to: http://stackoverflow.com/q/9868848
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/20853614
favorite count: 0
has title: Do Eclipse workspaces depend on a specific Eclipse version?

http://stackoverflow.com/q/20742956
score: 6
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20743167
tagged with: java
possible better answer: http://stackoverflow.com/a/20743085
type: Question
has body: WeakHashMap is an implementation of Map interface where the memory of the value object can be reclaimed by Grabage Collector if the corresponding key is no longer referred by any section of program. So if key is no longer used in program. its Entry object will be garbage collected irrespective of its usage. Its clear till here This is different from HashMap where the value object remain in HashMap even if key is no longer referred. We need to explicitly call remove() method on HashMap object to remove the value. calling remove will just remove the entry from map. Its readyness for GC will depend whether it is still used somewhere in program or not. Please find this coding example explaining above Usage of WeakHashMap over HashMap as per mine understanding My understanding is we should go for WeakHashMap only when we want to ensure that value object is reclaimed by Grabage Collector when key is no longer referred by any section of program. This makes program memory efficient Is my understanding correct here? Usage of WeakHashMap as per JavaDocs , i could spot this statement This class is intended primarily for use with key objects whose equals methods test for object identity using the == operator. I did not get what above statement meant and how it contrast with mine understanding of WeakHashMap usage. Actually i did not get how this statement is related to usage of WeakHashMap? UPDATE:- on further carefully reading below statement the javadocs An entry in a WeakHashMap will automatically be removed when its key is no longer in ordinary use. More precisely, the presence of a mapping for a given key will not prevent the key from being discarded by the garbage collector, that is, made finalizable, finalized, and then reclaimed. When a key has been discarded its entry is effectively removed from the map, so this class behaves somewhat differently from other Map implementations. i am revising my understanding for the benefit of me and others Usage of WeakHashMap over Ha…
tagged with: hashmap
has answer: http://stackoverflow.com/a/45185238
duplicate of: http://stackoverflow.com/q/154724
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/20743012
has title: Usage of WeakHashMap?
has answer: http://stackoverflow.com/a/20743123
accepted answer: http://stackoverflow.com/a/20743123
tagged with: weakhashmap
has answer: http://stackoverflow.com/a/20743085
linked to: http://stackoverflow.com/q/154724
answer count: 5

http://stackoverflow.com/comment/96000771
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29115646
has text: this work if you want add a file directory as repository : https://docs.gradle.org/current/userguide/repository_types.html#sec:flat_dir_resolver

http://stackoverflow.com/comment/31178002
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20797118
type: AnswerComment
has text: The syntax "animal as Elephant" is OK providing that Elephant is a class, not struct

http://stackoverflow.com/a/20844657
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20844600
has body: You can't use 2 lists as a parameter to array adapter he knows to work only with one array. Whats the purpose of the second one?

http://stackoverflow.com/q/20708022
answer count: 3
accepted answer: http://stackoverflow.com/a/20708107
has comment: http://stackoverflow.com/comment/31017760
tagged with: hashmap
has answer: http://stackoverflow.com/a/20708091
score: 6
linked to: http://stackoverflow.com/q/13049222
possible better answer: http://stackoverflow.com/a/45773951
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/45773951
downvote count: 0
has body: I have a map (Map&lt;String, Set&lt;String&gt;&gt;), and want to copy the map to a new map object. However, if I just feed the map to the say HashMap constructor (new HashMap&lt;String, Set&lt;String&gt;&gt;(oldMap)) it won't do a full copy, and only copies the reference to the set, which can be modified and those changes will be reflected in the new map. Is there a more simply way of doing a full copy other than iterating over each key/value pair and creating a new HashSet for each set then adding that to the map?
favorite count: 0
has answer: http://stackoverflow.com/a/20708107
has comment: http://stackoverflow.com/comment/31017859
type: Question
tagged with: dictionary
upvote count: 6
has title: Deep copying a Java Map with values that are Sets
tagged with: java

http://stackoverflow.com/comment/31040612
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20692204
has text: Does WebLogic run under the same user as VisualVM? This would be the easiest explanation, why you don't see it in VisualVM, since VisualVM sees java applications running under the same user as VisualVM itself.
score: 0

http://stackoverflow.com/comment/31043574
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20720001
score: 0
has text: Thank you Amir Pashazadeh!!

http://stackoverflow.com/q/20825042
upvote count: 1
tagged with: calendar
type: Question
tagged with: primefaces
tagged with: jsf-2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Primefaces Calendar select week instead day
has body: I am using primefaces calendar. I want to select a week instead of selecting a day. I found out it was possible in primefaces 2.0 to have an array of days in backbean instead of one date object. I am using version 4 and it is not possible anymore. I was thinking if i could use the week number as the pattern and use the popup calendar it will show the week number in the text field. However it worked first time i tried, but second time i want to choose a date it will only display "w". Is the anyway to make this work? i was thinking to use a converter which convert the week number to a date because my theory is that calendar cant convert the week number to date by it self. I am not familiar using converters? I will appreciate any help. &lt;p:calendar value="#{bean.date}" locale="en" pattern="w"&gt;
answer count: 0
tagged with: jsf
score: 1
tagged with: java

android-intent
tags question: http://stackoverflow.com/q/20685907
tags question: http://stackoverflow.com/q/20755556
tags question: http://stackoverflow.com/q/20828454
tags question: http://stackoverflow.com/q/20712299
tags question: http://stackoverflow.com/q/20680111
tags question: http://stackoverflow.com/q/20729234
tags question: http://stackoverflow.com/q/20827106
tags question: http://stackoverflow.com/q/20703884
tags question: http://stackoverflow.com/q/20786105
tags question: http://stackoverflow.com/q/20788826
tags question: http://stackoverflow.com/q/20730196
tags question: http://stackoverflow.com/q/20761886
tags question: http://stackoverflow.com/q/20734593
tags question: http://stackoverflow.com/q/20846972
tags question: http://stackoverflow.com/q/20691403
type: Tag
tag name: android-intent
tags question: http://stackoverflow.com/q/20700531
tags question: http://stackoverflow.com/q/20755024
tags question: http://stackoverflow.com/q/20750257
tags question: http://stackoverflow.com/q/20718966
tags question: http://stackoverflow.com/q/20772770
tags question: http://stackoverflow.com/q/20779629

http://stackoverflow.com/q/20752519
has body: Not sure what I'm doing wrong here. My objective is to get the annotation of a method (if exists). public class RunTest { public static void main(String[] args) throws Exception, NoSuchMethodException { MyAction action = new MyAction(); Method method = action.getClass().getDeclaredMethod("printSomething"); RequiredPermission permission = method.getAnnotation(RequiredPermission.class); String value = permission.permissionName(); System.out.println("permission name: "+value); } } MyAction class public class MyAction { @RequiredPermission(permissionName="SYSO", permissionValue = 0) public void printSomething() { System.out.println("hi there"); } public void printABC() { System.out.println("ABC..."); } } and the annotation: public @interface RequiredPermission { String permissionName(); int permissionValue(); } I would expect to see on the console: permission name: SYSO but instead I get: Exception in thread "main" java.lang.NullPointerException at com.annotation.RunTest.main(RunTest.java:14)
has answer: http://stackoverflow.com/a/20752558
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20752560
accepted answer: http://stackoverflow.com/a/20752560
duplicate of: http://stackoverflow.com/q/3107970
has title: Java annotations throws NullPointerException.
linked to: http://stackoverflow.com/q/3107970
favorite count: 0
tagged with: annotations
upvote count: 1
possible better answer: http://stackoverflow.com/a/20752558
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/20739868
answer count: 6
tagged with: inheritance
favorite count: 0
has title: Java Inheritance and Constructor Arguments
has answer: http://stackoverflow.com/a/20739932
has comment: http://stackoverflow.com/comment/31075985
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20739889
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20739887
has answer: http://stackoverflow.com/a/20739887
type: Question
has body: I am amateur in Java please help me. I have a class: Account public class Account { protected String fullName; protected String accontNumber; protected String password; protected int balance; public Account(String name, String acc_num, String pass, int b){ fullName = name; accontNumber = acc_num; password = pass; balance = b; } } and I going to create a new class Account2 that inherit from Account public class Account2 extends Account{ public Account2(String l){ String[] temp = l.split(","); super.fullName = temp[0]; super.accontNumber = temp[1]; super.password = temp[2]; super.balance = Integer.parseInt(temp[3]); } } But I receive an error message that say: Actual and formal argument list are differ in length how can I solve this problem?
accepted answer: http://stackoverflow.com/a/20739889
has answer: http://stackoverflow.com/a/20740066
has answer: http://stackoverflow.com/a/20740119
has answer: http://stackoverflow.com/a/20739915
downvote count: 0
has comment: http://stackoverflow.com/comment/31076296

http://stackoverflow.com/comment/35986991
type: AnswerComment
score: 0
type: Comment
has text: You are quite wrong in assuming that your answer is here to please or that anyone's distress has anything to do with its appropriateness for SO. I pointed out that, as a sample of community's appraisal of your answer, those in favor are outnumbered by a factor of two by those opposing it. You should also take note that answers are not a thread of discussion and there is no "context" of other answers to call upon.
comment on: http://stackoverflow.com/a/20769218

http://stackoverflow.com/comment/31002152
type: Comment
has text: Where you run the command matters. You should be in the `Testing` folder when you execute it, then you could specify `-cp` as just `src`. This will set the correct classpath and have the working directory as `Testing`
comment on: http://stackoverflow.com/a/20699072
type: AnswerComment
score: 0

http://stackoverflow.com/a/20952034
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20802649
has body: If you want to detect your object in an environment more complex (rotation, deformation, scaling, perspective), you need a detection method more efficient. I suggest you to see what is called a "cascade classifier for Haar features" OpenCv can propose you a lot of function to do this method rapidly. See this useful page Or even by matlab you can see this example
upvote count: 1
type: Answer

http://stackoverflow.com/q/20817253
tagged with: unicode
type: UnansweredQuestion
tagged with: java
type: Question
has title: Unicode Char in Java
has comment: http://stackoverflow.com/comment/31215007
score: 0
has answer: http://stackoverflow.com/a/20817327
has body: In the Arabic Language, characters have different representation based on whether in the beginning, middle or the end of a word: خ‎ 062E ﺥ‎ FEA5 ـخ‎ FEA6 ـخـ‎ FEA8 خـ‎ FEA7 These are the same letter but in different positions. When I use the normal (int) B.charAt(x) I get the Unicode value of the character (062E). Is there a method to get the value based on the position?
answer count: 1

http://stackoverflow.com/a/20735850
type: Answer
has comment: http://stackoverflow.com/comment/31101286
upvote count: 1
has comment: http://stackoverflow.com/comment/31069774
score: 1
accepted answer of: http://stackoverflow.com/q/20735743
has comment: http://stackoverflow.com/comment/31069522
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31069817
has comment: http://stackoverflow.com/comment/31069807
has body: You seem to be confused about Java in a very basic way. In Java, you generally name methods without starting them with a capital letter. If main is not static, it will not be called, you will just get a very clear error message when you try to run the program. You have to put parentheses around a method call whether or not there are any arguments to it. You have to use Engine.main() instead of Engine.main. If you are trying to get user input, you can't pass the string to the method and expect the method to change what you pass to it. You need to return it or return it in a class variable. No matter how hard you try, you can't set a number to null. In fact, setting the number to null is unnecessary here. Just set it to System.Nextint. And, by the way, getting user input as an int is more complicated than that. Scanner in = new Scanner(System.in); int number = in.nextInt(); And, your real problem: Just make getInput (what CommandLine should be called) and other such methods static. And don't use this.method(), use method(). I think it is unlikely that you have every compiled this code. Well do it now and see how many errors you find (if that's your real code and not just a casual guess.)
has comment: http://stackoverflow.com/comment/31101297
answers question: http://stackoverflow.com/q/20735743
has comment: http://stackoverflow.com/comment/31069547
has comment: http://stackoverflow.com/comment/31069532

http://stackoverflow.com/a/20699043
type: AcceptedAnswer
has body: Try out as below: public Uri getContactImage() { try { Cursor cur = this.ctx.getContentResolver().query( ContactsContract.Data.CONTENT_URI, null, ContactsContract.Data.CONTACT_ID + "=" + this.getId() + " AND " + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE + "'", null, null); if (cur != null) { if (!cur.moveToFirst()) { return null; // no photo } } else { return null; // error in cursor process } } catch (Exception e) { e.printStackTrace(); return null; } Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long .parseLong(getId())); return Uri.withAppendedPath(person, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); } Use above method as below: Uri u = getContactImage(); if (u != null) { mImageView.setImageURI(u); } else { mImageView.setImageResource(R.drawable.ic_launcher); }
type: Answer
has comment: http://stackoverflow.com/comment/68922455
accepted answer of: http://stackoverflow.com/q/20698951
score: 0
answers question: http://stackoverflow.com/q/20698951

http://stackoverflow.com/a/20831374
score: 1
has body: Firstly, it's very hard to read that code. In your MainThread you nested if statement few times and without deep code analysing, its hard to tell what is wrong. But few things get my attention. In Downloads class you grab references for read and write lock from two different ReentrantReadWriteLock objects! private Lock readLock=new ReentrantReadWriteLock().readLock(); private Lock writeLock=new ReentrantReadWriteLock().writeLock(); It can't work! You should create one ReentrantReadWriteLock instance for Download object and obtain references for readLock and writeLock lock from it. Read and Write lock are connected, so when you lock on writeLock you prevent readers from executing protected part of code. Pleas read more about ReadWriteLock and you can look at example of using ReentrantReadWriteLock in mbassador EventBus. What's more, is that you don't need locks in Downloads and DownloadsNode either! Because you create instances of those class per thread and you don't share it between threads. So you can simply remove all code responsible for locking from those classes. The only object witch is shared among the thread is instance of Cache class. Furthermore you don't need synchronized(this) in MainThread! Each new thread created from this class will be synchronized on different object (this). So it's doesn't make sense to add all of those synchronized blocks. The worst thing is that I see only one thread in your attached code. I think you should remove all code responsible for locking and synchronizing, and then analyse witch objects are shared between threads and should be protected from concurrent access. For me only object witch need to be locked is Cache instance. Maybe if you post working SSCCE some one can help you with refactoring this code. VGR point few good tips in his comment.
upvote count: 1
answers question: http://stackoverflow.com/q/20829590
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20829590
type: Answer
has comment: http://stackoverflow.com/comment/31253215

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/20683502
tags question: http://stackoverflow.com/q/20687139

http://stackoverflow.com/comment/30995890
type: AnswerComment
comment on: http://stackoverflow.com/a/20695491
score: 0
type: Comment
has text: +1 for the JSpinner. I always forget about that one.

http://stackoverflow.com/comment/134894475
type: AnswerComment
has text: I disagree: looping over the lines is only one of the many possible operations that can be done on that list. Going that way, you would have to write a utility for each possible operation on the list! And even if you reuse existing utilities to avoid reinventing the wheel, nothing guarantees that other devs will use that utility when performing operations on the list. If you don't expose a setter on that list attribute, or if you use `@NonNull` annotations, you can ensure a `NullPointerException` could never be throw.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/53446575

http://stackoverflow.com/q/20750984
has answer: http://stackoverflow.com/a/20759876
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/16600547
favorite count: 0
has comment: http://stackoverflow.com/comment/31096961
type: UnansweredQuestion
has body: I am following the answer here: How get a string width in Libgdx? The problem I am having is that the getBounds doesn't seem to return to correct width. My code below should place dots after the end of the string, but you can see dots bleeding through some of the text. How do I get correct width of the text? for (HighScore s : this.scoresData){ font.draw(batch, s.name, x, y); TextBounds nameBounds = font.getBounds(s.name); font.draw(batch, s.value, (float) (KineticAssaultMain.WIDTH / 1.5f), y); for (float i = (nameBounds.width + x); i &lt; ((float)Screen.WIDTH / 1.5f);){ TextBounds dot = font.draw(batch, ".", i, y); i += dot.width; } // go to the next line y -= 32; }
upvote count: 1
type: Question
has title: LibGDX getBounds not returning correct width
tagged with: libgdx
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31097200
has comment: http://stackoverflow.com/comment/31102151

http://stackoverflow.com/a/20816802
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20816555
score: 1
has body: Use x= Double.parseDouble(scan.nextLine()); Instead of x = scan.nextDouble();

http://stackoverflow.com/a/20814047
has comment: http://stackoverflow.com/comment/31209024
downvote count: 0
type: Answer
has body: The above code will give you a null pointer. Reason: Your array lists are not initialized. You need to initialize them in the constructor of your class. Further, it best if you define more methods, other than getter and setter that will add data to the array list. public class VariablesClass { private ArrayList&lt;Integer&gt; ids; private ArrayList&lt;String&gt; names; public VariablesClass() { ids = new ArrayList&lt;Integer&gt;(); names = new ArrayList&lt;String&gt;(); } public ArrayList&lt;Integer&gt; getIds() { return ids; } public void setIds(ArrayList&lt;Integer&gt; ids) { this.ids = ids; } public ArrayList&lt;String&gt; getNames() { return names; } public void setNames(ArrayList&lt;String&gt; names) { this.names = names; } public void addName(String name) { this.names.add(name); } public void addId(Integer id) { this.ids.add(id); } } Call the method addName as many times as you need !
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20814002
has comment: http://stackoverflow.com/comment/31209390

http://stackoverflow.com/q/20843833
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: parcelable
answer count: 1
has answer: http://stackoverflow.com/a/20844292
score: 0
tagged with: nullpointerexception
tagged with: android
linked to: http://stackoverflow.com/q/7675891
has body: I was trying to pass an instance of my Music class from one activity to another, and I did get that to work; however, now I can't use any of Music class' methods in the second activity. It keeps throwing a NullPointerException when I try to call any method in Music. Music Class: public class Music implements Parcelable{ private static ArrayList&lt;genericSongClass&gt; songs = new ArrayList&lt;genericSongClass&gt;(); Cursor cursor; Context context; public Music(){}; public Music(Context context){ this.context = context; } public Music(Parcel in){ songs = new ArrayList&lt;genericSongClass&gt;(); in.readTypedList(songs, genericSongClass.CREATOR); } public void BindAllSongs() { /** Making custom drawable */ String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0"; final String[] projection = new String[] { MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.ALBUM}; final String sortOrder = MediaStore.Audio.AudioColumns.TITLE + " COLLATE LOCALIZED ASC"; try { // the uri of the table that we want to query Uri uri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; // query the db cursor = context.getContentResolver().query(uri, projection, selection, null, sortOrder); if (cursor != null) { songs = new ArrayList&lt;genericSongClass&gt;(cursor.getCount()); cursor.moveToFirst(); while (!cursor.isAfterLast()) { genericSongClass GSC = new genericSongClass(); GSC.songTitle = cursor.getString(0); GSC.songArtist = cursor.getString(1); GSC.songData = cursor.getString(2); GSC.songAlbum = cursor.getString(3); songs.add(GSC); cursor.moveToNext(); } } } catch (Exception ex) { } finally { if (cursor != null) { cursor.close(); } } } public static Object[] toArray(ArrayList&lt;Object&gt; list){ Object[] toReturn = new Object[list.size()]; for (int i = 0; i &lt; list.size(); i++){ toReturn[i] = list.get(i); } return toReturn; } public ArrayList&lt;String&gt; getArtists(){ ArrayList&lt;String&gt; artists = …
has title: Android: Parcelable object successfully passed to another activity, but now I can't use any of its methods

http://stackoverflow.com/a/20700706
score: 23
has body: And a short use - case: Imagine exposing a User - Object via a public available webservice. You sure would like to expose things as nickname, online - state, maybe email or location. You definitly would not want to expose the password the user uses to login. Whilst this password could be a property of your User- object, it should not be serialized e.g. when serializing the object to a JSON - String for the webservice mentioned.
upvote count: 23
has comment: http://stackoverflow.com/comment/64565074
answers question: http://stackoverflow.com/q/20700530
type: Answer
downvote count: 0

http://stackoverflow.com/a/20680062
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20679974
downvote count: 0
answers question: http://stackoverflow.com/q/20679974
has body: I think you want a singelton 'with arguments'. This should explain it : Singleton with Arguments in Java

http://stackoverflow.com/comment/31083409
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20740767
score: 0
has text: Are the brackets nested ? Could there be escaped quotes ? Something like `A [B [C D]] "E\" F"` ? If so what is the expected output ? You most likely will need to write your own parser if this is the case ...

http://stackoverflow.com/comment/31230362
type: QuestionComment
score: 1
has text: Could you show us an example of how the data would be laid out in the text file?
comment on: http://stackoverflow.com/q/20825560
type: Comment

http://stackoverflow.com/comment/31240426
comment on: http://stackoverflow.com/a/20829582
score: 0
type: AnswerComment
has text: this was also giving me headaches when using strings, though I'm not sure what is meant by "string equals method()". Could you give a quick example of this?
type: Comment

http://stackoverflow.com/q/20732451
has answer: http://stackoverflow.com/a/20732496
tagged with: overloading
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20732502
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 6
tagged with: inheritance
has answer: http://stackoverflow.com/a/20732648
has comment: http://stackoverflow.com/comment/31062815
has comment: http://stackoverflow.com/comment/31062844
accepted answer: http://stackoverflow.com/a/20732648
has answer: http://stackoverflow.com/a/20732502
downvote count: 0
has title: Java method overloading confusion
has answer: http://stackoverflow.com/a/20732498
has answer: http://stackoverflow.com/a/20732560
favorite count: 0
has answer: http://stackoverflow.com/a/20732674
has body: In a server code, I have a ProtocolHandler class which reads from the socket, finds out which type of packet it's dealing with and dispatches it to the client. I'm trying to have the following architecture: public interface Packet { //... } public class ClientInformations implements Packet { //... } public class ProtocolHandler { //.... public void bytesReceived(byte[] bytes) { //... Determine the type of the packet Packet packet = determineTypeOfPacketAndRead(bytes); // Here I already have the packet object built, // like ClientInformations@1a1a1a1a[...] client.packetReceived(packet); } //... } public class Client { //... public void packetReceived(Packet pkt) { System.out.println("Unimplemented packet received."); } public void packetReceived(ClientInformations ci) { } //... } (I don't know how to explain it easily with words). The problem is, I really thought packetReceived(ClientInformations) would be called, but it's not. It's calling the more general packetReceived(Packet) method. Am I wrong? How can I still use the same architecture then? --EDIT Now I understand why that happens. The problem is, i have other packet classes, such as Movement, Sync, Spawn. I wanted to ease adding new packets by just having to add a new method to the Client class. Isn't there another way of doing that then? I mean, a way to automatically analyse the type of the packet object at runtime and doing the most specific method call?
tagged with: interface

http://stackoverflow.com/comment/31140370
type: QuestionComment
has text: @JBNizet would you mind if I post answer to this question myself using your info from your comment?
comment on: http://stackoverflow.com/q/20748046
score: 0
type: Comment

http://stackoverflow.com/comment/31076982
has text: its a three class combo.. class adapt calls subscriber...and subscriber calls calculator..calculator returns the value..and the flow goes vice versa then
comment on: http://stackoverflow.com/a/20738805
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31114471
comment on: http://stackoverflow.com/a/20761357
type: AnswerComment
has text: Can you tell me which one to download for windows as i have tried the first one and it does not have any jar file which i can import.
score: 0
type: Comment

http://stackoverflow.com/q/20766313
linked to: http://stackoverflow.com/q/12367801
has comment: http://stackoverflow.com/comment/31123684
tagged with: java
has answer: http://stackoverflow.com/a/20767348
has body: I want to find all cycles in graph and using this solution Finding all cycles in undirected graphs algorithm works fine, but I want to pass two dimensional array as argument, but there comes in a problem: the given graph is declared like static int[][] graph = { {1, 7}, {1, 8}, {7, 8}, {2, 3}, {3, 4}, {6, 4}, {7, 6}, {8, 7} }; and it works, but I used int[][] intGraph = new int[500][4]; ..... intGraph[j][0] = Integer.parseInt(edge[i]); intGraph[j][1] = Integer.parseInt(edge[i+1]); intGraph[j][2] = Integer.parseInt(edge[i+2]); .... both array values I can accsess via arrayname[x][y] but when I'm trying to pass it as an argument in: (all algorithm in link above) public GraphCycleFinder(int[][] graphs) { graph = graphs; for (int i = 0; i &lt; graph.length; i++){ System.out.println(i); //added to check itterations for (int j = 0; j &lt; graph[i].length; j++) { //System.out.print(graph[i][j]); findNewCycles(new int[] {graph[i][j]}); } } I get no result, no errors. When I print out i values (to check how far it iterates), it gives me 0 when it loops through my array (but should be from 0 to 500), but prints from 0 to array length this hard-coded array. I suppose that there is something with array declarations because I tried int[][] intGraph; and then put values like intGraph[j][0] = Integer.parseInt(edge[i]); but I got java.lang.NullPointerException Any ideas? P.s. sorry if too stupid question, I'm new in java. UPDATE Problem is not with array declaration. I commented out findNewCycles(new int[] {graph[i][j]}); and bouth cycles gave necessary result. Probably method findNewCycles in this algorithm can't handle this big array. :( although only 200 vertex and 500 edges. Not much.
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/31123871
has comment: http://stackoverflow.com/comment/31123616
tagged with: arrays
has comment: http://stackoverflow.com/comment/31123591
has comment: http://stackoverflow.com/comment/31123708
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31123677
has title: Difference between different array declarations in java
has comment: http://stackoverflow.com/comment/31124364
has comment: http://stackoverflow.com/comment/31123770
tagged with: multidimensional-array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31124380
has comment: http://stackoverflow.com/comment/31124915
has comment: http://stackoverflow.com/comment/31124780
tagged with: depth-first-search
linked to: http://stackoverflow.com/q/17263691
has comment: http://stackoverflow.com/comment/31123534

http://stackoverflow.com/a/20789767
accepted answer of: http://stackoverflow.com/q/20788447
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20788447
has body: I kinda solved it. I had to do a spoof.setReadTimeout(10000); so it times out after 10 seconds and tries to connect again. It should be just a safety measure, but without it, the program doesn't complete.
type: AcceptedAnswer

http://stackoverflow.com/comment/31011777
comment on: http://stackoverflow.com/a/20703024
type: Comment
type: AnswerComment
has text: if you grow concerns about constant factors for sorting an array in memory, you should check your infrastructure.. :) just chitchatting, actually I would have proposed the same answer, which i like, if you didn't already, so you get my +1
score: 0

http://stackoverflow.com/a/20759874
type: Answer
answers question: http://stackoverflow.com/q/20758175
has body: The code above should work if the xpaths are correct. I am doubting that it is not working because your application might be doing a ajax call. If it is doing an ajax call then try using Thread.sleep(2000L);
score: 0

http://stackoverflow.com/q/20679453
possible better answer: http://stackoverflow.com/a/20679471
accepted answer: http://stackoverflow.com/a/20679484
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20679471
has body: I've got a problem with the default "Objekt" type in java. I thaught there was the possibility to name an attribute of a Class "Objekt", so it takes any kind of Objekt as allocation. The error is "can not find Symbol", heres the Code: class List{ private class Cell{ Objekt value; Cell next; Cell (Objekt value, Cell next){ this.value = value; this.next = next; } } /* Following Methods that use other Classes, so the code becomes very hard to follow, so I'll leave them away because they dont seem to be the problem, as the error already shows up at the first usage of the Type "Objekt"*/ } thank you in advance.
type: Question
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/30966546
has answer: http://stackoverflow.com/a/20679484
has title: java can not find symbol Objekt
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/20679875
type: AnsweredQuestion

http://stackoverflow.com/a/20686491
type: Answer
score: 2
upvote count: 2
has body: The source code for the copy constructor is widely available, so you can study that as well as clone() and see if one of them suits you. But truly, if all you are trying to do is avoid comparing an element with itself then I think your second idea involving magic, unicorns, and Elvis elves, is probably the best idea of all. Comparing every element in a Set with every other element in it is inherently an O(n2) problem, and you're not going to get much better than that.
has comment: http://stackoverflow.com/comment/30999904
answers question: http://stackoverflow.com/q/20685718
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20685718

http://stackoverflow.com/comment/30992174
type: QuestionComment
score: 1
has text: Having this question marked as "off-topic" is a complete joke on the nature of the site.
comment on: http://stackoverflow.com/q/20689204
type: Comment

http://stackoverflow.com/comment/31126965
type: Comment
type: QuestionComment
has text: Please post the stacktrace of the crash. We won't be able to figure it out (easily) either if we don't see the error.
comment on: http://stackoverflow.com/q/20768086
score: 1

http://stackoverflow.com/comment/31084359
has text: Then you would have to change the request mapping accordingly. Or you just change the url pattern to ` / `.
comment on: http://stackoverflow.com/q/20742749
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31011244
score: 1
comment on: http://stackoverflow.com/q/20704498
type: Comment
type: QuestionComment
has text: You can add one Jquery code to change value to empty if more than one row for that No. column come same .

http://stackoverflow.com/comment/31275720
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20849648
has text: His map declaration is not wrong, he just does not use generics (which is not recommended but is not wrong too).
type: AnswerComment

http://stackoverflow.com/comment/31169811
score: 0
has text: Thanks for the detail answer. I believe i would lean toward the second solution. The first solution is simply not viable. The data in config data are used once to initialized the The KbService. It contain a triple store and a DL Reasoner that needs those info to get initialized.
comment on: http://stackoverflow.com/a/20779249
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23756877
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20699639
has body: I also noticed this and it appears to have been a bug in IntelliJ Idea 13.0, 13.1.x seems to have resolved this.
accepted answer of: http://stackoverflow.com/q/20699639

http://stackoverflow.com/comment/31247460
comment on: http://stackoverflow.com/q/20834353
type: Comment
type: QuestionComment
has text: Surprised such question wasn't asked before. I think this is a good question that should be locked for future reference once it is finalized.
score: 0

http://stackoverflow.com/comment/31191248
type: QuestionComment
has text: See my answer below. It's a step by step
comment on: http://stackoverflow.com/q/20803960
score: 0
type: Comment

http://stackoverflow.com/a/20823520
has comment: http://stackoverflow.com/comment/31228802
upvote count: 3
has comment: http://stackoverflow.com/comment/31227998
score: 3
accepted answer of: http://stackoverflow.com/q/20823511
answers question: http://stackoverflow.com/q/20823511
has comment: http://stackoverflow.com/comment/31228748
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31227721
downvote count: 0
has comment: http://stackoverflow.com/comment/31228637
type: Answer
has comment: http://stackoverflow.com/comment/31228629
has body: You're doing this in the UI thread, which means nothing in the UI has a chance to react to it until the loop has finished... only the last setBounds call will really have any visible effect. If you're trying to perform animation, you'll need to use a timer of some description so that you can repeatedly make a small change, wait (without blocking the UI thread) and then make another change etc. (You probably don't want to use setBounds for that anyway, but that's a slightly different matter.) Note that you still need to make the changes on the UI thread, as they're UI changes - you just need to let the UI react to the change before you make the next one. See the tutorial on Swing timers for more information and examples.
has comment: http://stackoverflow.com/comment/31227168

http://stackoverflow.com/comment/31148330
comment on: http://stackoverflow.com/a/20714938
score: 1
has text: Make sure that you are running your jar in dist folder only
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20681263
answers question: http://stackoverflow.com/q/20681108
score: 0
type: Answer
has body: IP addresses is used to access to computers in IP networks. so if you want to provide public access to your application you can't restrict access to is using only domain names. If you are going to restrict access to your application during development and allow access only for yourself you need ether configure firewall to restrict access to 8080 port of your computer, or configure your servlet container to listen only local host IP address 127.0.0.1 for i.e. see here

http://stackoverflow.com/comment/31257086
comment on: http://stackoverflow.com/a/20839052
has text: So I can use my code like logger.error("setUserSession()" + e.getMessage()); assuming there will be no memory leak or performance problem...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31015533
comment on: http://stackoverflow.com/a/20706786
type: AnswerComment
score: 0
has text: Thanks, but If possible I would like to avoid doing that for every plugin that I use and instead solve the root cause.
type: Comment

http://stackoverflow.com/comment/31208747
comment on: http://stackoverflow.com/q/20796996
type: QuestionComment
type: Comment
score: 0
has text: You should begin by studying LibGDX more. Read the documentation. Read the wiki. Read the code of the example projects. Read tutorials. Do it yourself. That's the only way to go. Nobody here has the wish to post you the code to every problem you come across. Show some effort please.

http://stackoverflow.com/comment/31076355
comment on: http://stackoverflow.com/a/20739082
type: AnswerComment
has text: my actual code were, outputFile.mkdir(); outputFile.createNewFile(); Now I have got an empty folder named null and error is still coming. On server side, No Such Element Exception, on client side there is no exception. It appears on the client side, it does not receive anything.
score: 0
type: Comment

http://stackoverflow.com/a/20821360
has comment: http://stackoverflow.com/comment/31230722
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31226601
has comment: http://stackoverflow.com/comment/31237907
has body: The simple solution is to change proxy-target-class to true in your usersConnectionRepository bean definition and add CGLIB to your class path. If you don't need the proxying, remove it completely. Explanation: First, with this bean declaration &lt;bean id="usersConnectionRepository" class="org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository" scope="singleton"&gt; &lt;constructor-arg ref="dataSource" /&gt; &lt;constructor-arg ref="connectionFactoryLocator" /&gt; &lt;constructor-arg ref="textEncryptor" /&gt; &lt;aop:scoped-proxy proxy-target-class="false" /&gt; &lt;/bean&gt; Spring is creating a bean of type JdbcUsersConnectionRepository and wrapping it in a JDK proxy (since proxy-target-class is false). The serious shortcoming of JDK proxies, is that they only sub type interfaces. In other words, Spring will see that the JdbcUsersConnectionRepository class implements the UsersConnectionRepository interface and use that when generating the Proxy. As the javadoc says A proxy class extends java.lang.reflect.Proxy. A proxy class implements exactly the interfaces specified at its creation, in the same order. So the generated proxy will be of type Proxy and UsersConnectionRepository. This won't be an issue for MethodInvokingFactoryBean because it stores the reference in a field of type Object. However, when MethodInvokingFactoryBean tries to resolve the Method to invoke, it uses the target object's Class instance, ie. object.getClass(). Since the target object is actually of type Proxy, or com.sun.proxy.$Proxy12 to be exact, it does not have a JdbcUsersConnectionRepository#setConnectionSignUp method and that causes a NoSuchMethodException.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20821126
has comment: http://stackoverflow.com/comment/31238993
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20821126
has comment: http://stackoverflow.com/comment/31237771
has comment: http://stackoverflow.com/comment/31222936
has comment: http://stackoverflow.com/comment/31233771
has comment: http://stackoverflow.com/comment/31239027
type: Answer

http://stackoverflow.com/comment/31217273
has text: @rachokk, i posted that same quaestion, but i found out that i could make have multiple panels, buttons and video player without the need of arrays, which is more efficient. But i still have the same problem, which is only one video playing from the lists of mrl provided.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20817933
type: QuestionComment

http://stackoverflow.com/q/20761226
has comment: http://stackoverflow.com/comment/31114168
favorite count: 0
has comment: http://stackoverflow.com/comment/31114652
upvote count: 2
has body: Hi guy i want to connect to my database on my website using java. i wonder what should i put in URL: cnt=DriverManager.getConnection(DB_URL, DB_UID,DB_PWD); Can you guy give me an example how to connect Mysql Database on website using java? i have try to use: import java.sql.*; public class CreateConnect { public final static String DB_DRIVER="com.mysql.jdbc.Driver"; public final static String SEVER_HOST="mysite"; public final static String PORT_NUM="3306"; public final static String DB_NAME="studentdb"; public final static String DB_UID="root"; public final static String DB_PWD="root"; public final static String DB_URL="jdbc:mysql://"+SEVER_HOST+":"+PORT_NUM+"/"+DB_NAME; private static Connection cnt; public static Connection getConnection() { try { cnt=DriverManager.getConnection(DB_URL, DB_UID,DB_PWD); System.out.println("Connection Successfully"); } catch(SQLException e) { System.out.println("Connection ERROR"); e.printStackTrace(); } return cnt; }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31114273
linked to: http://stackoverflow.com/q/18196032
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/20761375
has answer: http://stackoverflow.com/a/20761482
has comment: http://stackoverflow.com/comment/31114143
type: Question
has comment: http://stackoverflow.com/comment/31259937
answer count: 2
tagged with: database
downvote count: 0
has title: Java Connect Database on Site
has comment: http://stackoverflow.com/comment/31114445

http://stackoverflow.com/comment/31210647
type: AnswerComment
score: 0
has text: Sorry Sorry Sorry ... I was sleeping :-)
type: Comment
comment on: http://stackoverflow.com/a/20813101

http://stackoverflow.com/comment/31115827
type: QuestionComment
has text: It's corect, I modified and it worked somehow. Check my last comment from the bottom of the page please :). Thanks anyhow.
score: 0
comment on: http://stackoverflow.com/q/20753600
type: Comment

http://stackoverflow.com/comment/31075339
comment on: http://stackoverflow.com/a/20739336
type: Comment
has text: No more error for the "decodeResource" but the app is getting closed unsuccessfully. What is the problem?!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31279204
has text: Personally I am leaning towards Primefaces, Spring and Hibernate app but the client is a big oracle shop with lots of data driven (with millions of records in each table) legacy (oracle forms) apps which need to be modernized and they are inclined towards ADF framework.
type: Comment
comment on: http://stackoverflow.com/a/20849261
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31058263
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20729758
has text: This was vey helpful, thank you! I have one more question though, I did not make this very clear but how would you return any token within the equation without hardcoding it in? As if the user input the token they want.
type: AnswerComment

http://stackoverflow.com/q/20817098
tagged with: jsp
tagged with: javascript
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/31215272
has comment: http://stackoverflow.com/comment/31215145
has comment: http://stackoverflow.com/comment/31215067
type: UnansweredQuestion
has title: datatables redraw or refresh table
answer count: 0
has comment: http://stackoverflow.com/comment/31215132
type: Question
tagged with: java
has body: I have a table that is field from the server side. Name Age Gender Religion Knowledge Level <c:forEach var="studentInfo" items="${ studentInfo }"> <c:if test="${ studentInfo.graduate eq false }"> ${ studentInfo.name } ${ studentInfo.age } ${ studentInfo.gender } ${ studentInfo.religion } ${ studentInfo.knowledgeLevel } </c:if> </c:forEach> I edit the values and saved it on the database through Ajax. What I want next is to redraw or refresh the table to reflect my changes. But I'm new on using DataTables. I don't know what should I do. I'm using java at my server side. The samples I red so far is only PHP. Is there a way to do this using java as server side? and also please give a clear sample. I'm quite confused with the docs. Please bear with me. Update: I'm using bootstrap for my design. The ${ studentInfo.name } will show the modal along with the data in a row. I'm using x-editable for editing the field inside the modal. The snippet below is the sample code how I edit the field $(this).editable({ pk: studentName, // sent to the server side name: id, // sent to the server side url: '../admin/edit_studentInfo.do', success: function(response, newValue) { // No data call back yet.. reserving for redrawing the DataTables console.log('test'); } }); Another update: To clarify more this code ${ studentInfo.name } I'm using Bootstrap Modal that contains the fields that I'm editting that will reflect to the database which is the same source of data of the DataTables. Here is the snippet to show the modal. $('.profiler').on( 'click', function() { ... // some code to fill the field in the modal $modal.modal(); // show modal to the view });
has comment: http://stackoverflow.com/comment/31215029
has comment: http://stackoverflow.com/comment/31215508
linked to: http://stackoverflow.com/q/11785494
score: 0
linked to: http://stackoverflow.com/q/18846999
has comment: http://stackoverflow.com/comment/31214812

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/20692292
tags question: http://stackoverflow.com/q/20792394
type: Tag

http://stackoverflow.com/a/20821261
has comment: http://stackoverflow.com/comment/31235051
downvote count: 0
has body: Log in to your account at http://developer.paypal.com and then click into Applications, and then Sandbox accounts on the left. You'll see your sandbox accounts there, and each will have a little arrow that you can click to get extra options. Click the arrow, and then click Profile. Once the profile pops up click Settings, and then turn Negative Testing on. With negative testing enabled on the sandbox account you can force specific error codes by sending the amount that matches the code. For example, if you want to trigger error 10537 you'd send the AMT of 105.37 in your API request.
answers question: http://stackoverflow.com/q/20818171
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31239099

http://stackoverflow.com/q/20826493
tagged with: components
has body: How do I make my textfields and button centered? Edit: Updated my post with SSCE. Hopefully that helps. By the way, I want the left image to look like the right. package pkg; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.*; public class Game { private static JPanel panel = new JPanel(); public static JTextField username = new JTextField(20); public static JPasswordField password = new JPasswordField(20); JButton login = new JButton("Login"); JLabel status = new JLabel(); private static JPanel game = new JPanel(); private JButton logout = new JButton("Logout"); private static JFrame frame = new JFrame("RuneShadows"); public Game() { panel.add(username); panel.add(password); panel.add(login); panel.add(status); game.add(logout); frame.add(panel); frame.setSize(806, 553); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static void main(String[] args) { new Game(); } public void loadGame() { frame.remove(panel); frame.revalidate(); frame.add(game); frame.revalidate(); logout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.remove(game); frame.revalidate(); frame.add(panel); frame.revalidate(); try { Client.socketOut.writeUTF("logout"); Client.socketOut.writeUTF(Client.username); } catch (IOException e1) { e1.printStackTrace(); } } }); } } What I want it to look like: I've tried to use many different layout styles but I can't seem to make it work...
tagged with: java
has comment: http://stackoverflow.com/comment/31232250
has title: Centering Swing Components
linked to: http://stackoverflow.com/q/7229226
score: 0
linked to: http://stackoverflow.com/q/7180198
has comment: http://stackoverflow.com/comment/31232345
tagged with: layout
answer count: 1
has comment: http://stackoverflow.com/comment/31232238
has comment: http://stackoverflow.com/comment/31233843
has comment: http://stackoverflow.com/comment/31232224
has answer: http://stackoverflow.com/a/20826912
type: UnansweredQuestion
tagged with: swing
type: Question

http://stackoverflow.com/comment/31072220
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20737349
has text: Thx a ton. That almost solved my problem. How about if I want to leave gaps between the buttons ?

http://stackoverflow.com/comment/31092465
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20737449
has text: Does it mean you want to get the value of themePreview from the session to decide which CSS file is to use?

http://stackoverflow.com/q/20794073
has answer: http://stackoverflow.com/a/20794361
has answer: http://stackoverflow.com/a/20794218
accepted answer: http://stackoverflow.com/a/20794218
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20794136
has title: Can't use my "type" ComplexNumber without "new"--why?
type: AnsweredQuestion
downvote count: 0
has body: The Mandelbrot set has been a favorite of mine for many years. I've successfully created it in Pascal years ago and more recently on a TI-83 graphing calculator (Java renders it juuuuust a bit faster). Since complex numbers are involved, I took a version from a text that extends RecursiveAction using a BufferedImage and ForkJoinPool (without understanding the those concepts and the overall implementation) and, using routines I developed a few months ago, modified (the heck out of) the code that does the point-plotting so that it looks more like complex numbers are involved. Original: public class MandelbrotTask extends RecursiveAction { ... public void render() { ... for (int x = xStart; x &lt;= xEnd; x++) { for (int y = yStart; y &lt;= yEnd; y++) { double r = x * zoomFactor / image.getWidth() - zoomFactor / 2 + offsetX; double i = y * zoomFactor / image.getHeight() - zoomFactor / 2 + offsetY; double zr = 0, zi = 0; int iter; for (iter = 0; iter &lt; maxIter; iter++) { double nzr = zr * zr - zi * zi + r; double nzi = 2 * zr * zi + i; if (nzr * nzr + nzi * nzi &gt; escapeRadius * escapeRadius) break; zr = nzr; zi = nzi; } image.setRGB(x, y, Color.HSBtoRGB(0.5f * iter / maxIter, 1.0f, 1.0f)); } } My revised, somewhat-cleaner code: for (int x = xStart; x &lt;= xEnd; x++) { for (int y = yStart; y &lt;= yEnd; y++) { z1 = new ComplexNumber(x * dx - zoomFactor / 2 + offsetX, y * dy - zoomFactor / 2 + offsetY); z0 = new ComplexNumber(0,0); int iter; for (iter = 0; iter &lt; maxIter; iter++) { nz = cAdd(cMult(z0,z0),z1); if (cAbs(nz) &gt; escapeRadius ) break; z0 = nz; } image.setRGB(x, y, Color.HSBtoRGB(0.5f * iter / maxIter, 1.0f, 1.0f)); } } My only question is how to get rid of "new" on the two lines defining z1 and z0. It seems like I'm wasting a ton of memory since the two objects get "newed" a total of 1,000,000+ times during the almost 25,000 executions of the above block of code, though there's no problem as is. I know I need new at least once inside the method, but…
score: 1
tagged with: java
tagged with: new-operator
has comment: http://stackoverflow.com/comment/31172865
type: Question
possible better answer: http://stackoverflow.com/a/20794136

http://stackoverflow.com/q/20767739
has title: Will Threads Make My Game Run Consistently On Every Computer
score: 0
has body: Right now I'm using Java Swing timers to repaint my game etc. On my gaming computer it runs at the speed I desire, but on the school computer is runs very slowly. Sometimes it runs very slowly on my computer as well. So would using threads make it consistent? Could I keep the swing and do longs with current and past event times? I tried that, but I was having a lot of trouble with it. I've already done timertasks with the weapon delay, would that be consistent? My swing stuff is very similiar to this: http://zetcode.com/tutorials/javagamestutorial/animation/ If you scroll down there is the threads part. Thanks.
answer count: 1
has comment: http://stackoverflow.com/comment/31126351
has comment: http://stackoverflow.com/comment/31127495
tagged with: timer
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31127460
tagged with: multithreading
tagged with: timertask
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/20767780
accepted answer: http://stackoverflow.com/a/20767780
tagged with: java

http://stackoverflow.com/comment/31154092
has text: @ishu i added the declarations
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20783789
score: 0

http://stackoverflow.com/q/20816405
has body: I could of course do a select after the first i selected but that seems to give a lot of overhead. Would populating a hashmap with the different tables be best or what is the best course of action to solve this. In my case I have a list of clubs with a number of members (players). After selecting club I would like to only have the members associated with that club to be visible. you can see the solution here. http://score.megahooked.com/BowlingFacelets/faces/hcp/club.xhtml
answer count: 1
accepted answer: http://stackoverflow.com/a/20817029
has comment: http://stackoverflow.com/comment/31213331
has comment: http://stackoverflow.com/comment/31213570
type: AnsweredQuestion
tagged with: jpa
has title: What is the best way to fill a dropdown with values depending on first dropdown in JSF?
type: Question
has answer: http://stackoverflow.com/a/20817029
tagged with: jsf
tagged with: java
score: 0

http://stackoverflow.com/a/20746374
has body: Without executing the Query, your cannot get a feedback(or resultset, about it. Connection.preparedStatement just return you a PreparedStatement object, which is just a handler. PreparedStatement.executeQuery() is only what executes the query actually, pushing to the database.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20745010
type: Answer

http://stackoverflow.com/q/20793895
has comment: http://stackoverflow.com/comment/31172537
linked to: http://stackoverflow.com/q/260666
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: What is the role of the constructor in java
has answer: http://stackoverflow.com/a/20793951
has answer: http://stackoverflow.com/a/20794373
has comment: http://stackoverflow.com/comment/31172533
score: 0
answer count: 3
has body: we know that new Instance() subclass in java , the first recursive call will be the parent class constructor,If the parent class is an abstract class,will be Calling its constructor? if this true ,Means that the parent class will be instantiated？ But the abstract class can not be instantiated,Who can explain this question. Thank You.
duplicate of: http://stackoverflow.com/q/260666
has comment: http://stackoverflow.com/comment/31172486
favorite count: 0
has answer: http://stackoverflow.com/a/20793957
tagged with: constructor
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31172498

http://stackoverflow.com/comment/31290490
has text: yea you are right. the distinction is for me still far from clear. But your answer to my question was very helpful. Thanks!!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20832158
type: AnswerComment

http://stackoverflow.com/comment/31084964
type: Comment
has text: Just the progressBar, All the textView are set and are correct
comment on: http://stackoverflow.com/a/20744148
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31065804
comment on: http://stackoverflow.com/a/20722792
score: 0
type: Comment
has text: In that case, the code below may be more appropriate. Looks like it'll have to be a lot of if statements unfortunately.
type: AnswerComment

http://stackoverflow.com/a/20783311
has comment: http://stackoverflow.com/comment/31153096
has comment: http://stackoverflow.com/comment/31153303
answers question: http://stackoverflow.com/q/20782283
has comment: http://stackoverflow.com/comment/31153854
score: 4
has body: What @XmlElements is For @XmlElements corresponds to the choice structure in XML Schema. A property corresponds to more than one element (see: http://blog.bdoughan.com/2010/10/jaxb-and-xsd-choice-xmlelements.html) Collection Order A JAXB implementation will honor the order the items have been added to the List. This matches the behaviour you are seeing. Getting the Desired Order You can add the items to the List in the order you want to see them appear in the XML document. You can have separate properties corresponding to each element and then use propOrder on @XmlType to order the output (see: http://blog.bdoughan.com/2012/02/jaxbs-xmltype-and-proporder.html) Sort the List property on a JAXB beforeMarshal event.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31153960
type: Answer
accepted answer of: http://stackoverflow.com/q/20782283

gradle
tags question: http://stackoverflow.com/q/20812703
tags question: http://stackoverflow.com/q/20696626
tags question: http://stackoverflow.com/q/20748541
tags question: http://stackoverflow.com/q/20731975
tags question: http://stackoverflow.com/q/20710704
type: Tag
tags question: http://stackoverflow.com/q/20707017
tags question: http://stackoverflow.com/q/20685286
tag name: gradle
tags question: http://stackoverflow.com/q/20728492
tags question: http://stackoverflow.com/q/20707543
tags question: http://stackoverflow.com/q/20730836
tags question: http://stackoverflow.com/q/20746071
tags question: http://stackoverflow.com/q/20726599
tags question: http://stackoverflow.com/q/20694715
tags question: http://stackoverflow.com/q/20700053
tags question: http://stackoverflow.com/q/20734823
tags question: http://stackoverflow.com/q/20739780
tags question: http://stackoverflow.com/q/20790721
tags question: http://stackoverflow.com/q/20728621
tags question: http://stackoverflow.com/q/20789797

http://stackoverflow.com/a/20798476
type: Answer
answers question: http://stackoverflow.com/q/20798334
downvote count: 0
score: 1
has body: Use Collections API public static &lt;T&gt; Set&lt;T&gt; synchronizedSet(Set&lt;T&gt; s) Returns a synchronized (thread-safe) set backed by the specified set public static &lt;T&gt; List&lt;T&gt; synchronizedList(List&lt;T&gt; list) Returns a synchronized (thread-safe) list backed by the specified list You can pass your List or Set implementation to the above methods and get a thread-safe one
upvote count: 1

http://stackoverflow.com/q/20724324
has comment: http://stackoverflow.com/comment/31047975
favorite count: 0
has answer: http://stackoverflow.com/a/31146184
has body: Is there any regular expression api or library for java that can accept multiple groups with the same name in one pattern?
tagged with: named-captures
has comment: http://stackoverflow.com/comment/31048163
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31049791
score: 7
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31048439
has comment: http://stackoverflow.com/comment/31049653
has title: multiple groups with the same name regex java?
upvote count: 7
has answer: http://stackoverflow.com/a/46990678
tagged with: regex

http://stackoverflow.com/a/20769046
has body: This is the code from my answer to another question (Post order traversal of binary tree without recursion). It works with one stack and doesn't use visited flag. private void postorder(Node head) { if (head == null) { return; } LinkedList&lt;Node&gt; stack = new LinkedList&lt;Node&gt;(); stack.push(head); while (!stack.isEmpty()) { Node next = stack.peek(); if (next.right == head || next.left == head || (next.left == null &amp;&amp; next.right == null)) { stack.pop(); System.out.println(next.value); head = next; } else { if (next.right != null) { stack.push(next.right); } if (next.left != null) { stack.push(next.left); } } } }
score: 2
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20761133
accepted answer of: http://stackoverflow.com/q/20761133
type: Answer
downvote count: 0

http://stackoverflow.com/q/20812119
score: 0
tagged with: java
tagged with: criteria
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31205589
linked to: http://stackoverflow.com/q/18958614
type: Question
tagged with: sql
has comment: http://stackoverflow.com/comment/31206101
tagged with: jpa-2.0
has comment: http://stackoverflow.com/comment/97333824
has body: I have to join two result sets coming from different database tables, something like: SELECT a,b FROM abtable UNION ALL SELECT c,d FROM cdtable; My current working solution is to have 2 queries and to join the resultlists (java.util.List) in java. But for the sake of performance and uniform coding patterns I would like to do this in JPA2 using the criteria API. The UNION keyword doesn't seem to be supported in JPA2 Criteria API? Is there any alternative of doing this using JPA2 Criteria API?
has title: SQL UNION in JPA2 Criteria API

http://stackoverflow.com/q/20716651
accepted answer: http://stackoverflow.com/a/20722226
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/38543107
type: Question
has answer: http://stackoverflow.com/a/20722226
linked to: http://stackoverflow.com/q/14464226
has title: How to pass multiple generic parameters when extending a generic class
answer count: 2
possible better answer: http://stackoverflow.com/a/38543107
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/31033955
has body: The following will not compile but I wish to create something of similar functionality which will compile: public class FreezerTest { interface Edible{} interface SmallerThanABeachball{} interface Freezeable{} abstract class BoxedItem {} class Marbles extends BoxedItem {} class IceCream extends BoxedItem implements Freezeable, SmallerThanABeachball, Edible {} class MyBrother {} class Banana implements Edible, SmallerThanABeachball {} class Cat implements SmallerThanABeachball {} abstract class StorageChest&lt;T&gt;{ public void add(T toStore){} } class MiniFoodFreezer extends StoreageChest&lt;Freezeable &amp; Edible &amp; SmallerThanABeachball&gt;{ } public FreezerTest(){ MiniFoodFreezer freezer = new MiniFoodFreezer(); freezer.add(new Cat());//DESIRE COMPILE ERROR freezer.add(new IceCream());//DESIRE OK freezer.add(new MyBrother());///DESIRE COMPILE ERROR freezer.add(new Banana());//DESIRE COMPILER ERROR freezer.add(new Marbles());//DESIRE COMPILER ERROR } }//end One thought was to create an all-encompassing interface and then pass that: interface WillFitInMiniFoodFreezer extends Edible, SmallerThanABeachball, Freezeable{} class MiniFoodFreezer extends StorageChest&lt;WillFitInMiniFoodFreezer&gt;{ } ...however what if Edible, SmallerThanABeachball, and Freezeable are all from a 3rd party library and other third-party libraries refer to these types, some of which have the interface implementations necessary meet the criteria for WillFitInMiniFoodFreezer but do not explicitly implement WillFitInMiniFoodFreezer?
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/31171690
comment on: http://stackoverflow.com/q/20793415
score: 0
type: Comment
type: QuestionComment
has text: sloppy naming convention

http://stackoverflow.com/a/20811300
has comment: http://stackoverflow.com/comment/31204278
has body: try this: 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.JOptionPane; public class ShowDialogBox { private JFrame frame; public static void main(String[] args) { ShowDialogBox box = new ShowDialogBox(); } public ShowDialogBox() { frame = new JFrame("Show Message Dialog"); JButton button = new JButton("Click Me"); button.addActionListener(new MyAction()); frame.setLayout(new FlowLayout()); frame.add(button); frame.setSize(400, 400); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } class MyAction implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { JOptionPane.showConfirmDialog(frame, "Eggs are not supposed to be green.", "Inane warning", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); } } }
has comment: http://stackoverflow.com/comment/31204165
upvote count: 1
answers question: http://stackoverflow.com/q/20811234
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/31083415
has text: Your code is fine .I checked on devices its showing a graph which is dynamically changing.I think problem is with your layout or anything else.post your whole xml layout .
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20743109
score: 1

http://stackoverflow.com/q/20808331
type: Question
type: AnsweredQuestion
favorite count: 0
score: 5
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/31198444
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/20808503
accepted answer: http://stackoverflow.com/a/20808503
downvote count: 0
has title: Creating a JFrame you can click through
has comment: http://stackoverflow.com/comment/31198384
tagged with: transparency
has comment: http://stackoverflow.com/comment/31198386
has comment: http://stackoverflow.com/comment/31198437
has body: I'm trying to create a jframe that the user can click through. I'm not looking for opacity but transparency. I need a solution that works on all OS and not just Windows because I can't use WindowUtils.setWindowTransparent(frame, true); WindowUtils.setWindowAlpha(frame, 0.6f); or AWTUtilities.setWindowOpaque(this, false); AWTUtilities.setWindowOpacity(this, 0.8f); Can I accomplish this with java alone? It's ok if there is a library that I must use. EDIT: I have my jframe undecorated and here is the code for it. frame = new JDialog(); frame.setUndecorated(true); frame.setVisible(true); frame.setOpacity(Shared.opacity); frame.setLocation(0, 0); frame.setSize(Shared.screenWidth, Shared.screenHeight); When I say the user can click through what I mean is that if my frame is on top but they have a window under mine, clicking on mine would bring the one under on top.

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/20733741
type: Tag
tags question: http://stackoverflow.com/q/20828845

http://stackoverflow.com/q/20815198
has title: Android: have Singleton class that will never been killed
has answer: http://stackoverflow.com/a/20815226
score: 0
accepted answer: http://stackoverflow.com/a/20815256
answer count: 3
has answer: http://stackoverflow.com/a/20815512
has comment: http://stackoverflow.com/comment/31211461
tagged with: singleton
tagged with: android
has body: In my Android application I have a Singleton class. It works like a charm when the application task is alive. But after the application task is being killed, the Singleton class gets destroyed, which is obviously. I need to keep this class always alive. Is it possible? And what is the best approach to have this class never been killed by Android system, do I need to use a background Service in this situation?
tagged with: service
possible better answer: http://stackoverflow.com/a/20815512
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: task
has comment: http://stackoverflow.com/comment/31211163
has answer: http://stackoverflow.com/a/20815256

http://stackoverflow.com/comment/31211879
has text: That's going to exhibit pretty bad time complexity as the number of rectangles increases...
type: Comment
score: 3
comment on: http://stackoverflow.com/a/20815659
type: AnswerComment

http://stackoverflow.com/a/20781270
accepted answer of: http://stackoverflow.com/q/20780401
type: Answer
answers question: http://stackoverflow.com/q/20780401
has body: ssh simply forwards (and encrypts/decrypts) bytes between the server and the client. In most cases the server is running a unix shell and "the bytes" are simply stdin/stdout/stderr from that shell. If you run vim in that shell, then the bytes are produced by vim. To do the special stuff like colors (syntax highlighting), positioning of the cursor and so on, vim will send escape sequences, which are series of bytes starting with an "ESCAPE" byte (hex 27). Escape sequences stem from the days of "green terminals" and are interpreted as "instructions" by the physical terminal, or the terminal emulator e.g. putty. Vim and other complex terminal programs will look for the $TERM environment variable to determine what terminal you are using client-side. Depending on that value, the escape sequences (think terminal-dependent instructions) will be different. You can find many lists of terminal escape sequences on the internet, e.g. for ansi: https://en.wikipedia.org/wiki/ANSI_escape_code
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/20820095
type: AcceptedAnswer
has body: You need to provide a cfg.xml for each database. Oracle.cfg.xml mssql.cfg.xml There you provide the appropriate database connecton configuration, the dialect to use and which hbm-mapping files for the entity classes are needed Within your code you create a single SessionFactory for each database. SessionFactory oracleSF = Configuration.configure("oracle.cfg.xml").buildSessionFfactory(); SessionFactory msSF = Conf..configure("mssql.cfg.xml").build.... To reuse your util class you just have to pass the name of the config file to the method which creates the SessionFactory as an additional parameter. The entity classes of the different tables are declared within the appropriate config file and therefore assigned to the right database, so hibernate knows which database to use. Also take a look at this discussion which is about multiple schemas with a single cfg: how to use Hibernate for two different schemas in a single database Have a look here: It is a pretty nice site with an vast amount of tutorials for hibernate: http://www.javabeat.net/hibernate/page/4/
answers question: http://stackoverflow.com/q/20819869
upvote count: 5
type: Answer
downvote count: 0
score: 5
accepted answer of: http://stackoverflow.com/q/20819869

http://stackoverflow.com/a/20729862
has body: I can think of several ways to do this using just the JCR API in any JCR implementation: Create and register an event listener on the master repository that monitors events that happen on the specific subtrees of interest, and then record these events in some persisted form (e.g., in a queue, file system, a third repository, etc... whatever works best in your environment). Then periodically process those recorded events and "replay" them by manipulating the nodes in the slave repository. Create and register an event listener on the master repository that monitors events that happen on the specific subtrees of interest, and then immediately connect to the slave repository and "replay" these events. Periodically connect to the master repository and use the journaling feature (if supported) to obtain what has changed in the master repository since the last time this was done, and then connect to the slave repository and "replay" those events that apply to the specific subtrees of interest. Another option might be to make the master and slave repositories completely in-sync by clustering them. Jackrabbit and ModeShape can both do this, but they both do it completely differently as it is not defined in the JCR specification. For example, with ModeShape (disclosure: I'm the project lead) you can create small clusters of just 2 processes or larger clusters with many processes. You can choose up front whether each process in the cluster has a complete copy of all of the content (i.e., "replicated" and "invalidation" modes) or just some of the content (i.e., "distributed" mode). See the documentation for details. These clusters can also span multiple sites, helping to increase fault tolerance. ModeShape is elastic, so you can simply add more processes to the cluster at any time, and you can even remove them. The best part is that client applications still just use the JCR API yet see the whole repository content just as they would a non-clustered repository.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20727056
upvote count: 2
score: 2

http://stackoverflow.com/a/20778088
has comment: http://stackoverflow.com/comment/31151271
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/96708174
score: 2
answers question: http://stackoverflow.com/q/20775652
has body: OK, I had to try the monitor on and off bit, and it worked! Too cool! import com.sun.jna.Native; import com.sun.jna.platform.win32.WinDef.HWND; import com.sun.jna.platform.win32.WinDef.LPARAM; import com.sun.jna.platform.win32.WinDef.LRESULT; import com.sun.jna.platform.win32.WinDef.WPARAM; import com.sun.jna.platform.win32.WinUser; import com.sun.jna.win32.StdCallLibrary; public class TurnOffMonitor { public interface User32 extends StdCallLibrary { User32 INSTANCE = (User32) Native.loadLibrary("user32", User32.class); int SC_MONITORPOWER = 0xF170; int SC_MONITOR_OFF = 2; int SC_MONITOR_ON = -1; LRESULT SendMessageA(HWND paramHWND, int paramInt, WPARAM paramWPARAM, LPARAM paramLPARAM); LRESULT SendMessageA(HWND paramHWND, int paramInt, int paramInt2, LPARAM paramLPARAM); } private static final long SLEEP_TIME = 4 * 1000; // 4 seconds public static void main(String[] args) { final User32 user32 = User32.INSTANCE; System.out.println("Foo"); user32.SendMessageA(WinUser.HWND_BROADCAST, WinUser.WM_SYSCOMMAND, User32.SC_MONITORPOWER, new LPARAM(User32.SC_MONITOR_OFF)); try { Thread.sleep(SLEEP_TIME); } catch (InterruptedException e) {} user32.SendMessageA(WinUser.HWND_BROADCAST, WinUser.WM_SYSCOMMAND, User32.SC_MONITORPOWER, new LPARAM(User32.SC_MONITOR_ON)); } }
accepted answer of: http://stackoverflow.com/q/20775652

http://stackoverflow.com/comment/31203728
type: Comment
score: 0
has text: I changed int i = list.size() to int i = list.size() - 1. It fixed the error, but now it appears that my sorting isn't working at all. I'm displaying the apparently modified arraylist, but it's coming back as the exact same numbers. Any suggestions?
type: AnswerComment
comment on: http://stackoverflow.com/a/20811066

http://stackoverflow.com/comment/31235699
score: 1
has text: `java -jar "C:\Dropbox\Java\Updater Test\Updater.jar"`
comment on: http://stackoverflow.com/q/20828354
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20844472
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/20844596
has comment: http://stackoverflow.com/comment/31265347
has comment: http://stackoverflow.com/comment/31265565
has body: I am creating a web application. Same application will run from different machine, but they will use common database. When application starts it will get all data from database. But when I update data from one application, how other running application will know that data has been updated, I want when I update database form any application, other running application will get notification immediately, and they should update their data. One possible solution is I can take all applications URL in a list, then after updating value I will send request to all application, but how to do this using send Redirect. Is it correct way ? or is their any other easiest way to do this. Please help me.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20844596
type: Question
has comment: http://stackoverflow.com/comment/31265921
tagged with: java
has title: How do I update data to all application java of shared database
has comment: http://stackoverflow.com/comment/31266387
score: 0
has comment: http://stackoverflow.com/comment/31265787
tagged with: requestdispatcher

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/20731833
type: Tag
tags question: http://stackoverflow.com/q/20761133
tags question: http://stackoverflow.com/q/20744203

http://stackoverflow.com/q/20768781
type: Question
has comment: http://stackoverflow.com/comment/31128350
has body: I'm getting an "IllegalArgumentException: Version must be &gt;= 1, was 0" error on the line: super(context, name, factory, version, errorHandler); in the following class and I'm not sure exactly why this is happening (I'm simply trying to add a username and password to my sqlite database - nothing more) 12-25 11:28:05.898: E/AndroidRuntime(31438): FATAL EXCEPTION: main 12-25 11:28:05.898: E/AndroidRuntime(31438): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.idg.voiscphone/com.idg.voiscphone.Activity1}: java.lang.IllegalArgumentException: Version must be &gt;= 1, was 0 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306) 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.app.ActivityThread.access$600(ActivityThread.java:156) 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.os.Handler.dispatchMessage(Handler.java:99) 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.os.Looper.loop(Looper.java:153) 12-25 11:28:05.898: E/AndroidRuntime(31438): at android.app.ActivityThread.main(ActivityThread.java:5297) 12-25 11:28:05.898: E/AndroidRuntime(31438): at java.lang.reflect.Method.invokeNative(Native Method) 12-25 11:28:05.898: E/AndroidRuntime(31438): at java.lang.reflect.Method.invoke(Method.java:511) 12-25 11:28:05.898: E/AndroidRuntime(31438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 12-25 11:28:05.898: E/AndroidRuntime(31438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 12-25 11:28:05.898: E/AndroidRuntime(31438): at dalvik.system.NativeStart.main(Native Method) 12-25 11:28:05.898: E/AndroidRuntime(31438): Caused by: java.lang.IllegalArgumentException: Version mus…
has answer: http://stackoverflow.com/a/20768821
has comment: http://stackoverflow.com/comment/31128372
score: 0
has title: IllegalArgumentException: Version must be >= 1, was 0
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/31128446
type: UnansweredQuestion
tagged with: android
tagged with: android-sqlite
tagged with: fatal-error
tagged with: java

http://stackoverflow.com/a/46576298
downvote count: 0
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/105871678
has body: This isn't an explanation why it pops up twice but it is a way to debug it in chrome. Browse to chrome:net-internals#events and you can see the 401 auth negotiation. The 401 requests and responses do not appear in the network tab of the chrome dev tools, so this is the only clue you can get. Edit update - it seems that Chrome does not always send the Authorization headers for digest. Either because of pipelining, an auth cache bug, or heuristics for which urls "inherit" the authorization. From https://groups.google.com/d/msg/chromium-discuss/9ASzOBdBrTQ/wUWFlwFYwaMJ Since chromium will not pre-emptively send the authorization for inferred protection space, it will keep entering that loop. [...] Support for Digest is likely, but a little sketchier, since the digest auth model is broken under pipelining (next nonce is controlled by previous server responses (Authorization-Info). Because htdigest was causing two login dialogs every page load I switched to basic auth as my site was already using HTTPS for security. Basic and Digest do not define a scheme for which urls the Authorization token needs to be sent and for how long to cache the password or token. So it's slower and less secure than cookies. I'll try to avoid this scheme in the future.
type: Answer
answers question: http://stackoverflow.com/q/20843918

http://stackoverflow.com/a/20699449
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20699306
has body: Its simple because Java treats number by default as int and letters as string object , not as generic objects . so when you pass add(2,3) , its taking the arguments as the normal int to call the add(long , long) pass the arguments as ; add(2.0,4.0) something like this . and for calling the function method(object) 1.first typecast your string to type object String str; str= (object) "Hello world"; 2.and then pass to method(str);

http://stackoverflow.com/comment/31155918
score: 0
comment on: http://stackoverflow.com/q/20784954
type: QuestionComment
has text: How do users input the date? console? desktop UI? Web UI? Mobile? ...
type: Comment

http://stackoverflow.com/q/20840528
has answer: http://stackoverflow.com/a/20840595
has comment: http://stackoverflow.com/comment/31258158
tagged with: java
tagged with: mysql
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20840590
has body: Here is my code: DELIMITER $$ begin declare var a int; set a="select biology from app.students where studname="ganesh"; select concat('the student name is' a); end$$ I want to create storeprodure in mysql for java. In the above code i gave anything after begin it shows error. I am not well in stored procedure.
has comment: http://stackoverflow.com/comment/31258119
has title: how to create stored procedure in mysql for java?
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/20824386
score: 1
tagged with: java
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31228454
favorite count: 0
tagged with: sftp
has body: I am downloading this file from an SFTP server "ara22122013.txt", using the below code: I want to download all the files in the server that has the string 22122013, Here' example: Sring SFTPHOST = "10.10.10.10"; int SFTPPORT = 22; String SFTPUSER = "username"; String SFTPPASS = "password"; Session session = null; Channel channel = null; ChannelSftp channelSftp = null; JSch jsch = new JSch(); public void test() { try { session = jsch.getSession(SFTPUSER,SFTPHOST,SFTPPORT); System.out.println("Checking username, host, and port..."); session.setPassword(SFTPPASS); System.out.println("Checking password..."); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); System.out.println("Session Connected"); channel = session.openChannel("sftp"); channel.connect(); System.out.println("Channel Connected"); channelSftp = (ChannelSftp)channel; try { channelSftp.get("ara22122013.txt", "C:/SFTP/" ); } catch (SftpException ex) { Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex); } } catch (JSchException ex) { Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex); } } Please advise how?
has answer: http://stackoverflow.com/a/20824462
has answer: http://stackoverflow.com/a/49377560
has title: downloading multiple files from sftp
type: UnansweredQuestion
upvote count: 1
type: Question

http://stackoverflow.com/comment/31128881
type: AnswerComment
comment on: http://stackoverflow.com/a/20768976
score: 0
type: Comment
has text: But didn't refactored all items.. Perhaps I have to meet it again. If I get the error again,I can describe something more better than this. thank you..

http://stackoverflow.com/comment/31233986
has text: As a side note: it would be better to use `%n` instead of `\n` in the format string so that you get a newline sequence appropriate to the platform.
score: 0
comment on: http://stackoverflow.com/q/20827333
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20781051
has comment: http://stackoverflow.com/comment/31150747
upvote count: 2
has comment: http://stackoverflow.com/comment/31150566
downvote count: 1
answers question: http://stackoverflow.com/q/20779554
score: 1
has comment: http://stackoverflow.com/comment/31151677
has body: Make sure that u have put your Jsp files into the WebRoot and check the location and even check your Web.xml and after that run and still if its not working then post your Web.xml here.
has comment: http://stackoverflow.com/comment/31149844
type: Answer

http://stackoverflow.com/comment/32256170
has text: @Vessilate If my answer solved your problem then please accept it and mark the question solved.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20818250

http://stackoverflow.com/q/20818985
has answer: http://stackoverflow.com/a/20818996
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
has title: Arrays & Null Pointer Exception Issue
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/20818996
score: -1
downvote count: 1
has body: Hi I'm a new computer engineering student and studying java, my problem may be very easy to solve but I tried hard to find the solution and could not, my final exam is coming so I'm in hurry and need help. I got this error message; Exception in thread "main" java.lang.NullPointerException at Lab8.ModelingAgency.addModel(ModelingAgency.java:45) at Lab8.ModelingApp.main(ModelingApp.java:45) What I'm trying to do is, create a modeling agency class that has models array which has no models. Create 2nd array with models. Add the 2nd array's models to modeling agency object via addModel method. Give an error if the modeling agency has models more than 4. I got this NullPointerException error when assign the model to an arrays element in the part: this.modelList[modelCount] = new Model(modelp); this.modelCount++; Anything related with modelList gives a null pointer exception I wrote The "default" gay models to get rid of np exceptions but inializing the arrays with these did not fix the problem either. I could not try the code because of the null pointer exception so maybe there would be more errors I'll try to fix them as soons as I get rid of null pointer exception. public class ModelingAgency { // properties private String name; private int modelCount; private Model[] modelList; // contructors public ModelingAgency ( String name) { this.name = name; Model[] modelList = new Model[4]; modelCount = 0; // for ( Model model: modelList){ for ( int i = 0; i &lt; modelList.length; i++) modelList[i] = new Model ("Default", "Gay", 69); } // methods public int addModel ( Model modelp ) { if (modelp == null) return -4; if ( this.modelCount &gt; 4){ //System.out.println("Can't add too much models."); return -1; } for ( int i = 0; i &lt; modelCount; i++){ if (modelp.equals(this.modelList[i])) { return -2; } } if (!(modelp.checkAge())){ return -3; } this.modelList[modelCount] = modelp; // LINE OF NULL POINTER EXCEPTION this.modelCount++; return 0; } public String toString (){ String r…
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31259100
type: AnswerComment
comment on: http://stackoverflow.com/a/20840820
type: Comment
score: 1
has text: @PakkuDon `Would Java even create a default constructor in this case?` No, he writes a constructor with one argument, then he must specify default constructor with no args if he want to use.

http://stackoverflow.com/a/20770653
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20770410
has body: Here is the complete answer: Step 1) Remember to initialize the arraylists. ArrayList&lt;HashMap&lt;String, String&gt;&gt; myevenvalue = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; myoddvalue = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); Step 2) Loop through the myfullvalue list and add items based on even or odd. for(HashMap&lt;String, String&gt; map : myfullvalue) { int id = Integer.parseInt(map.get("id")); if(id % 2 == 0) { myevenvalue.add(map); } else { myoddvalue.add(map); } }
upvote count: 1

http://stackoverflow.com/a/20809114
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20809020
score: 2
answers question: http://stackoverflow.com/q/20809020
downvote count: 0
has body: Take a look at this example: http://stilius.net/java/java_ssl.php Don't try to invent your own cryptographic algorithm, I know that it sounds interesting but it's also not very safe. Try to use already implemented algorithms and protocols. I suggest you to take a look at the link. Though if you do this just for the fun of it then go ahead, if it's for a client or for something that others (than you at least) use then stick to the known protocols.
upvote count: 2

http://stackoverflow.com/comment/31254667
score: 0
has text: I've started working with the code, but i've run into a minor"problem" from step1 . I've edited my question to include the new data. I try to create the adjucency list but things didnt go exactly as i thought they would
type: Comment
comment on: http://stackoverflow.com/a/20775039
type: AnswerComment

http://stackoverflow.com/comment/31029925
has text: Wow that's confusing, but I think I get it. Thanks!
comment on: http://stackoverflow.com/a/20714358
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20748910
accepted answer of: http://stackoverflow.com/q/20748726
answers question: http://stackoverflow.com/q/20748726
upvote count: 1
type: AcceptedAnswer
has body: From what I can see you do readLine() on the client, while doing outqw.write() on the server. There is no end of line character in the string sent from server, so the client will never be able to finish the readLine. Do the outqw.println() or add "\n" to the end of whatever you're sending. That being said, it's very hard to navigate unformatted code with bunch of commented out stuff so the problem might be something else.
has comment: http://stackoverflow.com/comment/31093739
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/20730672
has body: The current while loop is there to get valid input -- don't change it. You need to wrap this code in another while loop that loops til a sentinal value is entered. while (!isSentinalValue) { while (inputNotValid) { // get valid input } } Edit More specifically in pseudocode: while (!isSentinalValue) { input = invalidValue while (inputNotValid) { getInput } use input to do menu things } So I would not have the switch block inside of the inner loop, since that loop concerns itself only with making sure that the input entered is valid. Do the switch block outside of the inner loop, and be sure to set the sentintal value that allows the user to escape the outerloop when appropriate.
downvote count: 0
answers question: http://stackoverflow.com/q/20730660
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31060201

http://stackoverflow.com/a/30159878
score: 8
has body: jdk8 download web url: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html download it and install. check java version: sodino:~ sodino$ java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) 3.find 'java' original path and ‘java_home': sodino:~ sodino$ which java /usr/bin/java sodino:~ sodino$ ls -n /usr/bin/java lrwxr-xr-x 1 0 0 74 Sep 30 2014 /usr/bin/java -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java sodino:~ sodino$/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home get ‘include’ folder and jni.h now you will find a ‘include’ folder with in ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home’, and open it ‘jni.h’ will be found.
answers question: http://stackoverflow.com/q/20771803
downvote count: 0
upvote count: 8
type: Answer

http://stackoverflow.com/q/20767164
has answer: http://stackoverflow.com/a/20769737
answer count: 1
tagged with: jpa
tagged with: javabeans
linked to: http://stackoverflow.com/q/9947293
type: UnansweredQuestion
has title: EJB, Java JPA, mysql. exception
has comment: http://stackoverflow.com/comment/31125359
linked to: http://stackoverflow.com/q/22605559
has comment: http://stackoverflow.com/comment/31125518
tagged with: java
tagged with: mysql
type: Question
tagged with: ejb
has comment: http://stackoverflow.com/comment/64493096
score: 0
has body: I am using EJB container with managed bean to retrieve data from mysql database. I got this exception when trying to call findAll method. the method exists but it says there is exception!! here are the classes, 1- customer , package com.milano.man; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the customer database table. * */ @Entity @NamedQuery(name="Customer.findAll", query="SELECT c FROM Customer c") public class Customer implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="customer_id") private int customerId; private String address; private int age; private String email; private String name; public Customer() { } public int getCustomerId() { return this.customerId; } public void setCustomerId(int customerId) { this.customerId = customerId; } public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } public int getAge() { return this.age; } public void setAge(int age) { this.age = age; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } } 2- CustomerEJB package com.milano.beans; import java.util.ArrayList; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import com.milano.man.Customer; /** * Session Bean implementation class CustomerEJB */ @Stateless @LocalBean public class CustomerEJB { @PersistenceContext(unitName = "ProjNew") EntityManager em; public List&lt;Customer&gt; customerList = new ArrayList&lt;Customer&gt;(); public List&lt;Customer&gt; findAll() { TypedQuery&lt;Customer&gt; query = em.createQuery("SELECT c FROM Customer c", Customer.class); customerList = …

http://stackoverflow.com/comment/31271173
score: 0
type: Comment
has text: It is not necessary to `saying anything about using a class to call`. The method declaration forces the user to create an instance.
comment on: http://stackoverflow.com/a/20847315
type: AnswerComment

http://stackoverflow.com/a/66252664
downvote count: 0
type: Answer
upvote count: 1
has body: in my case i was using drawable from drawable-v24 when i moved it to drawable it worked for me.
score: 1
answers question: http://stackoverflow.com/q/20680451

http://stackoverflow.com/comment/31237797
type: Comment
comment on: http://stackoverflow.com/a/20829048
has text: but i used as you said it also print the last saved student why is that :PrintWriter pw = new PrintWriter(new FileOutputStream("/Users/Yukki/Desktop/Students.txt")); for (Student student: Students) { pw.println(student); } pw.close();
type: AnswerComment
score: 0

http://stackoverflow.com/a/20729111
downvote count: 0
has comment: http://stackoverflow.com/comment/31056767
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31057341
score: 2
has body: Two problems: You are finding the line in the host name - that's like finding a haystack in a needle - reverse the test No matter the result of the condition, you return after testing it just once, so only the first line is tested Instead, try this: String l; while ((l=inf.readLine()) != null) if (l.contains(host)) return true; return false;
answers question: http://stackoverflow.com/q/20728848
has comment: http://stackoverflow.com/comment/31056827
has comment: http://stackoverflow.com/comment/31056854

http://stackoverflow.com/comment/31070599
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20736442
has text: I assume that you've fixed `NPE` already. I'm referring to your [previous post](http://stackoverflow.com/questions/20735508/sales-calculator-including-sales-tax-for-different-states).
type: Comment

http://stackoverflow.com/q/20726028
linked to: http://stackoverflow.com/q/8777257
has comment: http://stackoverflow.com/comment/31051390
tagged with: java
has comment: http://stackoverflow.com/comment/31052721
downvote count: 3
tagged with: arrays
answer count: 1
has title: Comparing arrays not working correctly?
favorite count: 0
has comment: http://stackoverflow.com/comment/31051498
has comment: http://stackoverflow.com/comment/31051365
has answer: http://stackoverflow.com/a/20726158
accepted answer: http://stackoverflow.com/a/20726158
has comment: http://stackoverflow.com/comment/31051553
score: -3
has comment: http://stackoverflow.com/comment/31067283
has comment: http://stackoverflow.com/comment/31051393
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31051437
has body: Ok this is my code. Now I have it set up so far to display the correct pattern for 3 seconds, go to an input screen for the user to input, when the user clicks the screen 6 times it takes the pattern the user inputs and stores it into the array input, then checks if the input array and pattern array are the same. Now the problem is that when it checks for the arrays to be the same that it works correctly for the percent pattern but it doesn't work correctly for any other pattern. How can I compare the two 2D arrays? package game; import java.awt.Dimension; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; public class InputGame implements Properties,Listeners{ public static JFrame gf = new JFrame(); public static JButton a1,a2,a3,a4; public static JButton b1,b2,b3,b4; public static JButton c1,c2,c3,c4; public static JButton d1,d2,d3,d4; public static int height = 800; public static int width = 600; public static int gsize = 4; public static int order =1; public static Dimension size = new Dimension(height,width); public static menu Menu = new menu(); public static GridLayout Ggrid = new GridLayout(gsize,gsize); public static int numOfClicks =0; public static int numCorrect=0; public static int[][] input = new int[][]{ {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; //public static Thread d; public static void clear() { gf.dispose(); } public static void setup() { gf.dispose(); gf = new JFrame(); gf.setLocation(300,100); gf.setSize(size); gf.setResizable(false); gf.setLayout(Ggrid); gf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); PatternGame.clear(); blank(); gf.setVisible(true); System.out.print(numOfClicks); } public static void blank() { { a1 = new JButton(""); a2 = new JButton(""); a3 = new JButton(""); a4 = new JButton(""); a1.addActionListener(new input()); a2.addActionListener(new input()); a3.addActionListener(new input()); a4.addActionListener(new input()); gf.add(a1); gf.add(a2); gf.add(a3); gf.add(a4); } { b1 = new JButton…
has comment: http://stackoverflow.com/comment/31051491
tagged with: jbutton
type: Question
linked to: http://stackoverflow.com/q/5440039

http://stackoverflow.com/comment/31203088
score: 0
type: Comment
has text: did you check the R file for the resource id?
comment on: http://stackoverflow.com/a/20810571
type: AnswerComment

http://stackoverflow.com/q/20712612
has comment: http://stackoverflow.com/comment/31027395
tagged with: tomcat
type: Question
tagged with: oracle-database
has answer: http://stackoverflow.com/a/42819070
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
has body: I am attempting to use connection pooling with tomcat 7 and connecting to an Oracle database. At the minute my context looks like this &lt;Resource type="org.apache.tomcat.jdbc.pool.DataSource" driverClassName="oracle.jdbc.OracleDriver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" url="my-url" username="username" password="password" I am using google guice to inject the DataSource, bind(Context.class).to(InitialContext.class); bind(DataSource.class).toProvider(fromJndi(OracleDataSource.class,"java:comp/env/jdbc/nameToUse")); however it does appear to be creating the provider, but anytime it calls it I always get a RunTime error with javax.naming.NamingException: ORA-01017: invalid username/password; logon denied even though the login details are definitely correct - they work if I switch back to the old way of connecting to the database. Am I doing something wrong, with Guice, or is the connection pool with Oracle (9i I believe) setup differently? Any help is much appreciated
has title: Tomcat 7 and Oracle Connection Pooling
has comment: http://stackoverflow.com/comment/31027340

http://stackoverflow.com/comment/31073904
has text: running from C:\Windows\System32\java.exe I am expecting this to have run from program files...... plus it is a 64 bit machine
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20738264
score: 0

http://stackoverflow.com/q/20739607
upvote count: 4
linked to: http://stackoverflow.com/q/11563298
answer count: 2
has answer: http://stackoverflow.com/a/64481390
has comment: http://stackoverflow.com/comment/89566087
favorite count: 0
type: UnansweredQuestion
has body: I have made the GUI of my javafx application in scenebuilder. I have correctly made the settings of placing the fxml and my application works perfect. Now I want to add action events to buttons and when a button is clicked, a panel should be shown and when other button is clicked, the other panel should be shown. Please help me. And remember that I am building my interface using scenebuilder i.e using fxml for my interface. Thank you.
tagged with: fxml
has title: show hide panel in javafx using fxml
tagged with: javafx
downvote count: 1
type: Question
score: 3
has comment: http://stackoverflow.com/comment/31137735
tagged with: java
has answer: http://stackoverflow.com/a/45847173

http://stackoverflow.com/comment/31099799
type: Comment
has text: @fdsa It's not an error but it's confusing because it goes against common conventions.
comment on: http://stackoverflow.com/a/20752800
type: AnswerComment
score: 0

http://stackoverflow.com/a/20683324
has body: You could use the GNU file utility to check whether or not java.exe is a 64-bit-executable. See this link for more information about that. This way, you can avoid starting the unknown java.exe from your code, but instead your program has to start the file utility you have provided yourself.
score: 0
answers question: http://stackoverflow.com/q/20682654
type: Answer

http://stackoverflow.com/comment/31144390
has text: What, no line numbers in the stack trace?
type: QuestionComment
comment on: http://stackoverflow.com/q/20777728
score: 0
type: Comment

spring
tags question: http://stackoverflow.com/q/20777744
tags question: http://stackoverflow.com/q/20772851
tags question: http://stackoverflow.com/q/20800069
tags question: http://stackoverflow.com/q/20768779
tags question: http://stackoverflow.com/q/20689497
tags question: http://stackoverflow.com/q/20807988
tags question: http://stackoverflow.com/q/20790634
tags question: http://stackoverflow.com/q/20811732
tags question: http://stackoverflow.com/q/20756121
tags question: http://stackoverflow.com/q/20826371
tags question: http://stackoverflow.com/q/20708305
tags question: http://stackoverflow.com/q/20684518
tags question: http://stackoverflow.com/q/20685308
tags question: http://stackoverflow.com/q/20787858
tags question: http://stackoverflow.com/q/20825462
tags question: http://stackoverflow.com/q/20686750
tags question: http://stackoverflow.com/q/20818459
tags question: http://stackoverflow.com/q/20831441
tags question: http://stackoverflow.com/q/20824190
tags question: http://stackoverflow.com/q/20761585
tags question: http://stackoverflow.com/q/20843191
tags question: http://stackoverflow.com/q/20726812
tags question: http://stackoverflow.com/q/20790721
tags question: http://stackoverflow.com/q/20680567
tags question: http://stackoverflow.com/q/20840153
tags question: http://stackoverflow.com/q/20792988
tags question: http://stackoverflow.com/q/20834645
tags question: http://stackoverflow.com/q/20684201
tags question: http://stackoverflow.com/q/20771701
tags question: http://stackoverflow.com/q/20699519
tags question: http://stackoverflow.com/q/20782120
tags question: http://stackoverflow.com/q/20809661
tags question: http://stackoverflow.com/q/20782210
tags question: http://stackoverflow.com/q/20748658
tags question: http://stackoverflow.com/q/20724774
tags question: http://stackoverflow.com/q/20747538
tags question: http://stackoverflow.com/q/20845623
tags question: http://stackoverflow.com/q/20808649
tags question: http://stackoverflow.com/q/20792313
tags question: http://stackoverflow.com/q/20707203
tags question: http://stackoverflow.com/q/20748792
tags question: http://stackoverflow.com/q/20841331
tags question: http://stackoverflow.com/q/20742331
tags question: http://stackoverflow.com/q/20791925
tags question: http://stackoverflow.com/q/20765754
tags question: http://stackoverflow.com/q/20843269
tags question: http://stackoverflow.com/q/20826768
tags question: http://stackoverflow.com/q/20702216
tags question: http://stackoverflow.com/q/20835717
tags question: http://stackoverflow.com/q/20730559
tags question: http://stackoverflow.com/q/20698288
tags question: http://stackoverflow.com/q/20831040
type: Tag
tags question: http://stackoverflow.com/q/20704056
tags question: http://stackoverflow.com/q/20819494
tags question: http://stackoverflow.com/q/20752734
tags question: http://stackoverflow.com/q/20810058
tags question: http://stackoverflow.com/q/20757821
tags question: http://stackoverflow.com/q/20725961
tags question: http://stackoverflow.com/q/20693535
tags question: http://stackoverflow.com/q/20770279
tags question: http://stackoverflow.com/q/20842070
tags question: http://stackoverflow.com/q/20770169
tags question: http://stackoverflow.com/q/20789207
tags question: http://stackoverflow.com/q/20689120
tags question: http://stackoverflow.com/q/20843150
tags question: http://stackoverflow.com/q/20735289
tags question: http://stackoverflow.com/q/20740956
tags question: http://stackoverflow.com/q/20840737
tags question: http://stackoverflow.com/q/20742208
tags question: http://stackoverflow.com/q/20723837
tags question: http://stackoverflow.com/q/20683316
tags question: http://stackoverflow.com/q/20844456
tags question: http://stackoverflow.com/q/20706939
tags question: http://stackoverflow.com/q/20782970
tags question: http://stackoverflow.com/q/20748684
tags question: http://stackoverflow.com/q/20794478
tags question: http://stackoverflow.com/q/20740867
tags question: http://stackoverflow.com/q/20680280
tags question: http://stackoverflow.com/q/20722046

http://stackoverflow.com/comment/31187025
has text: its rdp server(hyperv)
comment on: http://stackoverflow.com/q/20800991
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20754453
upvote count: 1
has comment: http://stackoverflow.com/comment/31103439
has body: this isnt going to work because the ImageView is in the item list so you should consider doing.. mailButton = (ImageView) row.findViewById(R.id.email); where row is the item list. remember the ImageView isn't in staff_layout, it is in your item_layout. to make it works you need to move this block: mailbutton=(ImageView)findViewById(R.id.email); mailbutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "This line would appear on clicking this icon", Toast.LENGTH_LONG).show(); } }); to the getView() in your adapter class. and let the View get findViewById or have an instance of the item_layout view in order to reach the buttons.
has comment: http://stackoverflow.com/comment/31102977
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20754390
type: Answer
answers question: http://stackoverflow.com/q/20754390
score: 1
has comment: http://stackoverflow.com/comment/31103061

http://stackoverflow.com/comment/30993653
comment on: http://stackoverflow.com/a/20694247
has text: It's an if statement (the same functionality) built into an expression. The if is something the OP will be familiar with and gives them context for what the ? : does.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/39436238
answers question: http://stackoverflow.com/q/20807131
has body: I think to mimic UIAutomator you can do this: (Though, I suggest rethinking your approach to have no conditions.) ViewInteraction view = onView(withBlah(...)); // supports .inRoot(...) as well if (exists(view)) { view.perform(...); } @CheckResult public static boolean exists(ViewInteraction interaction) { try { interaction.perform(new ViewAction() { @Override public Matcher&lt;View&gt; getConstraints() { return any(View.class); } @Override public String getDescription() { return "check for existence"; } @Override public void perform(UiController uiController, View view) { // no op, if this is run, then the execution will continue after .perform(...) } }); return true; } catch (AmbiguousViewMatcherException ex) { // if there's any interaction later with the same matcher, that'll fail anyway return true; // we found more than one } catch (NoMatchingViewException ex) { return false; } catch (NoMatchingRootException ex) { // optional depending on what you think "exists" means return false; } } Also exists without branching can be implemented really simple: onView(withBlah()).check(exists()); // the opposite of doesNotExist() public static ViewAssertion exists() { return matches(anything()); } Though most of the time it's worth checking for matches(isDisplayed()) anyway.
type: Answer
score: 13
upvote count: 13
has comment: http://stackoverflow.com/comment/106509446
has comment: http://stackoverflow.com/comment/106501623
downvote count: 0

http://stackoverflow.com/comment/31271174
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20847334
has text: Don't invoke repaint() in the paintComponent() method. This will cause an infinite loop.

http://stackoverflow.com/comment/31185763
has text: Could you please post your code from Spring's Controller?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20801347

http://stackoverflow.com/q/20748140
has answer: http://stackoverflow.com/a/20748272
type: Question
tagged with: java
score: 0
tagged with: mongodb
accepted answer: http://stackoverflow.com/a/20748272
tagged with: mongodb-java
has body: I am using the database MongoDB and I trying to run a query that will check two things. The query is timestamp is greater than time and server is not equals to name. It would look like this in an if statement if (timestamp &gt; date &amp;&amp; !server.equalsIgnoreCase("name") This is the code I'm using to query List&lt;BasicDBObject&gt; queryList = new ArrayList&lt;&gt;(); queryList.add(new BasicDBObject("timestamp",new BasicDBObject("$gt", lastCheck))); queryList.add(new BasicDBObject("server",new BasicDBObject("$not","Dev"))); BasicDBObject query = new BasicDBObject("$and",queryList); I am getting this error when running the code Caused by: com.mongodb.CommandResult$CommandFailure: command failed [count]: { "serverUsed" : "localhost/127.0.0.1:27017" , "errmsg" : "exception: invalid use of $not" , "code" : 13041 , "ok" : 0.0} I know I am using the $not operator wrong but hopefully someone can help me
has title: MongoDB query invalid
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/31270995
has text: Thats what i thought, but seems too easy for an exam question, ill ask my lecturer and come back. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20847231
type: Comment

http://stackoverflow.com/q/20743051
tagged with: layout
has body: I'm learning how to use GridBagLayout. I created two buttons in a JFrame. I tried making it that one of them occupies one collumn (the default), and the other two collumns, thus being twice the size of the first one (I know I can acheive this using setPrefferredSize, but my intention is to learn how to use gridwidth and gridheight). What's the problem? Thanks import java.awt.*; import javax.swing.*; public class Main extends JFrame { Main(){ setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(500,500); JPanel panel1 = new JPanel(new GridBagLayout()); JButton b1,b2; b1 = new JButton("button 1"); b2 = new JButton("button 2"); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridwidth = 1; panel1.add(b1); gbc.gridx = 2; gbc.gridwidth = 2; panel1.add(b2); add(panel1); setVisible(true); } public static void main(String[]args){ Main m = new Main(); } }
has answer: http://stackoverflow.com/a/20743223
has title: About using GridBagLayout in Java
score: 0
answer count: 3
tagged with: layout-manager
has answer: http://stackoverflow.com/a/20743191
has answer: http://stackoverflow.com/a/20743562
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
tagged with: gridbaglayout

http://stackoverflow.com/q/20822710
linked to: http://stackoverflow.com/q/17087940
has comment: http://stackoverflow.com/comment/31225699
type: AnsweredQuestion
has title: Customizing Text in tab title for android
has body: What my current work :: I have designed a tab activity which has four tabs in bottom snapshot BreakfastLunchDinnerIndividualListOfItems.java public class BreakfastLunchDinnerIndividualListOfItems extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.breakfast_lunch_dinner_individual_list_of_items); Resources res = getResources(); // Resource object to get Drawables TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Reusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new Intent().setClass(this, BLD_IndividualListOfItems_Starters.class); spec = tabHost.newTabSpec("STARTERS").setIndicator("Starters").setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs intent = new Intent().setClass(this, BLD_IndividualListOfItems_MainCourse.class); spec = tabHost.newTabSpec("MAIN_COURSE").setIndicator("Main Course").setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, BLD_IndividualListOfItems_SideCourse.class); spec = tabHost.newTabSpec("SIDE_COURSE").setIndicator("Side course").setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, BLD_IndividualListOfItems_Others.class); spec = tabHost.newTabSpec("OTHERS").setIndicator("Others").setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, BLD_IndividualListOfItems_Desert.class); spec = tabHost.newTabSpec("DESERT").setIndicator("Deserts").setContent(intent); tabHost.addTab(spec); //set tab which one you want open first time 0 or 1 or 2 tabHost.setCurrentTab(0); } } breakfast_lunch_dinner_individual_list_of_items.java &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout…
tagged with: android
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/20822960
upvote count: 1
answer count: 1
tagged with: android-tabhost
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/20822960

http://stackoverflow.com/q/20772251
favorite count: 0
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/20786065
tagged with: java
type: Question
downvote count: 4
upvote count: 0
has body: Currently, I am able to print all the URLs of a page but not able to print the text available on the URL.... For example: Settings The code is able to print only "/preferences?hl=en", but not the text of the link i.e., Settings.... public static List getLinks(String uriStr) { List result = new ArrayList<String>(); //create a reader on the html content try{ System.out.println("in the getlinks try"); URL url = new URI(uriStr).toURL(); URLConnection conn = url.openConnection(); Reader rd = new InputStreamReader(conn.getInputStream()); // Parse the HTML EditorKit kit = new HTMLEditorKit(); HTMLDocument doc = (HTMLDocument)kit.createDefaultDocument(); kit.read(rd, doc, 0); // Find all the A elements in the HTML document HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A); while (it.isValid()) { SimpleAttributeSet s = (SimpleAttributeSet)it.getAttributes(); String link = (String)s.getAttribute(HTML.Attribute.HREF); if (link != null) { // Add the link to the result list System.out.println(link); //System.out.println("link print finished"); result.add(link); } //System.out.println(link); it.next(); } } How would I print the content of the URL?
has comment: http://stackoverflow.com/comment/31133984
tagged with: hyperlink
has title: java - How to print link text available on the URL?
answer count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/31134061

http://stackoverflow.com/comment/30997790
score: 0
has text: Is your issue that you're not able to simulate a drag and drop through WebDriver? Or that the iframe has no id or class? In any case, please make the question a little clear.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20696512

http://stackoverflow.com/q/20767984
has comment: http://stackoverflow.com/comment/31126777
favorite count: 0
has comment: http://stackoverflow.com/comment/31127276
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: How do i create/modify the contents of a file before i create it in a Java program i have made?
tagged with: file
accepted answer: http://stackoverflow.com/a/20768200
has answer: http://stackoverflow.com/a/20768010
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/20768057
has answer: http://stackoverflow.com/a/20768200
linked to: http://stackoverflow.com/q/1053467
tagged with: java-io
linked to: http://stackoverflow.com/q/7018541
upvote count: 2
has comment: http://stackoverflow.com/comment/31126823
answer count: 3
possible better answer: http://stackoverflow.com/a/20768057
has body: Hey here is my code i have created its a simple file creation program as i have only been using java for the past 2 days. I'm only 13 so please be simple :) import java.io.File; import java.io.IOException; import java.util.Scanner; public class Filecreator { public static void main( String[] args ) { Scanner read = new Scanner (System.in); String y; String u; try { System.out.println("Please enter the name of your file!"); y = read.next(); while (y.contains(".") || y.contains(",") || y.contains("{") || y.contains("}") || y.contains("@")){ System.out.println("Your Filename contains an incorrect character you may only use Number 0-9 And Letters A-Z"); System.out.println("Please Re-enter your file name"); y = read.next(); } System.out.println("Please enter the file type name"); u = read.next(); while (u.contains(".") || u.contains(",") || u.contains("{") || u.contains("}") || u.contains("@") ){ System.out.println("Your File-type name contains an incorrect character you may only use Number 0-9 And Letters A-Z"); System.out.println("Please Re-enter your file-type name"); u = read.next(); } File file = new File( y + "." + u ); if (file.createNewFile()){ System.out.println("File is created!"); System.out.println("The name of the file you have created is called " + y + file); }else{ System.out.println("File already exists."); } } catch (IOException e) { e.printStackTrace(); } } } If you run it on a program such as Eclipse you will see the output. But i want to be able to edit the [file's] contents before i finally choose the name and the file type and then save it. Is there anyway i can do this? Thanks - George

tomcat7
tags question: http://stackoverflow.com/q/20811732
tags question: http://stackoverflow.com/q/20683428
tags question: http://stackoverflow.com/q/20762885
tags question: http://stackoverflow.com/q/20699068
tags question: http://stackoverflow.com/q/20784531
tags question: http://stackoverflow.com/q/20827959
tags question: http://stackoverflow.com/q/20832250
tags question: http://stackoverflow.com/q/20739520
tags question: http://stackoverflow.com/q/20770818
type: Tag
tags question: http://stackoverflow.com/q/20762707
tags question: http://stackoverflow.com/q/20771493
tags question: http://stackoverflow.com/q/20818237
tags question: http://stackoverflow.com/q/20801072
tags question: http://stackoverflow.com/q/20774716
tags question: http://stackoverflow.com/q/20741883
tags question: http://stackoverflow.com/q/20770119
tags question: http://stackoverflow.com/q/20791770
tag name: tomcat7

http://stackoverflow.com/comment/31220824
score: 0
type: Comment
type: QuestionComment
has text: @Makoto this method returns the gameOption which can be 1,2,3. If there was a parameter such as gameOption than it would be easy to test. But as the method takes no parameters I got stuck on how to test it. Sorry if this is simple but I can't really understand the logic of this thing when it comes to testing it. The method was designed by someone else and I need to create the Junit test for it.
comment on: http://stackoverflow.com/q/20820289

http://stackoverflow.com/comment/31096415
score: 0
comment on: http://stackoverflow.com/a/20750287
type: AnswerComment
has text: I don't understand... sorry i'm an ultra-n00b that has done python and is only starting C; this is java, so it might be too complex.
type: Comment

http://stackoverflow.com/comment/31104423
comment on: http://stackoverflow.com/q/20744092
type: QuestionComment
type: Comment
has text: You can still get LogCat trace if you connect your device to the computer. Are you getting any error or your map is loading correctly except for the MAP_TYPE_SATELLITE part? Is the map showing you your location?
score: 0

http://stackoverflow.com/q/20799629
has answer: http://stackoverflow.com/a/20799698
has answer: http://stackoverflow.com/a/20799700
has answer: http://stackoverflow.com/a/20799682
answer count: 5
has title: Memory allocation to string variable
has comment: http://stackoverflow.com/comment/31182487
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20799673
upvote count: 1
has body: Please confirm which of the two codes are efficient a or b . Where string is defines inside loop or outside loop. Kindly sugggest. a) for(int i=0;i&lt;configIndexNumber.size();i++){ ConfigurationDetailsObject oldIndex =(ConfigurationDetailsObject)configIndexNumber.get(i); String Key = oldIndex.getVehConfigNo()+oldIndex.getBaseEngineKey()+oldIndex.getEngineCode()+oldIndex.getTestGroupId()+oldIndex.getTransConfig()+oldIndex.getInertiaWeightClassNo()+oldIndex.getAxleRatioValue(); if(!configIdxNnb.containsKey(Key)) { newConfigIndexList.add(oldIndex); configIdxNnb.put(Key,oldIndex); } } b) String Key=null; for(int i=0;i&lt;configIndexNumber.size();i++){ ConfigurationDetailsObject oldIndex =(ConfigurationDetailsObject)configIndexNumber.get(i); Key = oldIndex.getVehConfigNo()+oldIndex.getBaseEngineKey()+oldIndex.getEngineCode()+oldIndex.getTestGroupId()+oldIndex.getTransConfig()+oldIndex.getInertiaWeightClassNo()+oldIndex.getAxleRatioValue(); if(!configIdxNnb.containsKey(Key)) { newConfigIndexList.add(oldIndex); configIdxNnb.put(Key,oldIndex); } }
type: Question
has answer: http://stackoverflow.com/a/20799848
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/20766344
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31123624
answers question: http://stackoverflow.com/q/20764256
has body: You should change your "class MainActivity extends ListFragment" into class MainActivity extends ListActivity as currently your MainActivity isn't an Activity but a Fragment. But in your case what you really want is an Activity You will also get some other errors as Activity has different methods than Fragment Notes: Fragment do not need to be in the manifest.

http://stackoverflow.com/q/20722165
tagged with: compiler-construction
downvote count: 6
type: Question
tagged with: java
has body: where is my Error in this project ? here is my source code Compiler program after i run this code which i create it .. it gives me these errors : Exception in thread "main" java.lang.NullPointerException at First_Project.First_Project.LetsDoThis(First_Project.java:78) at First_Project.First_Project.main(First_Project.java:27) so , what is my error and where ? package First_Project; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class First_Project { private static PrintWriter output; private static Scanner input; static char LF; public static void main(String args[]) throws FileNotFoundException, NullPointerException { File inputFile = new File("D:\\input.txt"); if (!inputFile.exists()) { System.out.println("Input file, " + inputFile + ", does not exist."); System.exit(0); } // Output File: File outputFile = new File("D:\\outputbaraa.txt"); output = new PrintWriter(outputFile); // Make Scanner for input and Printwriter for output LetsDoThis(); } static String Text = ""; // string to store lexemes static String WORD[] = {"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "for", "final", "finally", "float", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "package", "private", "protected", "public", "return", "short", "static", "strictfp*", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "try", "void", "volatile", "while"}; public static void error() { output.println(Text + "\t\tUnknown Character\n"); Text = ""; output.flush(); } private static boolean isLetter(char c) { return (((int) c &gt; 96 &amp;&amp; (int) c &lt; 123) || ((int) c &gt; 64 &amp;&amp; (int) c &lt; 91)); } private static boolean isDigit(char c) { return ((int) c &gt; 47 &amp;&amp; (int) c &lt; 58); } private static boolean isReservedWord(String wor…
has title: Compiler Programs .. i have some error in it
upvote count: 0
answer count: 1
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/31044345
has answer: http://stackoverflow.com/a/20722203
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31043797

http://stackoverflow.com/q/20755557
score: 0
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/20755775
type: Question
has comment: http://stackoverflow.com/comment/31105067
accepted answer: http://stackoverflow.com/a/20755775
answer count: 1
has body: I want to create a timer that I can create an instance of an run. I have created this at the end of this code. What I want to be able to do is be able to start each timer and have them run at the same time but when one finishes the other should continue. This code works but the timers both keep going. How would I change it so that when one timer ends that it doesn't reset and then the second timer ends then everything stops. Maybe I should be using a thread? Not sure on this one? Maybe each timer can be linked to a thread. Code (Program): import java.awt.Toolkit; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.Timer; import java.util.TimerTask; import javax.swing.JOptionPane; public class DDHTypeCasting { public static void main(String[] args) { AnnoyingBeep y1 = new AnnoyingBeep(5,"Timer 1"); AnnoyingBeep y2 = new AnnoyingBeep(10,"Timer 2"); System.out.format("Task scheduled.%n"); } } class AnnoyingBeep { Timer timer; public AnnoyingBeep() { } public AnnoyingBeep(int a, String s) { timer = new Timer(); timer.schedule(new RemindTask(a,s),a,1*1000); //delay } } class RemindTask extends TimerTask { Toolkit toolkit; int numWarningBeeps = 0; String myString = null; RemindTask(int a, String s) { numWarningBeeps = a; myString = s; } public void run() { if (numWarningBeeps &gt; 0) { System.out.format("Beep!%n " + myString); numWarningBeeps--; } else { System.out.format("Time's up!%n " + myString); // System.exit(0); } } }
has title: Make two timers work and end when they are supposed to?
type: AnsweredQuestion

http://stackoverflow.com/comment/31202995
type: QuestionComment
comment on: http://stackoverflow.com/q/20805464
type: Comment
has text: To be more specific: I'm trying to reach mail databases. For that it might be helpful to precheck connections documents etc. but the final opening (or not) depends on the user's rights given (or not) via delegation - though that might be trapped by try-catch. To check for a connection on socket 1352 may just say: "ah ok, the server is there" - but does not guarantee a connection from the Domino point of view. Thanks anyway.
score: 0

http://stackoverflow.com/q/20811234
has answer: http://stackoverflow.com/a/20811300
accepted answer: http://stackoverflow.com/a/20811306
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31203925
score: 0
has comment: http://stackoverflow.com/comment/31204180
has answer: http://stackoverflow.com/a/20811306
has body: In the following java message box sample application, the "OK" button is appearing as three dots (...). It's working properly on JDK 6.0. But this problem arising on JDK 7.0. How to fix this issue? Jave Source Code: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class ShowDialogBox{ JFrame frame; public static void main(String[] args){ ShowDialogBox db = new ShowDialogBox(); } public ShowDialogBox(){ frame = new JFrame("Show Message Dialog"); JButton button = new JButton("Click Me"); button.addActionListener(new MyAction()); frame.setLayout(new FlowLayout()); frame.add(button); frame.setSize(400, 400); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public class MyAction implements ActionListener{ public void actionPerformed(ActionEvent e){ JOptionPane.showMessageDialog(frame,"Eggs are not supposed to be green.","Inane warning",JOptionPane.WARNING_MESSAGE); } } }
has comment: http://stackoverflow.com/comment/31203956
tagged with: messagebox
tagged with: swing
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/20811300
has comment: http://stackoverflow.com/comment/31203886
has title: Message Box error with OK button - string truncated

http://stackoverflow.com/a/20832696
type: Answer
has comment: http://stackoverflow.com/comment/31909208
score: 1
upvote count: 1
has body: It was because I was missing validateAnnotatedMethodOnly at the class level validation interceptor I defined. It worked when I modified the class definition to something like the following. @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @InterceptorRefs({@InterceptorRef(value="defaultStack", params={"validation.validateAnnotatedMethodOnly", "true", "validation.excludeMethods", "load"})}) public final class TestAction extends ActionSupport implements Serializable, ValidationAware, ModelDriven<Transporter> { //... } I included validation.validateAnnotatedMethodOnly at method levels but forgot to include it at the class level. It would have also been appropriate to just annotate the load() method in the action class with @SkipValidation and eliminate the class level @InterceptorRefs annotation in its entirely. From the documentation: When multiple methods are used to map different actions on the same class, and one of them is annotated with @Validations, those validators will be triggered for all the actions, unless they are annotated with @SkipValidation or validateAnnotatedMethodOnly is set to true in the validation interceptor, like: true input,back,cancel,browse
answers question: http://stackoverflow.com/q/20817709
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20817709

http://stackoverflow.com/comment/39653070
score: 0
type: Comment
type: AnswerComment
has text: functionally no difference. When you set onclick handler in xml android automatically or internally set a onclickListener interface for you and in that interface implementation your handler will be called if your handler fullfills the contract(it should be public).
comment on: http://stackoverflow.com/a/20740726

http://stackoverflow.com/comment/31248804
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20835288
has text: What's that requirement based on?
score: 0

http://stackoverflow.com/q/20811236
has comment: http://stackoverflow.com/comment/31211359
upvote count: 3
score: 1
has comment: http://stackoverflow.com/comment/62214337
has comment: http://stackoverflow.com/comment/31211357
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/31204158
has answer: http://stackoverflow.com/a/20811500
has comment: http://stackoverflow.com/comment/31211358
answer count: 2
has body: I'm trying to encrypt and decrypt with send the request and get the response from the server in my android application and I used JSON web services but I'm getting RuntimeException. I don't know how to do this. Here is my Activity code. public class MainActivity extends Activity implements OnClickListener { Button btnPost; static String key="Dyv6ACIDe2q+OEjztjfNDw=="; Person person; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnPost = (Button) findViewById(R.id.btnPost); btnPost.setOnClickListener(this); } static String RequestId="3465768789"; static String strRequestCode="001"; static String stringChannelId="MobileApp"; static String strIpAddress = "192.168.1.123"; static String strStatusFlag="true"; static String strUserId="test@test.com"; static String strPassword="password1"; static String strVendorId="001"; static String strRequestId="09"; static String strRequest="CLIENT"; public static String POST(String url, Person person) { InputStream inputStream = null; String result = ""; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); String json = ""; JSONObject jsonObject = new JSONObject(); jsonObject.accumulate("RequestId", strRequestId); jsonObject.accumulate("RequestCode", strRequestCode); jsonObject.accumulate("ChannelId", stringChannelId); jsonObject.accumulate("IPAddress", strIpAddress); jsonObject.accumulate("ForceChangeFlag",strStatusFlag); jsonObject.accumulate("UserId", strUserId); jsonObject.accumulate("Password",strPassword); jsonObject.accumulate("Request",strRequest ); jsonObject.accumulate("VendorId", strVendorId); json = jsonObject.toString(); String reqvalues=AES128Bit.encrypt(jsonObject.toString().toString(),key); Log.e("Reqvalues"," = "+reqvalues); StringEntity se = new StringEntity(reqvalues); httpPost.setEntity(se); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "applic…
favorite count: 0
has comment: http://stackoverflow.com/comment/31203875
has comment: http://stackoverflow.com/comment/31203908
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/20811406
tagged with: encryption
tagged with: android
has title: Encrypt and decrypt JSON data in Android

http://stackoverflow.com/q/20789043
type: Question
has body: When I save this image: with this method: private final static Path ROOT_PATH = Paths.getPath("C:/images"); private static void saveImageFromWebSimple(final String url) { URL u = null; try { u = new URL(url); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } String file = url.substring(url.indexOf("//") + 2); Path filePath = ROOT_PATH.resolve(file); try { Files.createDirectories(filePath.getParent()); BufferedImage img = ImageIO.read(u); ImageIO.write(img, "jpg", filePath.toFile()); } catch (IOException e) { e.printStackTrace(); } } this is my result: This doesn't happen with all pictures though. Can you tell me why?
has answer: http://stackoverflow.com/a/20789352
linked to: http://stackoverflow.com/q/7676701
linked to: http://stackoverflow.com/q/9340569
has title: Image changes color when saved with java
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31164092
score: 8
favorite count: 0
accepted answer: http://stackoverflow.com/a/20789352
upvote count: 8
has comment: http://stackoverflow.com/comment/31164013
has comment: http://stackoverflow.com/comment/31163590
tagged with: javax.imageio
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/9340569
tagged with: java
has comment: http://stackoverflow.com/comment/31163448
tagged with: bufferedimage

http://stackoverflow.com/q/20807240
has answer: http://stackoverflow.com/a/20807311
score: 0
tagged with: for-loop
has answer: http://stackoverflow.com/a/20807352
has body: I'm a novice in Java programming and I'm trying to guess why the output of the following code: public class ForLoop { public static void main(String[] args) { int x; for (x=1; x&lt;=2; x++) { x += 3; } System.out.print(x); } } is 5 and not 7! For the first iteration, 1 is added to 3 (result: 4) and it is stored in the variable x so x is 4. In the second iteration, we add 3 to 4 and we must obtain 7. The error might be easy to find but I can't catch it. Please help and thanks.
answer count: 5
type: UnansweredQuestion
has title: Explaining output in a for loop
has answer: http://stackoverflow.com/a/20807302
has comment: http://stackoverflow.com/comment/31196251
tagged with: java
has comment: http://stackoverflow.com/comment/31196249
has comment: http://stackoverflow.com/comment/31196259
type: Question
has answer: http://stackoverflow.com/a/20807310
has comment: http://stackoverflow.com/comment/31196310
has answer: http://stackoverflow.com/a/20807303
has comment: http://stackoverflow.com/comment/31196254

http://stackoverflow.com/q/20843221
answer count: 1
favorite count: 0
tagged with: serialization
has title: Simple XML and HashSet
tagged with: simple-framework
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20936067
accepted answer: http://stackoverflow.com/a/20936067
upvote count: 2
has body: I'm discovering Simple XML and try to serialize this simple class : public class Div { private Set&lt; String &gt; _classes = new HashSet&lt; String &gt;() {{ add( "a" ); add( "b" ); add( "c" ); }}; // some methods and attributes... } To : &lt;div class="a b c"&gt; &lt;/div&gt; There is the @Attribute annotation but this can't convert the set to a string. Simple XML provides some "transformers" for doing this job but I can't find any example. Thanks

http://stackoverflow.com/comment/31046221
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20722194
has text: The [javadoc for BufferStrategy.dispose()](http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferStrategy.html#dispose%28%29) says: `Trying to use a BufferStrategy after it has been disposed will result in undefined behavior.` I'm guessing you meant to do `g.dispose();` on that line rather than bs.dispose().

http://stackoverflow.com/comment/31084367
has text: Using this solution can i use net beans GUI to commit and push and etc ?
comment on: http://stackoverflow.com/a/20744536
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31169093
score: 0
type: Comment
has text: Using Spring MVC 3.2.3
comment on: http://stackoverflow.com/a/20791011
type: AnswerComment

http://stackoverflow.com/comment/30970539
has text: "i"+" "+"would"+" "+"choose"+" "+"the"+" "+second"+" "+"way"+" :D"
comment on: http://stackoverflow.com/a/20681797
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/95095510
comment on: http://stackoverflow.com/a/43984625
type: AnswerComment
has text: This worked for me. In Spring boot 2.0.3.RELEASE, the `management.port` key is replaced with `management.server.port`.
type: Comment
score: 2

http://stackoverflow.com/a/20791779
has body: The issue is that you're running your task in the same thread by calling run method of Runnable: new LoaderTask().run(); The common practice is to run it in a thread (simple): Thread th = new Thread(new LoaderTask()); th.setDaemon(true); th.start(); or to send it to a thread pool (a bit more work). More on this in the related Oracle docs... UPDATE If it still freezes: Make sure you don't do any I/O, i.e. reading files or resources in the FX thread, as this would block UI updates an cause the freeze. FX thread is the thread from which you are able to update your UI properties. Try loading resources in a separate thread and update Scene Graph as soon as some/all of them are loaded into memory by running Platform.runLater.
type: Answer
has comment: http://stackoverflow.com/comment/31170356
has comment: http://stackoverflow.com/comment/31170806
accepted answer of: http://stackoverflow.com/q/20791677
has comment: http://stackoverflow.com/comment/31169119
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31169009
answers question: http://stackoverflow.com/q/20791677

http://stackoverflow.com/comment/31198117
score: 0
type: Comment
has text: A JList has nothing to do with SQL. You need to verify that your SQL is correct. Add a few println(...) statements to make sure the value in your variables are correct.
comment on: http://stackoverflow.com/a/20803941
type: AnswerComment

http://stackoverflow.com/q/20826592
has answer: http://stackoverflow.com/a/20827303
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20827365
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20827546
tagged with: substring
score: 0
has title: Can I combine a regex with a substring() in Java?
has answer: http://stackoverflow.com/a/20827351
linked to: http://stackoverflow.com/q/1277157
has body: We're in the process of importing our documentation library to SharePoint, and I'm using a java program I wrote to build metadata for these documents. One of the things that I need to do is determine if a document has a cross referenced document. This condition is defined as having the phrase "see " in the document name. However, naming conventions are nonexistent, and all of the following variations exist: document_see_other_document.doc document_-_see_other_document.doc document_(see_other_document).doc document_[see_other_document].doc document_{see_other_document}.doc I have created a variable which defaults as such: String xref = "no cross reference"; I would like to set this String to "see_other_document" in cases where there is a see &lt;other document&gt; substring in the filename. My plan is to look for an instance of see_, use that as the start point of a substring, ending with the ., non-inclusive. But I want to ELIMINATE any special characters that may exist. In my cases above, I would like to return five instances of other_document, not other_document), etc. My thought was to pull the substring into a variable, then use a regex [^a-zA-Z0-9] and replace non-alphanumeric characters in that second string variable, but is there a better, more elegant way to skin this cat? PSEUDOCODE: if (filename.indexOf("see_"&gt;-1) { String tempFilename = fileName.substring(indexOf("see_")+4,indexOf("."-1)); xref = tempFilename.replaceAll("[^a-zA-Z0-9]",""); } else { xref; }
has comment: http://stackoverflow.com/comment/31233655
tagged with: regex

http://stackoverflow.com/q/20839866
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31257881
has answer: http://stackoverflow.com/a/47979772
type: Question
tagged with: guava
upvote count: 9
has answer: http://stackoverflow.com/a/20842010
has comment: http://stackoverflow.com/comment/31256735
tagged with: java
tagged with: websphere-8
has answer: http://stackoverflow.com/a/26033511
score: 9
has title: Application is not starting in websphere 8.5.5 but works fine in tomcat
tagged with: websphere
has comment: http://stackoverflow.com/comment/31257917
tagged with: java-ee-6
has answer: http://stackoverflow.com/a/20858965
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31259059
has comment: http://stackoverflow.com/comment/31258356
has comment: http://stackoverflow.com/comment/31257836
has comment: http://stackoverflow.com/comment/31257072
has body: I have a web application which can be deployed in tomcat but the same application is not starting in websphere 8.5.5. I have checked SystemErr.log file which gives following information, i cannot debug why application is not starting. If I would like to know more about problem what I need to do. Application Server Version : Websphere 8.5.5 Java Version : java version "1.7.0_25" OpenJDK Runtime Environment (rhel-2.3.10.4.el6_4-x86_64) [12/30/13 12:43:01:144 CET] 000000ab SystemErr R Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Context root /* is already bound. Cannot start application My Application [12/30/13 12:43:01:149 CET] 000000ab SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759) [12/30/13 12:43:01:149 CET] 000000ab SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634) [12/30/13 12:43:01:149 CET] 000000ab SystemErr R at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426) [12/30/13 12:43:01:149 CET] 000000ab SystemErr R ... 93 more [12/30/13 12:43:01:149 CET] 000000ab SystemErr R Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Context root /* is already bound. Cannot start application My Application [12/30/13 12:43:01:150 CET] 000000ab SystemErr R at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:133) [12/30/13 12:43:01:150 CET] 000000ab SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749) [12/30/13 12:43:01:150 CET] 000000ab SystemErr R ... 95 more Here is web.xml file <?xml version="1.0" encoding="UTF-8"?> My Application MyApplication app com.seeta.vadali.MyReceiverServlet uploadDir /tmp app /any
answer count: 4

http://stackoverflow.com/a/20846762
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20846571
has body: Define a class to contain the data for each person, such as: public class Person { private String name; Private Map&lt;Integer,Double&gt; marks = new HashMap&lt;Integer,Double&gt;(); public Person(String name) { this.name = name; } public void setMark(int year, double mark) { this.marks.put(year,mark); } public void getMark(int year) { // return zero if there's no mark for the requested year return this.marks.containsKey(year) ? this.marks.get(year) : 0; } } Then write a Comparator&lt;Person&gt; public PersonComparatorOnMarkDescending implements Comparator&lt;Person&gt; { private int yearToCompare; public PersonComparator(int yearToCompare) { this.yearToCompare = yearToCompare; } public compare(Person p1, Person p2) { Integer p1Mark = p1.getMark(yearToCompare); Integer p2Mark = p2.getMark(yearToCompare); return p2.compareTo(p1); } } You can then define a List&lt;Person&gt; or a Person[] array and use the sorting methods available in java.util. Instantiate the comparator with, for instance: Comparator&lt;Person&gt; comp = new PersonComparatorOnMarkDescending(2012); This approach lets you sort the collection on any year's marks.

http://stackoverflow.com/q/20756343
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/20756438
favorite count: 0
has comment: http://stackoverflow.com/comment/31106227
has answer: http://stackoverflow.com/a/20756428
has answer: http://stackoverflow.com/a/20756411
answer count: 4
type: UnansweredQuestion
has title: Issue with using hashmap
upvote count: 1
has answer: http://stackoverflow.com/a/20756380
type: Question
tagged with: hashmap
has body: import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Scanner; import java.util.Set; class Books { private String title, author, publisher; public Books(String title, String author, String publisher) { this.title = title; this.author = author; this.publisher = publisher; } public String toString() { return "\nTitle: " + title + "\nAuthor: " + author + "\nPublisher: " + publisher + "\n"; } } class Collections { private String title, author, publisher; Scanner sc = new Scanner(System.in); static Map&lt;String, Books&gt; hashmap = new LinkedHashMap&lt;String, Books&gt;(); void reg() { System.out.println("&gt;&gt;Please input the Title = "); title = sc.nextLine(); System.out.println("&gt;&gt;Please input Author = "); author = sc.nextLine(); System.out.println("&gt;&gt;Please input Publisher = "); publisher = sc.nextLine(); hashmap.put(title, new Books(title, author, publisher)); System.out.println(); } Set&lt;String&gt; set = hashmap.keySet(); void load() { for (int i = 0; i &lt; set.size(); i++) { System.out.println("Book" + (i + 1) + "\n"); Iterator&lt;String&gt; iter = set.iterator(); Books b = hashmap.get(iter.next()); System.out.println(b.toString()); } } void search() { System.out.println("Please enter title: "); title = sc.nextLine(); Books b = hashmap.get(title); System.out.println(b.toString()); System.out.println(); } } public class LibraryManage1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Collections collections = new Collections(); boolean run = true; int select; while (run) { System.out.println("--------------------Library Management Program----------------------"); System.out.printf("1. Book collections\n2. Register new books\n3. Search a book\n4. Exit"); System.out.println("--------------------------------------------------------------------"); System.out.println("&gt;&gt;Please select menu : "); select = sc.nextInt(); switch (select) { case 1: collections.load(); break; case…
score: 1

http://stackoverflow.com/a/20796664
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20796134
has body: use this private void copyDataBase() throws IOException{ //Open your local db as the input stream InputStream myInput = myContext.getAssets().open(DB_NAME); // Path to the just created empty db String outFileName = DB_PATH + DB_NAME; //Open the empty db as the output stream OutputStream myOutput = new FileOutputStream(outFileName); //transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer))&gt;0){ myOutput.write(buffer, 0, length); } //Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } Alternative you can use :- AssetDatabaseOpenHelper adb = new AssetDatabaseOpenHelper(this); SQLiteDatabase db = adb.openDatabase(); Cursor c = db.rawQuery("SELECT * FROM xxx;", null); Log.d("MyApp", "cnt: "+c.getCount());

http://stackoverflow.com/a/20799646
has comment: http://stackoverflow.com/comment/31182486
has comment: http://stackoverflow.com/comment/31182443
score: 0
has body: Lews Therin (a fan of TWoT I see) is right: Try writing this: public class Teacher : Person { public override void ShowInfo() { Console.WriteLine("I am a teacher"); } } and see what you get
answers question: http://stackoverflow.com/q/20799573
type: Answer

http://stackoverflow.com/q/20756115
answer count: 3
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31106019
has answer: http://stackoverflow.com/a/20756430
has body: I want to change RadioButton's indicator using a simple shape state selector. I've created the following XML named moon_radio.xml and placed it to a drawable folder. <?xml version="1.0" encoding="utf-8"?> <solid android:color="@color/moon_light_plate" /> <stroke android:width="2dp" android:color="@color/moon_light_plate" /> <solid android:color="@color/moon_light_plate_pressed" /> <stroke android:width="2dp" android:color="@color/moon_light_plate_pressed" /> Then I specify android:button="@drawable/moon_radio" property on a RadioButton in my layout. This does not work for some reason. What's wrong? * EDIT * May be I've explained unclear, but I do not want change background, I want to change indicator, i.e. default dot. This is what I get: And This is what I want to get"
tagged with: java
has title: Styling RadioButton using XML drawable
type: Question
has answer: http://stackoverflow.com/a/20756195
has answer: http://stackoverflow.com/a/20756181
score: 0

http://stackoverflow.com/comment/31136827
type: QuestionComment
comment on: http://stackoverflow.com/q/20773888
has text: You need to run `DemoBook` class not `TextBook`class.
score: 0
type: Comment

http://stackoverflow.com/a/20739597
upvote count: 1
answers question: http://stackoverflow.com/q/20739567
has body: Sorry, as far as I know, this is not possible. You can compile 1.6 compatible class files on JDK7, but you cannot run JDK7 class files on older virtual machines.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/20699836
score: 0
has comment: http://stackoverflow.com/comment/31072595
type: Answer
has comment: http://stackoverflow.com/comment/31009880
answers question: http://stackoverflow.com/q/20698316
has comment: http://stackoverflow.com/comment/31004491
has comment: http://stackoverflow.com/comment/31003390
has comment: http://stackoverflow.com/comment/31007297
has body: As per your Error log shows DETAIL: Key (cpdm01_id)=(100) is still referenced from table "cpdm01_kodpkd". There is still a record referencing to cpdm01_id 100. You might delete record in cpdm01_kodpkd with cpdm01_id = 100 before , but there might be others as well. You have to delete all records in cpdm01_kodpkd referencing to cpdm01_id 100 in main_order. If not, the database protects you from doing harm to your data.

http://stackoverflow.com/comment/31152916
has text: You can use Ajax (for example with jQuery) to invoke server side validation from the client
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20781518

http://stackoverflow.com/a/20768552
answers question: http://stackoverflow.com/q/20767252
has body: You will have to have poi on the other machine, but this shouldn't deter you. You can either just deploy the separate jars with your class file, or export the class file in a jar with the dependent jars. You should also download the binary distribution not the source distribution, you will find the jars you are looking for in there. And then you can add external jar. Additionally, as mentioned in another answer, if you are going to be doing a fair amount of java development, it might be worthwhile to look into maven. Lastly, if you can get away with not writing to a word document, you could forego poi altogether and create a html file that has a 5 column table. You would create the html file the same way you create any text file. Hope that helps.
downvote count: 1
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/q/20711961
has comment: http://stackoverflow.com/comment/31025219
has answer: http://stackoverflow.com/a/20750027
has comment: http://stackoverflow.com/comment/31025255
has answer: http://stackoverflow.com/a/20712209
type: Question
has answer: http://stackoverflow.com/a/20712222
answer count: 8
has answer: http://stackoverflow.com/a/20712267
tagged with: bytecode
downvote count: 0
has answer: http://stackoverflow.com/a/20712178
has body: I need to manually add a method call to a class file without decompiling and recompiling the code because It depends on thousands of other classes and I don't wan't have to do more than is nessescary. I know java but not how class files are made. Any help is appreciated. EDIT: I am not the owner of the source and I need this to work on any computer, which means I cannot redistribute the sources and have them compiled realtime while my patcher is working.
tagged with: class
accepted answer: http://stackoverflow.com/a/20750027
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20712119
has answer: http://stackoverflow.com/a/20712908
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20712096
has title: Manually add a method call to a class file?
has answer: http://stackoverflow.com/a/20712096
tagged with: java

http://stackoverflow.com/comment/31145929
has text: Just to be safe read the full `InputStream` instead of just the `nextLine()`.
comment on: http://stackoverflow.com/q/20778497
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20750135
has comment: http://stackoverflow.com/comment/39501004
upvote count: 1
has comment: http://stackoverflow.com/comment/39501110
has body: You say your XML is called DrawerLayout.xml, yet you set your content as: setContentView(R.layout.activity_main); You need to specify your content as the file containing the layout: setContentView(R.layout.DrawerLayout);
downvote count: 0
has comment: http://stackoverflow.com/comment/39510150
type: Answer
answers question: http://stackoverflow.com/q/20749928
has comment: http://stackoverflow.com/comment/39501150
score: 1

http://stackoverflow.com/comment/31265254
type: AnswerComment
type: Comment
score: 0
has text: Now that you mention it, I have seen this in my EE classes. Thanks, makes sense.
comment on: http://stackoverflow.com/a/20844237

http://stackoverflow.com/comment/31167054
has text: @MarkoTopolnik, you have a very specialized highly animated example that you are talking about. In the "general case", think all the existing Swing components, it is not an issue and should not be treated as an issue until you have a problem. Also, think of the majority of question asked in the forum, you are more likely to have a problem when you don't paint the background first as oppose to having a performance problem.
comment on: http://stackoverflow.com/q/20787800
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31007577
comment on: http://stackoverflow.com/a/20700629
score: 0
type: AnswerComment
has text: Can't you post your question with your issue? @PiyushGupta
type: Comment

http://stackoverflow.com/a/20826901
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/20826702
type: Answer
score: 2
has body: The best option is externalizing the database path instead of hardcoding it, and letting the user choose where to put the actual sqlite file. You could put the sqlite file in the same directory as the program archive, but please note that this does not really help in locating the file from your code, because relative paths are definitely resolved against the JVM (process) working directory, not the location of the JAR: new File(".").getAbsolutePath() There are ways to get the location of the JAR: getClass().getProtectionDomain().getCodeSource().getLocation() but they are deploy-dependent, so it's not a very robust strategy to rely on. Most Java program are configured with external files put in well-known locations (like the current JVM directory or a .myapp/conf.properties in the user home), and individual properties can be overridden in the starting command line, as either system properties -Dkey=value or program arguments (there's a library to simplify this)

http://stackoverflow.com/comment/31040266
type: Comment
comment on: http://stackoverflow.com/a/20717734
type: AnswerComment
has text: @MarkoTopolnik: Your comment seems to be irrelevant to or just misleading about vtable pointers in objects. As I understand it you're reacting to the observation about Java's choice for this trade-off as being negative for Java, and want to emphasize that in some other aspects Java can be quite fast. However, no matter how important that might seem to communicate, that's very off-topic, unrelated to the OP's question, and so this is **not the place** for such observations or impressions.
score: 0

http://stackoverflow.com/a/20730687
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20730497
has comment: http://stackoverflow.com/comment/31059697
has comment: http://stackoverflow.com/comment/31059971
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31059624
accepted answer of: http://stackoverflow.com/q/20730497
has body: This is really simple ;) In Eclipse rightclick your project and select export. Select Java -> JAR File as the type On the next window, uncheck everything, except for generated class files and resources and the project at the top. Make sure to set the export destination. The next screen is usually fine. At the bottom of the last screen you have to select the main class, the class were your application should start. Click finish, and have fun ;) If this was too confusing, i can add screenshots.

http://stackoverflow.com/a/20751485
has comment: http://stackoverflow.com/comment/31097894
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20750576
has comment: http://stackoverflow.com/comment/31098057
has body: I agree with you that, consuming JAVA webservice in .NET is a bit nasty especially with the faultcontracts, ReplyAction &amp; the signature coming up with extra wrappers (like type). The approach I took for a similar need, was by manually rewriting the reference class generated by svcutil. If the alternative now is to invoke the Java service using HttpWebRequest, then why do we need the Bindings? Assuming, this Java Service is over http, can it not be invoked directly using post/get? Please could you post more details. @EDIT: Also, please refer to Consume Web Service with POST from a WCF Service
score: 1
has comment: http://stackoverflow.com/comment/31097840
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31097805
accepted answer of: http://stackoverflow.com/q/20750576

http://stackoverflow.com/q/20812593
has comment: http://stackoverflow.com/comment/31206928
has comment: http://stackoverflow.com/comment/31206570
has comment: http://stackoverflow.com/comment/31206721
has comment: http://stackoverflow.com/comment/31206903
score: 0
has comment: http://stackoverflow.com/comment/31206996
has comment: http://stackoverflow.com/comment/31207146
has title: RequestDispatcher.forward() to resource under “/WebContent” doesn't work
has body: I am dispatching a request to html resource in Webcontent folder in servlet. But its not dispatching it. Even its not giving any exception. AboutUs is an html page placed in WebContent folder of project. The IDE i am using is eclipse. I am very new to web development. any help will be appreciated. Thanks in advance. Servlet Code: @WebServlet("/Login") public class Login extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Login() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name=""; String pass=""; name=request.getParameter("param1"); pass=request.getParameter("param2"); System.out.println("Name :" +name+"PAss :"+pass); if (name!=null &amp;&amp; pass!=null){ List&lt;User&gt; please = DataAccessUtil.getByEmail(name, pass); if (please!=null) { int count = please.size(); System.out.println("Record Found : " + count); if(!(count==0)) { Iterator&lt;User&gt; iterator = please.iterator(); while(iterator.hasNext()) { User object = (User) iterator.next(); String email = object.getEmail(); HttpSession session = request.getSession(); session.setMaxInactiveInterval(60); session.setAttribute("email", email); } RequestDispatcher r= request.getRequestDispatcher("/AboutUs.html"); r.forward(request, response); log("please"); } else{ RequestDispatcher rd= request.getRequestDispatcher("/DR.html"); rd.forward(request, response); log("please2"); } } } else{ } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
has comment: http://stackoverflow.com/comment/31206450
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31206929
has comment: http://stackoverflow.com/comment/31206639
has comment: http://stackoverflow.com/comment/31206558
has comment: http://stackoverflow.com/comment/31206731
has comment: http://stackoverflow.com/comment/31206961
has comment: http://stackoverflow.com/comment/31207075
has comment: http://stackoverflow.com/comment/31206822
tagged with: java
has comment: http://stackoverflow.com/comment/31206911
has comment: http://stackoverflow.com/comment/31206596
type: Question
has comment: http://stackoverflow.com/comment/31206835

http://stackoverflow.com/a/20732726
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You are using a==b instead of a.equals(b) See: Java String.equals versus ==.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31063608
answers question: http://stackoverflow.com/q/20732705
accepted answer of: http://stackoverflow.com/q/20732705

http://stackoverflow.com/a/20780467
type: Answer
answers question: http://stackoverflow.com/q/20779885
has body: I suggest creating an class for this, but this sloppy code will work as well: float a = 5.9f; float b = 9.11f; double f1 = Math.floor(a); // feet of a double f2 = Math.floor(b); // feet of b double feet = f1 + f2; // combined feet int in1 = 0, in2 = 0; // inches of a and b String s1 = String.valueOf(a), s2 = String.valueOf(b); // String values of a and b if (s1.contains(".")) // if a contains a radix point { // inches of a is number after radix point in1 = Integer.parseInt(s1.substring(s1.indexOf(".") + 1)); } if (s2.contains(".")) // if b contains a radix point { // inches of b is number after radix point in2 = Integer.parseInt(s2.substring(s2.indexOf(".") + 1)); } int in = in1 + in2; // combined extra inches feet += in / 12; // add a foot for every 12 extra inches // take all of the factors of 12 out of the total extra inches (in % 12) System.out.print((int)feet + " feet " + in % 12 + " inches"); This generates output: 15 feet 8 inches
score: 0

http://stackoverflow.com/comment/31015679
type: QuestionComment
has text: If possible anyone can answer my previous question here.I didn't get a solution there. http://stackoverflow.com/questions/20704086/spring-application-initialized-twice/20706340?noredirect=1#20706340
type: Comment
comment on: http://stackoverflow.com/q/20706776
score: 0

http://stackoverflow.com/comment/31161249
has text: A milli-second is a very long time and it will take you a very long time to generate all the different random numbers (actually they won't be very random as you will get sequential numbers)
score: 0
comment on: http://stackoverflow.com/q/20787760
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20794204
tagged with: audio
has comment: http://stackoverflow.com/comment/31173245
type: AnsweredQuestion
score: 3
tagged with: java
has body: I'm making a rhythm game and I need a quick way to get the length of an ogg file. The only way I could think would be to stream the file really fast without playing it but if I have hundreds of songs this would obviously not be practical. Another way would be to store the length of the file in some sort of properties file but I would like to avoid this. I know there must be some way to do this as most music players can tell you the length of a song.
accepted answer: http://stackoverflow.com/a/20816180
has comment: http://stackoverflow.com/comment/31174638
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/44407355
downvote count: 1
has answer: http://stackoverflow.com/a/20816180
has title: How to determine length of OGG file
has answer: http://stackoverflow.com/a/44407355
tagged with: ogg
favorite count: 0
tagged with: file-io
upvote count: 4

http://stackoverflow.com/comment/54259257
comment on: http://stackoverflow.com/a/20700183
has text: I came looking for exactly this, but I found that my local repository does not resolve transitive dependencies.(Gradle 2.7, example POM is com.mojang:authlib:1.5.21 as extracted by minecraftforge.net)
type: Comment
score: 6
type: AnswerComment

http://stackoverflow.com/a/20724859
has comment: http://stackoverflow.com/comment/31049223
has body: super.paintComponent's'(g); Maybe the typo is causing the problem. You should be invoking super.paintComponent(g), without the "s".
answers question: http://stackoverflow.com/q/20724604
type: Answer
has comment: http://stackoverflow.com/comment/31049204
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/20798954
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/20798936
has body: Add a readLine() before the while loop to skip the first line. br = new BufferedReader(new FileReader(file)); br.readLine(); //read the first line and throw it away while ((line = br.readLine()) != null) {
accepted answer of: http://stackoverflow.com/q/20798936

http://stackoverflow.com/comment/31144833
type: Comment
has text: I see your confusion. please use my answer for this question as a suggestion : http://stackoverflow.com/questions/20554220/java-server-socket-response/20554359#20554359.. also if you think my answer helped you, please do not forget to accept it as an answer.
comment on: http://stackoverflow.com/a/20777127
score: 0
type: AnswerComment

http://stackoverflow.com/comment/30977441
comment on: http://stackoverflow.com/q/20685677
has text: http://docs.oracle.com/javase/tutorial/jdbc/basics/
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31111538
has text: This is called telescoping constructor. Constructor chaining is calling parents constructor.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/20758816

http://stackoverflow.com/comment/30991375
type: Comment
type: QuestionComment
has text: Could somebody correct my LoanBook class so i can work from there?
score: 0
comment on: http://stackoverflow.com/q/20692500

http://stackoverflow.com/a/20734594
answers question: http://stackoverflow.com/q/20734507
has comment: http://stackoverflow.com/comment/31066921
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31066905
has body: This would never work because alcoholin would NOT exist as this is an entirely different Activity. Why don't you instead use the Extras of the intent to pass data between the two Activities. Standards Class names should always have each word capitalized like MyClassObject in java.

http://stackoverflow.com/comment/43895833
has text: @tonga Can you explain what the `path`parameter should have. Is there a difference b/w `baseURL & path`
type: Comment
comment on: http://stackoverflow.com/a/20804217
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31151144
type: QuestionComment
comment on: http://stackoverflow.com/q/20780779
score: 0
type: Comment
has text: I got it working by removing 'package' line from source and change last line to (.loadClass cl "Test")

hql
tag name: hql
tags question: http://stackoverflow.com/q/20690549
tags question: http://stackoverflow.com/q/20748719
tags question: http://stackoverflow.com/q/20832057
tags question: http://stackoverflow.com/q/20772047
type: Tag
tags question: http://stackoverflow.com/q/20719260
tags question: http://stackoverflow.com/q/20798313

http://stackoverflow.com/a/20762800
has body: You have to change android:background="@layout/activity_main" to android:background="@drawable/yourImageName"
has comment: http://stackoverflow.com/comment/31116984
accepted answer of: http://stackoverflow.com/q/20762720
has comment: http://stackoverflow.com/comment/31116961
answers question: http://stackoverflow.com/q/20762720
has comment: http://stackoverflow.com/comment/31117098
score: 15
upvote count: 15
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20834016
type: Answer
answers question: http://stackoverflow.com/q/20833606
has body: for(int item:month) month[item] = infile.next(); Like this you can do for all of your arrays
score: 0

http://stackoverflow.com/a/20837306
answers question: http://stackoverflow.com/q/20837285
has body: Customer a = new Customer(name,custId,numOfPurchases,city);
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/20833947
tagged with: java
type: Question
score: 2
has answer: http://stackoverflow.com/a/20834095
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31246599
has body: I have a UI requirement in java swing wherein I need to achieve the below: The 2 buttons on the top are placed in a JPanel. I need to draw a line through the center of that panel, upto the beginning of the 2 buttons. The panel below is a container of panels arranged in a card layout. As and when the button is clicked, the card is switched showing another panel. So in all respects this looks like a JTabbedPane, with one difference, the tabs are buttons arranged in the center of the tabbed pane. I need this difference for the UI I am building. As of now, the buttons and card layout panel, looks like the below As you can see, the buttons and panels appear and look separate, instead it would be nice if they are made to appear like they represent one unit.
has title: Drawing borders on a java swing component
has comment: http://stackoverflow.com/comment/31246585
linked to: http://stackoverflow.com/q/20661314
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31247094
tagged with: swing

http://stackoverflow.com/a/20778520
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20778437
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20778437
has body: ConcurrentModificationException will be thrown every time a Collection adds or removes any element while iterating it. This is introduced to let the thread who iterates the Collection aware of the modification. So I believe your codes modify events somewhere else in other threads since your codes listed here don't seem to add or remove any element. You may check out this. Hope it helps.
score: 1

http://stackoverflow.com/q/20792528
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20794002
has body: I have done some work using Python Hadoop Streaming and I think it will be more helpful if I learn Java and begin to learn writing Mapreduce in Java and also have a better understanding of the hadoop code base. I wanted to run the wordcount example and step through every line to learn it. However, I set up Eclipse and Maven, and finally I let all the red errors go away however, after all of that, in front of me is just paragraphs of deprecated code. (1). Am I just wasting my time to learn something that will not be valid soon? (2). Is it possible to use Eclipse to step through a complete Map Reduce so you can have a good idea of what is going on after every step? I am not a Java programmer but I am 100% in and want to learn it well. Can anyone point me to the right direction to learn it? DEBUG? JUNIT?
tagged with: java
type: Question
tagged with: hadoop
answer count: 1
score: 0
has title: Hadoop Word Count MapReduce Tutorial Deprecated

http://stackoverflow.com/comment/30974112
score: 1
type: AnswerComment
has text: Will still boom. Index out of bounds at run time.
comment on: http://stackoverflow.com/a/20683927
type: Comment

http://stackoverflow.com/comment/31006482
type: Comment
type: QuestionComment
has text: Are we all really skipping the fact that he's using the `font` markup with `color` and `size` attributes?
comment on: http://stackoverflow.com/q/20701024
score: 0

http://stackoverflow.com/a/31429106
downvote count: 0
score: 1
has body: 1.5 years old question :( I landed here with the same question, working on Netty 3.5.0 Final. And I resolved with the below code. I used a thread factory which would also generage meaningful threadNames similar to what Abe has mentioned. And, I configured ThreadRenamingRunnable not to rename the threads I supply. Using ThreadFactory and setting ThreadNameDeterminer as CURRENT. ThreadRenamingRunnable.setThreadNameDeterminer(ThreadNameDeterminer.CURRENT); Netty (3.5.0 atleast) alters the threadName from its original value to a proposed value "New I/O Worker #X". The above code snippet, ensures that it doesn't alter the thread name. The name is determined by the below ThreadFactory. public class CustomThreadFactory implements ThreadFactory { private final AtomicInteger threadIdSequence = new AtomicInteger(0); private String threadNamePrefix = "Netty-Worker-"; public CustomThreadFactory() { } public CustomThreadFactory(String namePrefix) { this.threadNamePrefix = namePrefix; } @Override public Thread newThread(Runnable runnable) { Thread newThread = new Thread(runnable, threadNamePrefix + threadIdSequence.incrementAndGet()); if (newThread.isDaemon()) { newThread.setDaemon(false); } if (newThread.getPriority() != Thread.NORM_PRIORITY) { newThread.setPriority(Thread.NORM_PRIORITY); } newThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(final Thread thread, final Throwable e) { System.err.println(thread + " threw exception: " + e.getMessage()); e.printStackTrace(); } }); return newThread; } }
answers question: http://stackoverflow.com/q/20836139
upvote count: 1
type: Answer

http://stackoverflow.com/comment/30982308
type: QuestionComment
comment on: http://stackoverflow.com/q/20688281
has text: So that's the only way? Just sitting and playing around with parsing? No other way exist?
score: 0
type: Comment

http://stackoverflow.com/a/20781978
upvote count: 3
answers question: http://stackoverflow.com/q/20781895
downvote count: 1
has body: I think the answer you are looking for is this. http://www.docjar.com/docs/api/sun/reflect/generics/parser/SignatureParser.html
has comment: http://stackoverflow.com/comment/31245397
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31245370
has comment: http://stackoverflow.com/comment/31151021

http://stackoverflow.com/a/20770700
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20770674
upvote count: 1
type: AcceptedAnswer
has body: A little logic. Java's string length returns int, so Integer max value might be the max size.
type: Answer
accepted answer of: http://stackoverflow.com/q/20770674

http://stackoverflow.com/a/20790199
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20790103
answers question: http://stackoverflow.com/q/20790103
has body: I would expect that these coordinates would refer to the JPanel where the rectangle is actually painted. They do refer to the JPanel, not the frame. Why do you think they refer to the frame? Post your SSCCE that demonstrates the problem.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/20722217
type: Answer
has body: System.out is instance of PrintStream So your question narrows down to PrintStream vs PrintWriter All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. (Syso writes out directly to system output/console) The PrintWriter class should be used in situations that require writing characters rather than bytes.
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/20722120

http://stackoverflow.com/q/20754098
has comment: http://stackoverflow.com/comment/31102198
linked to: http://stackoverflow.com/q/3420311
has answer: http://stackoverflow.com/a/20754219
has title: problems adding arrays of jbutton and jlabel into arrays of jpanel unto a frame
tagged with: swing
has comment: http://stackoverflow.com/comment/31102347
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20754219
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31102330
has comment: http://stackoverflow.com/comment/31102175
answer count: 1
tagged with: arrays
has body: i want to add 10 jlabel and 10 jbutton unto each jpanel. Now there are 10 jpanels which i want to add to a frame, so the jframe should show 100 jlabel, 100 jbutton with 10 jpanels. My problem is that the frame only shows 10 jlabel and 10 jbutton. i dunno where am wrong. here is my code public class MultiPanel extends JFrame { private JPanel[] panel; private JLabel[] label; private JButton[] button; public MultiPanel() { panel = new JPanel[10]; label = new JLabel[10]; button = new JButton[10]; for (int i = 0; i &lt; label.length; i++) { label[i] = new JLabel(String.valueOf(i + 1)); button[i] = new JButton("B"); label[i].setSize(50, 50); panel[i] = new JPanel(); panel[i].setLayout(new FlowLayout(FlowLayout.CENTER)); panel[i].add(label[i]); panel[i].add(button[i]); add(panel[i]); } setLayout(new GridLayout(1, 10)); setSize(720, 560); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { MultiPanel m_pnl = new MultiPanel(); } }
has comment: http://stackoverflow.com/comment/31102189

http://stackoverflow.com/comment/31222191
type: QuestionComment
type: Comment
score: 0
has text: As `frameSize` is meant to be `long` then i highly doubt you are doing the right thing by creating a byte array here with a large size like this. In fact narrowing conversion by casting long to int might easily result in faults in your application life-cycle. What are you going to do with this byte array ?
comment on: http://stackoverflow.com/q/20820983

http://stackoverflow.com/a/21014820
type: Answer
has body: From what has been looked into further - it does appear to be an issue with the threads. Earlier arrays were created (with the understanding that they would be part of stack memory however they are very much a part of the heap). The Heap. Without the array, the issue is reproducible on JDK 1.5.14. However it is not with JDK 1.6.37. The use of thread pools likely masked the issue leading to the above mentioned gc sample. Update #1: A plausible solution for 1.5 as determined is to include '-XX:NewSize' in the parameters (the eden does not reduce below that) however it is not known if this will resolve the issue (memory reclaimed but not accounted for) or if there will be out of memory issues (memory not reclaimed) Additional links: https : //bugs.openjdk.java.net/browse/JDK-7118202 (Relates to JDK-7 : for possible explanations so as to what can cause it) https : //www.java.net//node/662483
score: 0
answers question: http://stackoverflow.com/q/20684266

http://stackoverflow.com/comment/30988464
has text: What error is it? Post the logcat please.
score: 0
comment on: http://stackoverflow.com/q/20691403
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31259517
has text: What is the size of the array that you're working with?
comment on: http://stackoverflow.com/q/20841300
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/45391145
has body: you can also use bitwise shift operators (number >> 1)&lt;&lt;1 == number then even else odd
type: Answer
answers question: http://stackoverflow.com/q/20705184
score: 0

http://stackoverflow.com/q/20776319
tagged with: android
accepted answer: http://stackoverflow.com/a/20776378
score: 2
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/20776397
has answer: http://stackoverflow.com/a/20776397
type: Question
has title: String array and string
has comment: http://stackoverflow.com/comment/31141279
has comment: http://stackoverflow.com/comment/31141542
tagged with: java
has comment: http://stackoverflow.com/comment/31141273
has answer: http://stackoverflow.com/a/20776378
tagged with: split
answer count: 2
has body: i'm working on a program for my class but now i have a problem with spliting string and substrings. I have saved data from different classes in a string with a delimiter for later a later split(/). This part works fine and i get all the strings as i should saved in a new String array. Later i tried to toast them in a for loop (String word: String array) and everything seemed fine. But i have a problem with cutting the substring from word. I would like to get the number (between '-' and 'k') but it always throws a String out of index error and i don't know why. When i tried to toast the position of the strings where i would like to take the substring, it shows them fine but when i try to substring with them it throws an error again. The Error "java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.uiuracun/com.example.uiuracun.Bill}: java.lang.StringIndexOutOfBoundsException: length=29; regionStart=22; regionLength=-18" The Code package com.example.uiuracun; import android.R.anim; import android.app.Activity; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class Bill extends ListActivity { // Removed extra code private void split(String[] string) { for (String word:string){ word.trim(); int start = 0; int end = 0; start = word.indexOf('-'); end = word.indexOf('k'); String c = word.substring(start, end); } } }
tagged with: arrays
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/31141306
favorite count: 0

http://stackoverflow.com/a/20720047
accepted answer of: http://stackoverflow.com/q/20719774
has body: You'll probably want a separate Thread to move the ball which keeps track of time while in a in a loop - that way if frame rates drop, or speed up, you can try ensure consistency in the ball movement speed. e.g. here on using a thread in a applet http://www.realapplets.com/tutorial/threadexample.html
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31040177
answers question: http://stackoverflow.com/q/20719774
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31040234

http://stackoverflow.com/comment/31063721
comment on: http://stackoverflow.com/q/20726764
score: 1
type: QuestionComment
has text: You could use a FileLock: exclusive lock for writing, and shared lock for reading.
type: Comment

http://stackoverflow.com/q/20825068
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20825122
has title: Saving data from scanner to string multidimensional array
answer count: 1
score: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has body: I need to save data such as name, surname, etc... from different clients, and then to have a possibility to choose one of them and view all his data. I tried with multidimensional array (using loop), but its not working. Here is the code I tried: void objectsMaking(){ TeleAddressData teleAddressData = new TeleAddressData(); for(int i=0; i&lt;teleAddressData.tableOfNames.length; i++){ System.out.println(teleAddressData.tableOfNames[i]); String[] list = new String[howManyClients]; Scanner scanner1 = new Scanner(System.in); teleAddressData.tablicaDanych[howManyClients-1][i] = scanner1.nextLine(); } I made an object of TeleAddressData class, because there is an array with names such as name, surname ect. So loop "for" takes those names. teleAddressData.tablicaDanych[howManyClients-1][i] = scanner1.nextLine(); this part should store scanner lines in certain array's cells but I think it is not working. Any ideas?

http://stackoverflow.com/comment/31341518
type: Comment
comment on: http://stackoverflow.com/a/20817029
type: AnswerComment
score: 0
has text: If there is a lot of data, the second method. If the data is not much, one DB call to fetch all the data would be better. In that case, the population of the drop downs would be quicker.

http://stackoverflow.com/comment/31100471
has text: @NaftuliTzviKay . . . Don't store user requests as explicit SQL. Store them as lists of things to do that your application will convert to SQL.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20753143

http://stackoverflow.com/a/20690794
type: Answer
has body: Just add input.nextLine(): if (input.hasNextInt()) { itemAmount = itemAmount + input.nextInt(); input.nextLine(); } From the documentation: nextLine advances the scanner past the current line and returns the input that was skipped. This method returns the rest of the current line, excluding any line separator at the end. The position is set to the beginning of the next line. Another approach would be parsing each line and taking the third column. BufferedReader r = new BufferedReader(new FileReader(filename)); while (true) { String line = r.readLine(); if (line==null) break; String cols[] line.split("\\s+"); itemAmount += Integer.parseInt(cols[2]); } r.close();
answers question: http://stackoverflow.com/q/20690650
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/20690650
has comment: http://stackoverflow.com/comment/30987771
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20825684
tagged with: data-structures
has body: I have two copies of data, here 1 represents my volumes and 2 represent my issues. I have to compare COPY2 with COPY1 and find all the elements which are missing in COPY2 (COPY1 will always be a superset and COPY2 can be equal or will always be a subset). Now, I have to get the missing volume and the issue in COPY2. Such that from the following figure(scenario) I get the result as : - Missing files – 1-C, 1-D, 2-C, 2-C, 3-A, 3-B, 4,E. Question- What data structure should I use to store the above values (volume and issue) in java? How should I implement this scenario in java in the most efficient manner to find the difference between these 2 copies?
has answer: http://stackoverflow.com/a/20825724
has answer: http://stackoverflow.com/a/20825756
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/20835877
favorite count: 0
has answer: http://stackoverflow.com/a/20835877
accepted answer: http://stackoverflow.com/a/20825756
upvote count: 1
has comment: http://stackoverflow.com/comment/31230749
has title: Efficient way to find the difference between two data sets
tagged with: collections
type: AnsweredQuestion
tagged with: guava
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/q/20774930
answer count: 2
tagged with: jpa
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/20775032
favorite count: 0
has body: My use case are two entities in 1..N relationship, let's say Box and Items in Box. Box has an attribute "capacity" which specify how much Items I can have in Box. What I'm actually doing. I select count of all Items in Box and when the number of Items is less than the Box.capacity I persist the Item. Problem is when I access my method concurrently. Calling method twice in a same time will cause that both reads can be run concurrently and when it comes for write phase, both thread write the Item into database. My code: @Entity public class Box { private int capacity; } @Entity public class Item { @ManyToOne Box box; } @Stateless public class BoxManager { @PersistenceContext EntityManager em; public Item persistItem(Item item) { Box box = item.getBox(); Query query = em.createQuery("SELECT COUNT(i) FROM Item i WHERE i.box = :box"); query.setParameter("box", box); int itemCount = ((Number)typedQuery.getSingleResult()).intValue(); // We can simulate concurrent problem putting Thread.sleep() here. if (itemCount &lt; box.getCapacity()) { return em.persist(item); } else { return null; } } } I'm calling method persistItem concurrently. The question is how can I prevent another thread to read the incorrect number of Items before the first thread persist the first Item? Problematic scenario is: Thread 1: Reads count of items Thread 2: Reads count of items Thread 1: Writes Item to database Thread 2: Also Writes Item to database Or is there any better way how to handle this? How to check count of entity and persist it without the concurrency problems?
type: AnsweredQuestion
has title: JPA: Read and persist in one transaction while blocking Read in different thread
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/20775032
upvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20774986
tagged with: transactions
tagged with: java
possible better answer: http://stackoverflow.com/a/20774986

http://stackoverflow.com/q/20794740
tagged with: android
has body: I need to convert memo file(text) to pdf in my android application. I went through few tutorials related to iText, but all of them added content to the pdf in their code. But what I need is convert the memo file exact as it is. Can I do this using iText or is their any other way to do this?
answer count: 1
has answer: http://stackoverflow.com/a/20795243
has title: Convert memo (text) file into pdf file in android
type: UnansweredQuestion
tagged with: java
tagged with: itext
linked to: http://stackoverflow.com/q/2499960
type: Question
has comment: http://stackoverflow.com/comment/31174548
has comment: http://stackoverflow.com/comment/31175511
score: 0

http://stackoverflow.com/a/20733133
has comment: http://stackoverflow.com/comment/31067612
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20733097
has comment: http://stackoverflow.com/comment/31064878
has comment: http://stackoverflow.com/comment/31064164
answers question: http://stackoverflow.com/q/20733097
has comment: http://stackoverflow.com/comment/31064297
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31064270
has body: Wrap this code in a function, which will get the data from input, create a new user and return it: public User getUser() { Scanner input = new Scanner(System.in); User user = new User(); System.out.println("Name:"); String name = input.next(); System.out.println("Age"); int age = input.nextInt(); System.out.println("Sex"); double sex= input.next(); System.out.println("Location:"); String location= input.next(); System.out.println("Subscribe:"); boolean subscribe= input.nextBoolean(); user.set(name, age, sex, location); // user object would hold this information user.set(subscribe); return user; } Then you can use it: you can use array of objects User[] users = new User[5]; then you can loop: for (int i=0; i&lt;5; i++) { users[i] = getUser(); } you can use ArrayList of objects List&lt;User&gt; list = new ArrayList&lt;User&gt;(); for (int i=0; i&lt;5; i++) { list.add(getUser()); }

http://stackoverflow.com/q/20803265
favorite count: 0
tagged with: worklight-adapters
type: UnansweredQuestion
has title: IBM Worklight 6.1 - "Ecma Error: TypeError: Cannot call property <function> in object"
has comment: http://stackoverflow.com/comment/31233753
tagged with: ibm-mobilefirst
has body: I'm trying to run the Java in Worklight Adapters example from the worklightadapterproject smaple project, but I am facing an error when trying to invoke a procedure: { "errors": [ "Ecma Error: TypeError: Cannot call property addTwoIntegers in object [JavaPackage com.worklight.customcode.Calculator1]. It is not a function, it is \"object\". (C%3A%5CWorklightLab%5Cworkspace%5CWorklightAdaptersProject%5Cadapters%5CCalculatorAdapter\/CalculatorAdapter-impl.js#9)" ], "info": [ ], "isSuccessful": false, "warnings": [ ] } How do I resolve this? I tried setting this by using the following configuration which didn't work:
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20803542
linked to: http://stackoverflow.com/q/15826456
linked to: http://stackoverflow.com/q/16614742
has comment: http://stackoverflow.com/comment/31223819
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31070781
type: Comment
type: QuestionComment
score: 0
has text: The current question do not contain enough detail. What is `rtfToHtml`? Jsoup convert all as expect, but your problem is in rtfToHtml function. Is it [this](http://www.codeproject.com/Tips/136483/Java-How-to-convert-RTF-into-HTML)?
comment on: http://stackoverflow.com/q/20699446

http://stackoverflow.com/q/20782488
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20782799
has answer: http://stackoverflow.com/a/20782571
type: Question
has answer: http://stackoverflow.com/a/20782709
tagged with: java
possible better answer: http://stackoverflow.com/a/20782709
score: 0
accepted answer: http://stackoverflow.com/a/20782799
has body: I am trying to launch DataPicker on click of the edit text What am i trying to do:: there are tow edit text I want to launch datepicker from both edit text What i have done :: I have tried to do this I have taken one of the edittext as sample Problem:: date picker is not launching when i click on edittext no errors in logcat MainActivity.java public class MainActivity extends FragmentActivity { EditText edt; EditText edt2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); edt=(EditText)findViewById(R.id.editText1); edt2=(EditText)findViewById(R.id.editText2); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Calendar c = Calendar.getInstance(); Calendar c1=Calendar.getInstance(); c1.setTime(new Date()); c.setTime(new Date()); // Now use today date. c.add(Calendar.DATE, 7); // Adding 7 days String ToDate = sdf.format(c.getTime()); String FromDate = sdf.format(c1.getTime()); edt2.setText(FromDate); edt.setText(ToDate); } public void selectDate(View view) { DialogFragment newFragment = new SelectDateFragment(); newFragment.show(getSupportFragmentManager(), "DatePicker"); } public void populateSetDate(int year, int month, int day) { edt2 = (EditText)findViewById(R.id.editText1); edt2.setText(day+"/"+month+"/"+year); } public class SelectDateFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Calendar calendar = Calendar.getInstance(); int yy = calendar.get(Calendar.YEAR); int mm = calendar.get(Calendar.MONTH); int dd = calendar.get(Calendar.DAY_OF_MONTH); return new DatePickerDialog(getActivity(), this, yy, mm, dd); } public void onDateSet(DatePicker view, int yy, int mm, int dd) { populateSetDate(yy, dd, mm+1); } } }
has title: simple datpicker for the android
answer count: 3
tagged with: android
tagged with: datepicker

http://stackoverflow.com/a/20704696
has body: You seem to be using JPQL, that is Java Persistence Query Language. MySQL and JPQL (or Hibernate) are completely different query languages and each of them has their own specific syntax. The LIMIT construct is available only in MySQL and it is not part of any SQL standard. The functionality in JPA is simulated by setting maximum number of results on the query object. So instead of LIMIT 1 you should use query.setMaxResults(1);
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20704589
score: 5
accepted answer of: http://stackoverflow.com/q/20704589
type: AcceptedAnswer

http://stackoverflow.com/a/20817798
accepted answer of: http://stackoverflow.com/q/20817707
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20817707
has body: is will be null if an exception occurs in the middle of that try, but your finally will be called and tried to close it
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/a/20732277
upvote count: 1
has body: Well, this is not included in theme #b0b0ff Should be so: #b0b0ff Also, if you set your theme for application, then you don't need to set it also for activities. Unless different activities have a different theme (so, you specify a different theme only on those ones)
type: Answer
answers question: http://stackoverflow.com/q/20732138
has comment: http://stackoverflow.com/comment/31062710
downvote count: 0
score: 1

http://stackoverflow.com/comment/31173504
comment on: http://stackoverflow.com/q/20794401
has text: Have the method return an array?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20690345
has comment: http://stackoverflow.com/comment/30986515
answer count: 1
has comment: http://stackoverflow.com/comment/30986708
accepted answer: http://stackoverflow.com/a/20690729
favorite count: 0
has comment: http://stackoverflow.com/comment/30986642
has comment: http://stackoverflow.com/comment/30986570
has comment: http://stackoverflow.com/comment/30986869
has comment: http://stackoverflow.com/comment/30986852
type: AnsweredQuestion
tagged with: java
has body: This code is not done yet, but I'm keep getting the problem where the txt file (cpu.txt) becomes "null" in the output, does anyone know where I did wrong? Thanks. This is the output: --------------------Configuration: -------------------- BINGO CALL IS: G50 PLAYER CARDS: B I N G O B I N G O 1 21 38 58 68 5 29 31 51 73 15 20 F 59 67 4 30 39 53 74 11 28 33 48 69 7 30 32 49 69 8 27 35 58 63 3 17 F 57 68 11 18 45 52 71 12 16 33 54 70 CPU CARDS: B I N G O B I N G O null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null B 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 I 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 N 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 G 46 47 48 49 * 51 52 53 54 55 56 57 58 59 60 O 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 current points available: 0 point. 1. Daub board 2. Call Bingo! 3. Use bonus (1000 points) 4. Next call import java.util.Random; import java.io.*; import java.util.Scanner; public class Bingo_D { public static void callBoard(int[] un, int turns) { int t = 1; int i = 1; int[] bingo = new int[76]; System.out.print("B" + "\t"); String star= "nothing"; for ( i=1; i &lt; bingo.length; i++){ bingo[i] = i; for (t = 1; t &lt; un.length; t++){ if(un[t] == bingo[i]){ //un = call, bingo = board star = Integer.toString(bingo[i]); star = "*"; System.out.print(star + "\t"); break; } else if (t == i){ System.out.print(bingo[i] + "\t"); } } if (bingo[i] % 15 == 0 ){ System.out.println(); } if (bingo[i] == 15) { System.out.print("I" + "\t"); } if (bingo[i] == 30) { System.out.print("N" + "\t"); } if (bingo[i] == 45) { System.out.print("G" + "\t"); } if (bingo[i] == 60) { System.out.print("O" + "\t"); } } } public static String randomCall(){ Random object = new Random(); int number = 1+object.nextInt(75); if (number &gt; 0 &amp;&amp; number &lt; 16 ){ System.out…
tagged with: formatting
downvote count: 1
type: Question
has title: Imported txt file in java, but came out in output as "null"
tagged with: null
upvote count: 0
tagged with: jcreator
score: -1
has answer: http://stackoverflow.com/a/20690729

http://stackoverflow.com/q/20839177
type: Question
has answer: http://stackoverflow.com/a/20839314
has title: how to get value on TextField Java Swing
possible better answer: http://stackoverflow.com/a/20839305
has answer: http://stackoverflow.com/a/20839385
score: 9
has answer: http://stackoverflow.com/a/20839305
answer count: 3
tagged with: swing
tagged with: jtextfield
accepted answer: http://stackoverflow.com/a/20839385
linked to: http://stackoverflow.com/q/17874717
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/31255505
linked to: http://stackoverflow.com/q/5621338
has body: I have a simple Java Swing form with a JTextField, I get value on JTextField by getText() method but I can't use it to main program. Can you help me What problem and how to fix? This is my code : import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Login { private String name; public Login() { JFrame main = new JFrame("LOGIN"); main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main.setResizable(false); main.setLayout(null); main.setPreferredSize(new Dimension(200, 300)); main.setLocation(400, 200); // Heading: LOGIN JLabel heading = new JLabel("LOGIN"); heading.setBounds(80, 20, 50, 20); main.add(heading); // Label Username JLabel username_label = new JLabel("username: "); username_label.setBounds(5, 70, 80, 20); main.add(username_label); // Textfield Username final JTextField username_field = new JTextField(); username_field.setBounds(70, 70, 120, 20); main.add(username_field); this.name = username_field.getText(); // Button Login JButton loginBtn = new JButton("LOGIN"); loginBtn.setBounds(40, 150, 120, 25); main.add(loginBtn); main.pack(); main.setVisible(true); loginBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { name = username_field.getText(); // System.out.println(name); //IT WORKS } }); } public static void main(String[] args) { Login me = new Login(); me.print();//I EXPECT IT WILL PRINT @name BUT NO, WHY? } public void print() { System.out.println(name); } } Thanks very much!
type: AnsweredQuestion
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/20715874
has body: I have a for loop that subtracts 1 from the coordinates of the map Would suggest that you blocking the event dispatching thread, which is responsible for processing paint requests AND key event (amongst other things) This means that while the loo in keyPressed is been executed, nothing else will be processed, including the repaint request. Before you comment that you are painting the component from a separate thread, you're not, actually. What happens is you make a paint request to the RepaintManager, which places a repaint request into the event queue, which is then processed by the Event Dispatching Thread What I suggest you do, is raise some kind of flag in keyPressed event method. You would, then monitor for this flag in the game thread and update the state of the map on each iteration of the thread loop until the end state is meet and/or some kind of event changes the state of the flag, for example... You might like to take. Look at Painting in AWT and Swing and Concurrency in Swing for more details And while I'm here, I would encourage you to use key bindings over KeyListener as it has better control over the focus requirements
has comment: http://stackoverflow.com/comment/31102991
has comment: http://stackoverflow.com/comment/31103007
has comment: http://stackoverflow.com/comment/31047182
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20715733
has comment: http://stackoverflow.com/comment/31047474
score: 0
has comment: http://stackoverflow.com/comment/31047438
accepted answer of: http://stackoverflow.com/q/20715733
type: Answer

view
tags question: http://stackoverflow.com/q/20799024
tags question: http://stackoverflow.com/q/20686715
tags question: http://stackoverflow.com/q/20709386
tags question: http://stackoverflow.com/q/20778848
tags question: http://stackoverflow.com/q/20729465
tags question: http://stackoverflow.com/q/20679474
tags question: http://stackoverflow.com/q/20766223
type: Tag
tags question: http://stackoverflow.com/q/20827724
tags question: http://stackoverflow.com/q/20763049
tags question: http://stackoverflow.com/q/20786404
tag name: view

http://stackoverflow.com/q/20772676
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/20772736
has answer: http://stackoverflow.com/a/20772871
has comment: http://stackoverflow.com/comment/31134640
accepted answer: http://stackoverflow.com/a/20772871
has comment: http://stackoverflow.com/comment/31134694
tagged with: processbuilder
linked to: http://stackoverflow.com/q/11510409
tagged with: exec
has comment: http://stackoverflow.com/comment/31155599
has body: How can I get process state, that is it running or completed. I am creating new process through: processBuilder();
has comment: http://stackoverflow.com/comment/31134661
has answer: http://stackoverflow.com/a/20772736
has title: How to get process state?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31074419
comment on: http://stackoverflow.com/a/20738886
has text: well let me reframe the question again then. wait for a while plz.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31187300
type: Comment
has text: What do you mean with scope? And why do you want to create a custom login module? You simply can control the the authentication and authorization within the deployment descriptor file, called web.xml
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20802219

http://stackoverflow.com/comment/31048424
type: Comment
has text: ouais, merci bien. When I do that, which is correct, it asks me to implement all the abstract methods, yes, I am familiar with it, but it rolls them out on the GUI file and I should not have the code of action performed there, I have it on the other file. How do I solve that?
comment on: http://stackoverflow.com/a/20724503
type: AnswerComment
score: 0

http://stackoverflow.com/q/20749009
has answer: http://stackoverflow.com/a/20749086
score: 5
tagged with: android
tagged with: settings
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20749086
upvote count: 5
has body: I'm trying to add a settings fragment to my android-app. So, I added a xml-file and this activity: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Display the fragment as the main content. getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public static class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); } } } It's being called from the onOptionsItemSelected function in the main activity: if (id == R.id.action_settings) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); return true; } So, now, when I try to open the activity from the menu, it force-closes and I get this error in the console: Force-removing child win Window{4190a9a8 u0 PopupWindow:418fc208} from container Window{418dd448 u0 org.name.app/org.name.app.MainActivity} Failed looking up window java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@423b1fc0 does not exist at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7934) at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7925) at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1047) at android.os.BinderProxy.sendDeathNotice(Binder.java:493) at dalvik.system.NativeStart.run(Native Method)
possible better answer: http://stackoverflow.com/a/22207295
answer count: 2
has answer: http://stackoverflow.com/a/22207295
has title: Android Settings Fragment
downvote count: 0
tagged with: android-activity
favorite count: 0
tagged with: preferences

http://stackoverflow.com/comment/31117570
score: 0
has text: Jorge_B i added a root cause in the question
type: Comment
comment on: http://stackoverflow.com/a/20762784
type: AnswerComment

http://stackoverflow.com/q/20716993
has answer: http://stackoverflow.com/a/20717069
accepted answer: http://stackoverflow.com/a/20717069
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/20717318
tagged with: sockets
has title: Why does my Java client/server app hang when using ObjectInputStream but doesn't when I use BufferedReader with InputStreamReader?
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20717318
has body: I am wondering why it gets stuck on the following line, but it didn't used to get stuck when I was using a BufferedReader with an InputStreamReader: input = new ObjectInputStream(socket.getInputStream()); Here is my client code: import java.awt.BorderLayout; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.net.Socket; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class MtgTestRunsClient { private JFrame frame = new JFrame("MTG Test Runs"); private static int PORT = 8901; private Socket socket; //private BufferedReader inFromServer; //private PrintWriter outToServer; private ObjectInputStream inFromServer; private ObjectOutputStream outToServer; private Planeswalker planeswalker; public MtgTestRunsClient(String serverAddress) throws Exception { // Setup networking socket = new Socket(serverAddress, PORT); //inFromServer = new BufferedReader(new InputStreamReader(socket.getInputStream())); //outToServer = new PrintWriter(socket.getOutputStream(), true); inFromServer = new ObjectInputStream(socket.getInputStream()); outToServer = new ObjectOutputStream(socket.getOutputStream()); planeswalker = new BUGDelverPlaneswalker(); planeswalker.setOutputToServer(outToServer); // Frame content JPanel contentPane = new JPanel(new BorderLayout()); frame.setContentPane(contentPane); frame.getContentPane().add(planeswalker.getStatusBar(), BorderLayout.SOUTH); frame.getContentPane().add(planeswalker, BorderLayout.CENTER); } public void play() throws Exception { //String response; Object response; try { //response = inFromServer.readLine(); response = inFromServer.readObject(); if (response instanceof String ){ if( ((String)response).startsWith("WELCOME")) { char mark = ((String)response).charAt(8); frame.setTitle("MTG Test Runs - Player " + mark); } } while (true) { //response = inFromServer.readLine(); response = i…

http://stackoverflow.com/a/20782665
has body: My guess is that it was a code convention in the project, because in this case due to memory alignment making it byte would save 8 bytes on x64 architecture. The rationale behind this could be that in future versions this field could be used to store other thread state information.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20782301

http://stackoverflow.com/a/20730775
downvote count: 0
score: 1
has body: You can use int min = 1; int max = 4; Random r = new Random(); int i = r.nextInt(max - min + 1) + min; switch(i) { case 0: // .. code break; case 1: // .. code break; case 2: // .. code break; case 3: // .. code break; }
upvote count: 1
answers question: http://stackoverflow.com/q/20730651
type: Answer

http://stackoverflow.com/comment/31128345
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20768738
score: 1
has text: You'll need to sit down and read a book (or at least watch some videos). I recommend Test Driven Development: By Example by Kent Beck.

http://stackoverflow.com/a/20722491
score: 1
has body: Because ... you're submitting your Callable to the pool, then explicitly blocking the thread waiting for it to finish. ArrayList&lt;Notizia&gt; notizie = task.get(); I missed the Android tag on your Q. You're re-inventing the wheel here. Android provides AsyncTask for exactly this use case. See the AsyncTask example under Processes and Threads for an example of how it works. (original answer follows) You need your Callable to update/notify the UI when it's finished. One possible approach would be to pass a reference to the list you mention to your Callable. Edit to add from comments: Right now, you submit your Callable to the pool. Then you sit there waiting for it to finish (blocking the UI thread). Then you do this: lvListaNotizie.setAdapter(new RiempiLista(activity, notizie)); Pass lvListaNotizie to your GetListaNotizie via a constructor and have that happen at the end of call() instead of returning the list to the Future. I don't know what lvListaNotizie is; if it's not thread-safe you will want to synchronize on it.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31044479
type: Answer
accepted answer of: http://stackoverflow.com/q/20722398
upvote count: 1
answers question: http://stackoverflow.com/q/20722398

http://stackoverflow.com/a/20749032
type: Answer
accepted answer of: http://stackoverflow.com/q/20749005
answers question: http://stackoverflow.com/q/20749005
has comment: http://stackoverflow.com/comment/31092562
upvote count: 3
has body: Because you've defined it as static. private static float value = 0; So the two instances share it.
score: 3
has comment: http://stackoverflow.com/comment/31092536
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31110371
comment on: http://stackoverflow.com/a/20758850
type: AnswerComment
has text: @ShadyAhmed You didn't say that. Can you add those details to the question?
score: 0
type: Comment

http://stackoverflow.com/comment/31175673
type: AnswerComment
type: Comment
has text: Thanks for the reply Vineet. Do you know any other alternative to track behaviour of the user whom we track on the competitor website.
comment on: http://stackoverflow.com/a/20795610
score: 0

http://stackoverflow.com/comment/34691684
comment on: http://stackoverflow.com/a/20773463
type: AnswerComment
type: Comment
has text: Where can you get a list of all of those configurations and properties, using the same method?
score: 1

http://stackoverflow.com/a/20724569
downvote count: 0
has comment: http://stackoverflow.com/comment/31049537
answers question: http://stackoverflow.com/q/20724441
has comment: http://stackoverflow.com/comment/31048584
accepted answer of: http://stackoverflow.com/q/20724441
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31050038
type: Answer
has comment: http://stackoverflow.com/comment/31048634
has comment: http://stackoverflow.com/comment/31049590
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/31049172
has body: Don't: Use Thread.sleep() in a painting method. This will block the Event Dispatch Thread and prevent Swing from responding to events Invoke repaint() from within a painting() method. This will cause an infinite loop Override paint() for custom painting. Custom Painting is done by overriding the paintComponent(...) method of a JPanel (or JComponent). Then you add the panel to the applet. Do: Use a Swing Timer to schedule animation.

http://stackoverflow.com/comment/31048528
comment on: http://stackoverflow.com/q/20724477
score: 0
type: Comment
type: QuestionComment
has text: Seems about right for me.

http://stackoverflow.com/comment/31184521
score: 0
comment on: http://stackoverflow.com/q/20770048
type: Comment
type: QuestionComment
has text: My test used multithreading classes which caused that error. See http://stackoverflow.com/questions/12159/how-should-i-unit-test-threaded-code

http://stackoverflow.com/q/20721787
type: Question
accepted answer: http://stackoverflow.com/a/20721979
has comment: http://stackoverflow.com/comment/31043345
answer count: 1
score: -1
tagged with: http://stackoverflow.com/tag/html
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/31043526
has title: Why doesn't my HTML script for my applet work?
has comment: http://stackoverflow.com/comment/31043470
has answer: http://stackoverflow.com/a/20721979
downvote count: 2
has comment: http://stackoverflow.com/comment/31043041
upvote count: 1
type: AnsweredQuestion
tagged with: java
has body: Here's my HTML script: &lt;Applet Code="click.class" width=100% Height=100%&gt; &lt;/Applet&gt; And here's my class public class click extends Applet { private static final long serialVersionUID = 1L; Button increase, decrease; // These are two buttons int value = 0; public void init() { increase = new Button("Increase f***s"); add(increase); decrease = new Button("Decrease f***s"); add(decrease); } public boolean action(Event e, Object args) { if (e.target == increase) value++; if (e.target == decrease) value--; if (value &gt; 5) { } repaint(); return true; } public void paint(Graphics g) { g.drawString("How many f***s do you give? " + value, 50, 80); } } It gives me an error saying wrong name or something, googled it and found out I had to change the dir, but to what? I'm stuck on this any help would be grateful, thanks in advance. Java Plug-in 10.45.2.18 Using JRE version 1.7.0_45-b18 Java HotSpot(TM) Client VM User home directory = C:\Users\Sharkgaming c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to CacheEntry[http://shuleii.dk/Click/click.class]: updateAvailable=true,lastModified=Sat Dec 21 18:25:00 CET 2013,length=1443

http://stackoverflow.com/comment/30984894
has text: You don't have to worry about that. All movements that are passed to this method will either be straight or diagonal. The only piece that can move in a line that is not straight or diagonal is the Knight, and I do not call this method when moving the Knight.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20688398
score: 0

http://stackoverflow.com/a/20754354
has body: The Timezone javadoc explains: Three-letter time zone IDs For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them. The problem is that you're assuming that time zone abbreviations consistently designate a particular timezone. "IST" is ambiguous : Indian standard time / Irish standard time / Israeli standard time. Similarly, "EST" can mean Eastern US standard time or Eastern Australian standard time. Joda-time's timezone list shows the unambiguous Olson names and the present timezone offset. You would be better off using Joda-time instead of java.util classes, and using the Olson names to identify timezones. Should I use Java date and time classes or go with a 3rd party library like Joda Time? discusses the reasons why many choose to use Joda-time.
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/31102647
downvote count: 0
has comment: http://stackoverflow.com/comment/31102595
has comment: http://stackoverflow.com/comment/31102600
answers question: http://stackoverflow.com/q/20754288
has comment: http://stackoverflow.com/comment/31102784
score: 5
has comment: http://stackoverflow.com/comment/31102590
has comment: http://stackoverflow.com/comment/31102632

http://stackoverflow.com/comment/31155595
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20784755
has text: simply comment this line Logger.getRootLogger().addAppender(console);
score: 0

http://stackoverflow.com/a/20723120
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20723078
type: Answer
accepted answer of: http://stackoverflow.com/q/20723078
has comment: http://stackoverflow.com/comment/31045808
has body: An Integer in Java is immutable. You can not change its value. In addition, it's a special autoboxing type to provide an Object wrapper for the int primitive. In your code, for example, x++ does not modify the Integer object x is referencing. It un-autoboxes it to a primitive int, post-increments it, re-autoboxes it returning a new Integer object and assigns that Integer to x. Edit to add for completeness: Autoboxing is one of those special things in Java that can cause confusion. There's even more going on behind the scenes when talking about memory / objects. The Integer type also implements the flyweight pattern when autoboxing. Values from -128 to 127 are cached. You should always use the .equals() method when comparing Integer objects. Integer x = 5; Integer y = 5; if (x == y) // == compares the *reference (pointer) value* not the contained int value { System.out.println("They point to the same object"); } x = 500; y = 500; if (x != y) { System.out.println("They don't point to the same object"); if (x.equals(y)) // Compares the contained int value { System.out.println("But they have the same value!"); } } See: Why aren&#39;t Integers cached in Java? for more info (and of course the JLS)
has comment: http://stackoverflow.com/comment/31050765
has comment: http://stackoverflow.com/comment/31045772
has comment: http://stackoverflow.com/comment/31045747
upvote count: 5
has comment: http://stackoverflow.com/comment/31050771
score: 5

http://stackoverflow.com/comment/31275586
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20842115
has text: I have updated the code where i have started the execute it gets in the process method now but progressbar doesn't update

http://stackoverflow.com/comment/31123253
type: QuestionComment
has text: According stacktrace executorService are going to shutting down while you trying to submit new callable, so exception should be thrown.
comment on: http://stackoverflow.com/q/20765949
score: 0
type: Comment

http://stackoverflow.com/a/20706786
has comment: http://stackoverflow.com/comment/31015887
has comment: http://stackoverflow.com/comment/31015533
has comment: http://stackoverflow.com/comment/31015717
downvote count: 0
answers question: http://stackoverflow.com/q/20706530
type: Answer
score: 1
upvote count: 1
has body: You can (and should) specify the Maven compiler plugin manually in your pom.xml maven-compiler-plugin 3.1 1.7 1.7 I have no idea why Maven 3.0.4 uses such an early Maven compiler plugin version but I don't think it's an Ubuntu specific problem. I don't know a general solution bould it would require local configuration. You want to avoid that because it makes your build platform dependent. The advantage of explicitly specifying this in your pom is that you can just build your project on any other machine without facing the same issue again. If don't want to do this in every project you can use a parent pom. See default maven compiler setting

http://stackoverflow.com/q/20745316
score: 0
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/20745386
has answer: http://stackoverflow.com/a/20745772
has answer: http://stackoverflow.com/a/20745386
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20745435
accepted answer: http://stackoverflow.com/a/20745435
has body: I'd like to gain after onclick button efect similar to default in android, but with own colors Default button is white or light gray When i touch button color is changed for one moment (orange) when release, button's color back to original color (white/light gray) Which method's are using to this effect ? I used onTouchListener() to set touched button color and OnClickListener() to set back original color But when i scroll group button(inner ScrollView) when i touch any button, color changed but when release button color ofc not change back. Which method should i use ? How can i fix that ? /////////////////// I created colors in values and define 2 colors <?xml version="1.0" encoding="utf-8"?> #ffffff #004080 I create new folder color and button_state.xml inner this folder <?xml version="1.0" encoding="utf-8"?> <item android:state_focused="true" android:state_pressed="false" android:drawable="@color/blue" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@color/white" /> to my button i assign code in xml file android:background="@color/button_states" Now my button have no background, but i don't know why
has title: Default Button's methods

http://stackoverflow.com/a/20799151
score: 0
has body: For CSV read use SuperCSV. Awesome library. You can just do something like below to skip header. listReader = new CsvListReader(new FileReader(CSV_FILENAME), CsvPreference.STANDARD_PREFERENCE); listReader.getHeader(true); http://supercsv.sourceforge.net/examples_reading.html
has comment: http://stackoverflow.com/comment/31181851
answers question: http://stackoverflow.com/q/20798936
type: Answer

http://stackoverflow.com/comment/31158981
comment on: http://stackoverflow.com/q/20785977
type: QuestionComment
score: 0
has text: try to create and using a new xmlhttp object. not the one that you are using for all ajax connections.
type: Comment

http://stackoverflow.com/a/69640816
score: 0
has body: There are two ways to go about this: One is by adding a custom background to the editText using android:background="@drawable/customBackground or by setting the background as transparent android:background="@android:color/transparent" I would suggest to use the first way if you want to further customize your view background instead of just removing it. Custom shape drawables are easy to create and apply to the view through XML or programatically.
answers question: http://stackoverflow.com/q/20811850
type: Answer

http://stackoverflow.com/comment/31064886
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20733487
has text: @SotiriosDelimanolis: No; his VB code is probably wrong.
type: Comment

http://stackoverflow.com/a/20837652
answers question: http://stackoverflow.com/q/20837508
score: 0
has body: The possible reasons include: You are talking to the wrong database server. You are talking to the wrong database. You've misspelled the table or view name. Someone has changed the table name or view. Someone has deleted the table name or view. Due to some configuration issue, application bug or whatever, the server, database, table or whatever name that you are using is different to what you think it is. In short ... the name is wrong.
has comment: http://stackoverflow.com/comment/31256801
type: Answer

http://stackoverflow.com/comment/31114966
type: Comment
comment on: http://stackoverflow.com/a/20761499
has text: calling it from thread
type: AnswerComment
score: 0

http://stackoverflow.com/q/20720417
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has answer: http://stackoverflow.com/a/20724869
answer count: 4
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31040555
type: Question
has comment: http://stackoverflow.com/comment/31048593
has answer: http://stackoverflow.com/a/20720452
has answer: http://stackoverflow.com/a/20720477
has title: How to parse time from date string retrieved from Facebook
linked to: http://stackoverflow.com/q/65908827
tagged with: date
has body: I'm getting these times from Facebook events. E.g: start_time and it's a string like this: 2013-12-21T18:30:00+0100 Now I just want the time, like: 18.30 I tried to do it with this: SimpleDateFormat formatter = new SimpleDateFormat(" EEEE, dd MMMM yyyy", java.util.Locale.getDefault()); Date formatted = null; try { formatted = formatter.parse(p.getStart_time()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } String formattedString = formatted.toString(); txtStart_time.setText(""+formattedString); p.getStart_time() is a String that gives me the date like I said before. If I do this method, I get an error: Unparseable date. Does anybody know a work around?
downvote count: 0
has answer: http://stackoverflow.com/a/75071739

http://stackoverflow.com/comment/31264816
type: QuestionComment
has text: Note: For infos, you can find here the table of operators' precedence in Java : http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
comment on: http://stackoverflow.com/q/20844191
score: 0
type: Comment

http://stackoverflow.com/comment/30970011
type: Comment
has text: g.drawImage(image, 32, 32, 96 , 96, 11, 0, 13, 2, null); == read Oracle tutorial about 2D Graphics - Working with Images before posting an question about here
score: 0
comment on: http://stackoverflow.com/q/20681443
type: QuestionComment

http://stackoverflow.com/comment/31130870
type: QuestionComment
comment on: http://stackoverflow.com/q/20770279
score: 0
has text: yeah @sharonHwk. you got me.
type: Comment

http://stackoverflow.com/q/20684838
has comment: http://stackoverflow.com/comment/31009311
has comment: http://stackoverflow.com/comment/31022935
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/121660263
tagged with: java
has comment: http://stackoverflow.com/comment/30976698
tagged with: udp
has title: Breaking out of UDP socket receive method
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31025424
favorite count: 0
has comment: http://stackoverflow.com/comment/30976609
has comment: http://stackoverflow.com/comment/30975878
has comment: http://stackoverflow.com/comment/31009786
tagged with: android
score: 2
has answer: http://stackoverflow.com/a/20684927
accepted answer: http://stackoverflow.com/a/20684927
upvote count: 2
has body: In a multithreading app i have one thread with: datagramSocket.receive(packet); which waits for the packet - execution is blocked with receive method. Meanwhile some other thread wants to close this "waiting" thread. How can I achieve this? Currently I am just closing the socket which results in SocketException thrown, which as I suppose is not the best idea... Any help?
tagged with: multithreading

http://stackoverflow.com/a/20824666
score: 3
downvote count: 0
has body: check String before set another EditText to empty. if Field1 is empty then why need to change again to ( "" )? so you can check the size of Your String with s.lenght() or any other solution another way that you can check lenght of String is: String sUsername = Field1.getText().toString(); if (!sUsername.matches("")) { // do your job }
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/20824634

http://stackoverflow.com/comment/31018178
type: Comment
has text: Try `/2013`. That would be a limitation of cron I believe.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20707195

http://stackoverflow.com/a/20743565
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/20743401
has body: Avoid \n and other platform dependent values: final String NEW_LINE = System.getProperty("line.separator"); String str = String.format("Hello There %s How are you", NEW_LINE); System.out.println(str);
type: Answer

http://stackoverflow.com/q/20775401
possible better answer: http://stackoverflow.com/a/20775409
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20775409
tagged with: java
has answer: http://stackoverflow.com/a/20775476
type: Question
score: 0
tagged with: hashmap
has answer: http://stackoverflow.com/a/20775434
tagged with: key-value
answer count: 3
has comment: http://stackoverflow.com/comment/31139466
accepted answer: http://stackoverflow.com/a/20775476
has title: How can i return the keys of a specific value in Hashmap?
has body: I have the following entries in my HashMap &lt;key1,value1&gt; &lt;key2,value2&gt; &lt;key3,value2&gt; &lt;key4,value4&gt; &lt;key5,value2&gt; I would like to find all the Keys that contain the value "value2". The answer would be a KeySet containing the following keys: {key2,key3,key4} Is it possible to accomplish that in a HashMap? thanks
has comment: http://stackoverflow.com/comment/31139638

http://stackoverflow.com/q/20694466
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/30994969
tagged with: java
has comment: http://stackoverflow.com/comment/31003649
type: Question
tagged with: inflate
has answer: http://stackoverflow.com/a/20832181
score: 0
has title: Open or inflate the Actionbar menu on longclick only - Android
answer count: 1
tagged with: drop-down-menu
accepted answer: http://stackoverflow.com/a/20832181
tagged with: android
tagged with: android-actionbar
has body: I'm trying to make the actionbar menu (onCreateOptionsMenu) open ONLY on a long-click. How would I achieve this? At the moment I have it working for just a single short press/click using the following code: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // TODO: Only onlongclick should the menu be revealed getMenuInflater().inflate(R.menu.my_menu_id, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_home: open_home(); return true; case R.id.menu_how_to: open_how_to(); return true; case R.id.menu_rate: open_rate(); return true; case R.id.menu_about: open_about(); return true; default: return super.onOptionsItemSelected(item); } } I'd like the menu to ONLY open for a long click (sort of like a hidden/trick feature). I've looked into onLongClickListener but can't get it to work. Thanks for your help! Really appreciate it.

http://stackoverflow.com/a/20696805
has comment: http://stackoverflow.com/comment/30998325
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30998495
type: Answer
has body: holder.elemLayout.setBackgroundResource(Utils.getIntDrawableByName(this.coleccion.get(position).getImagen(), this.mContext)); - this may be reason for out of memory error. You need to load a scaled down(smaller) version of the image into the memory, for attaching it into the grid view. Follow these steps- First decode with inJustDecodeBounds=true to check dimensions of your image final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(&lt;your image&gt;, options);//use appropriate parameters for the method. Calculate inSampleSize options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);//reqWidth and reqHeight are width and height of your grid view cell. Method to calculate sample size public static int calculateInSampleSize( BitmapFactory.Options options, int reqWidth, int reqHeight) { // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height &gt; reqHeight || width &gt; reqWidth) { final int halfHeight = height / 2; final int halfWidth = width / 2; // Calculate the largest inSampleSize value that is a power of 2 and keeps both // height and width larger than the requested height and width. while ((halfHeight / inSampleSize) &gt; reqHeight &amp;&amp; (halfWidth / inSampleSize) &gt; reqWidth) { inSampleSize *= 2; } } return inSampleSize; } Decode your image with inSampleSize set options.inJustDecodeBounds = false; Bitmap scaledBitmap = BitmapFactory.decodeResource(&lt;your image&gt;, options); finally, set this scaledBitmap as the background for your holder.elemLayout. refer this for more details
has comment: http://stackoverflow.com/comment/30998636
answers question: http://stackoverflow.com/q/20695918
accepted answer of: http://stackoverflow.com/q/20695918

http://stackoverflow.com/comment/31205423
has text: am adding break ,but i forgot edit that, even also not working
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20812025
type: Comment

http://stackoverflow.com/a/20719974
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer
has body: Jackcess only supports indexes on Text fields in an Access database when the database is using the "General" sort order (ref: here). According to the related Microsoft Office support page: To reset the sort order for an existing database, select the language you want to use and then run a compact operation on the database. So, for Access 2010 that would presumably mean selecting File &gt; Options from the Access ribbon bar, choosing "General" or "General - Legacy" for the "New database sort order" on the "General" tab, ... ... then performing a "Compact and Repair" on the database. Note: If Windows is using a non-English locale then the procedure described above might not rectify the problem. See this answer for details.
answers question: http://stackoverflow.com/q/20719417
accepted answer of: http://stackoverflow.com/q/20719417
upvote count: 5

http://stackoverflow.com/comment/31135907
type: AnswerComment
has text: Another option will just be to open the project in net beans, then go through the list of errors. Ctrl space on each error should fix the problem by auto complete to the correct name.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20771866

http://stackoverflow.com/a/20691664
has body: You should keep a List of Thread objects and then call join on them... like so, java.util.List&lt;Thread&gt; al = new java.util.ArrayList&lt;Thread&gt;(); for (int i=0; i&lt;30; i++){ Runnable r = new CheckProxy(ip[i], port[i]); Thread t = new Thread(r); al.add(t); t.start(); } // Ensure all of the threads finish before continuing. for (Thread t : al) { t.join(); // or t.interrupt(); }
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20691216
answers question: http://stackoverflow.com/q/20691216
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/20838626
favorite count: 0
accepted answer: http://stackoverflow.com/a/20876808
answer count: 3
has comment: http://stackoverflow.com/comment/31255009
has body: I am using Windows 8 Pro 64 bit, Java 1.6 64 bit. I am trying to start Weblogic with following memory args (setDomainEnv.cmd): set USER_MEM_ARGS=-Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m But i'm getting an error: Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. Those mermory args are required to deploy the app, so i can't lower it (physical mermory installed - 8 GB).
has answer: http://stackoverflow.com/a/33942143
upvote count: 3
linked to: http://stackoverflow.com/q/4401396
possible better answer: http://stackoverflow.com/a/27536115
has comment: http://stackoverflow.com/comment/31254557
has answer: http://stackoverflow.com/a/27536115
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20876808
tagged with: java
has title: Unable to start Weblogic 10.3
type: Question
tagged with: weblogic
downvote count: 0

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/20810210
tags question: http://stackoverflow.com/q/20798334
tags question: http://stackoverflow.com/q/20681192
tags question: http://stackoverflow.com/q/20689718
tags question: http://stackoverflow.com/q/20759129
tags question: http://stackoverflow.com/q/20709720
tags question: http://stackoverflow.com/q/20798899
tags question: http://stackoverflow.com/q/20820548
tags question: http://stackoverflow.com/q/20761229
tags question: http://stackoverflow.com/q/20730757
tags question: http://stackoverflow.com/q/20837084
tags question: http://stackoverflow.com/q/20801506
tags question: http://stackoverflow.com/q/20783941
tags question: http://stackoverflow.com/q/20763172
tags question: http://stackoverflow.com/q/20808941
tags question: http://stackoverflow.com/q/20752717
tags question: http://stackoverflow.com/q/20723749
tags question: http://stackoverflow.com/q/20760969
type: Tag
tags question: http://stackoverflow.com/q/20771444
tags question: http://stackoverflow.com/q/20709447
tags question: http://stackoverflow.com/q/20841855
tags question: http://stackoverflow.com/q/20701793
tags question: http://stackoverflow.com/q/20829590
tags question: http://stackoverflow.com/q/20703576

http://stackoverflow.com/a/21050151
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20747532
has body: An example of a web method using an interface: Web service implementation: @Path("/WS") @WebService public class WebService implements IWebService { @Override @POST @Consumes("application/json") @Produces("application/json") @Path("/Login") public Response Login(JSONObject data) { //stuff here } } Interface: public interface IWebService { @POST @Consumes("application/json") @Produces("application/json") @Path("/Login") public Response Login(JSONObject data); }
accepted answer of: http://stackoverflow.com/q/20747532

http://stackoverflow.com/q/20784364
upvote count: 2
type: UnansweredQuestion
tagged with: etl
has title: How to change value for parameters using reformat component in Clover ETL
type: Question
has answer: http://stackoverflow.com/a/58413439
has body: I am trying to find out a method on how to change the value of a parameter that I have defined and also how to create a new parameter dynamically using REFORMAT component in Clover ETL. I have written small logic in my transform method which reformat component provides: function integer transform() { string myparam1 = getParamValue("MY_PARAM1"); string changeParam = getParamValue("CHANGE_PARAM_VALUE"); if(changeParam =="true"){ myparam1 = myparam1 +"_changed"; } // update the value of parameter MY_PARAM1 // updateParameter("MY_PARAM1", myparam1 ); // create a new parameter // createNewParameter("MY_NEW_PARAM", "some_sample_data"); return OK; } From clover designer I tried to check for available methods but I have not found any relevant method that helps me to provide the feature that I am looking for. I am new to Clover ETL so I am facing difficulty in how to accomplish this, please help me if we can achive this using REFORMAT component or do we need to use a different component?
tagged with: java
has answer: http://stackoverflow.com/a/20805255
answer count: 2
downvote count: 0
favorite count: 0
tagged with: cloveretl
score: 2

http://stackoverflow.com/a/20828694
type: Answer
has comment: http://stackoverflow.com/comment/31236737
has body: This is rather typical Question. Anyhow depending on the language you are using there may be many different choices. Java http://voce.sourceforge.net/ PHP http://www.speechapi.com/ and http://cmusphinx.sourceforge.net/ Basically, the best option for you is to use some online cloud-based API, that will take your .wav input and return you the response in the text. In this way, your API will be accessible from any language and will take a lot of pain out of your code.
has comment: http://stackoverflow.com/comment/69916496
downvote count: 2
has comment: http://stackoverflow.com/comment/31236771
upvote count: 10
has comment: http://stackoverflow.com/comment/64230464
has comment: http://stackoverflow.com/comment/91785841
has comment: http://stackoverflow.com/comment/31236959
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/91785743
accepted answer of: http://stackoverflow.com/q/20828605
score: 8
answers question: http://stackoverflow.com/q/20828605
has comment: http://stackoverflow.com/comment/31237061

http://stackoverflow.com/q/20805121
has comment: http://stackoverflow.com/comment/31212917
has body: i am creating a simple application with validator, but i am getting below Exception: SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public org.springframework.validation.Validator mypack.MyController.validator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'validator' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationCont…
tagged with: java
has title: Spring MVC: Not able to use use validator, getting "Injection of autowired dependencies failed"
type: Question
linked to: http://stackoverflow.com/q/2877262
has comment: http://stackoverflow.com/comment/31192644
score: 0
answer count: 1
tagged with: hibernate-validator
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28301947
tagged with: spring-mvc

http://stackoverflow.com/comment/31143472
score: 0
has text: No. You cannot define a class like that.
comment on: http://stackoverflow.com/q/20777511
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31134877
has text: *"Sorry if the names are confusing.."* Changing them to be 'not confusing' is more productive than apologies..
comment on: http://stackoverflow.com/q/20772811
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31233202
type: Comment
has text: Thanks a lot. I don't know if you'we seen this: "I need to ping different networks with different ping parameters" problem may be mine since it's not exemplified. What I'm trying to say is that I need to have several instances of "PingParams" one instance per network I'm trying to ping, so how do I create these instances? Without DI it would be easy, just create PingParams instances and pass them to the constructor of PingService, again without using DI. Using DI? I don't know how :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20826862

http://stackoverflow.com/a/20781949
answers question: http://stackoverflow.com/q/20781934
has body: If you were to use Spring Inject and the creation of a Bean failed, then the WAR will not be deployed.
has comment: http://stackoverflow.com/comment/31175366
has comment: http://stackoverflow.com/comment/31175434
type: Answer
has comment: http://stackoverflow.com/comment/31151123
has comment: http://stackoverflow.com/comment/31175570
has comment: http://stackoverflow.com/comment/31170559
score: 0
has comment: http://stackoverflow.com/comment/31175548

http://stackoverflow.com/q/20828687
answer count: 3
has comment: http://stackoverflow.com/comment/31236426
has comment: http://stackoverflow.com/comment/31236415
has comment: http://stackoverflow.com/comment/31236379
favorite count: 0
has comment: http://stackoverflow.com/comment/31236442
has comment: http://stackoverflow.com/comment/31236434
has comment: http://stackoverflow.com/comment/31236453
has answer: http://stackoverflow.com/a/20828747
downvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31240222
has answer: http://stackoverflow.com/a/20828756
has comment: http://stackoverflow.com/comment/31236498
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31236467
has title: how to remove digits of number in java?
has body: In the java, how to remove digits of number in an efficient way ? for example, I have 13 digits number, I want to remove the first 3 digits: Some code: long largeNumber = 1234567890123L; long finalNumber = removeFirstDigits(largeNumber, 3); // finalNumber == 4567890123L
has comment: http://stackoverflow.com/comment/31236482
has answer: http://stackoverflow.com/a/20828746
upvote count: 3
score: 0

http://stackoverflow.com/comment/31028999
has text: The problem is that I need text area to support styled text, and JTextArea only supports plain text.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20713821
type: Comment

http://stackoverflow.com/a/20841388
accepted answer of: http://stackoverflow.com/q/20841356
answers question: http://stackoverflow.com/q/20841356
has body: Your onPostExecute() and doInBackground() should be annotated with @override: @Override protected void onPostExecute(Boolean result) { ... Your onPreExecute() can be removed as default implementation does nothing.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/20711789
has comment: http://stackoverflow.com/comment/31024870
score: 0
has answer: http://stackoverflow.com/a/20711802
answer count: 3
has answer: http://stackoverflow.com/a/20711810
has body: public void fillWith(TileEntity tile){ for(int i = 0; i &lt; this.height; i++){//for every x and y value for(int j = 0; j &lt; this.width; j++){ tile.x = j; tile.y = i; this.tiles.add(tile); } } } Okay so the above code is supposed to fill the level with a TileEntity tile. When I print out the x and y coords before the line "this.tiles.add(tile)", each tile has different coords. But when I print out the x and y coords of all of the tiles in the ArrayList "tiles", every single one is (9,9). They are all identical to the very last tile added to the arraylist. Thanks!
tagged with: arraylist
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31024956
has answer: http://stackoverflow.com/a/20711809
has comment: http://stackoverflow.com/comment/31024867
has title: When adding objects to this arraylist, they all become identical
type: Question
tagged with: java

http://stackoverflow.com/a/20798246
answers question: http://stackoverflow.com/q/20797108
type: Answer
score: 1
upvote count: 1
has body: This tutorial could give you a lead on how to mock up a service using JUnit and Mockito. Hope I helped!
downvote count: 0

http://stackoverflow.com/a/20761811
answers question: http://stackoverflow.com/q/20761713
score: 0
has comment: http://stackoverflow.com/comment/31115269
has body: You need to do something like this after executeQuery() rs.next(); String name = rs.getString("type"); if (name.equals("admin")) { AdminHome ah = new AdminHome(); ah.setVisible(true); } else { EmployeeHome eh = new EmployeeHome(); eh.setVisible(true); }
type: Answer
accepted answer of: http://stackoverflow.com/q/20761713
type: AcceptedAnswer

http://stackoverflow.com/a/20780402
has body: I guess you can remove the FILE appender as you don't need it. ${logLocation}/%d{yyyyMMdd}.%i.log Seems like you have not initialize the variable logLocation that is why you are getting file name with "logLocation_IS_UNDEFINED". Declare your file location and use like below. you will get right file name at right location . ${logLocation}/${FILE_NAME}.%d{yyyy-MM-dd}.%i.log
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20778143

http://stackoverflow.com/a/20728077
score: 4
upvote count: 4
downvote count: 0
type: Answer
has body: You can split according to non-characters chars: String str = "That's the code"; String[] splitted = str.split("[\\W]"); For your input, output will be: That s the code
answers question: http://stackoverflow.com/q/20728050

http://stackoverflow.com/a/20836151
answers question: http://stackoverflow.com/q/20834953
score: 0
has body: Maybe too simple, but what about repeat parameters name? http://IP_ADDRESS:8080/test?userId=1&amp;userId=2&amp;userId=3
type: Answer

http://stackoverflow.com/comment/31249074
has text: isn't there a way I can generate unique Id from email or first name or last name or from `combination of other object data members`? @EvgeniyDorofeev
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20835288

http://stackoverflow.com/q/20797011
has title: recvfrom failed: ETIMEDOUT occurs when trying to upload a video
tagged with: java
tagged with: timeout
tagged with: upload
has body: I need to upload Videos from Application to our Server. A strange thing is happening when i am trying to upload a Video taken from Device's Camera. It's working fine for some Videos which was not taken from Camera. For Camera Videos it's just trying to connect to server and after a time it's showing following error. Does anybody have ever faced of such kind of problem. Please share with me if any Solution for this. Thanks in advance. here below is Error and followed by my code. java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out) public String uploadPostCameraVideoPic() { // TODO Auto-generated method stub String responseString = null; String urlServer; urlServer = SERVERContants.URL ; String path = (String) mData.get(0); File f = new File(path); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, SERVERContants.TIMEOUT_MILLISEC); HttpConnectionParams.setSoTimeout(httpParams, SERVERContants.TIMEOUT_MILLISEC); HttpClient httpclient = new DefaultHttpClient(httpParams); try { HttpPost httpost = new HttpPost(urlServer); MultipartEntity entity = new MultipartEntity(); String postType = dc.getPostType(path); entity.addPart("name", new StringBody("videos")); entity.addPart("functionName", new StringBody("uploadFileAndriod")); entity.addPart("filename", new StringBody(path)); entity.addPart(postType, new FileBody(f)); httpost.setEntity(entity); HttpResponse response; response = httpclient.execute(httpost); System.out.println("the Resposne======" + response); responseString = EntityUtils.toString(response.getEntity()); System.out.println("the responseString======" + responseString); } catch (ClientProtocolException e) { // TODO Auto-generated catch block System.out.println("the Exception occurs 1===== " + e.getMessage()); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("the Exception occurs 2===== " + e.getMessage()); } return responseString; }
has comment: http://stackoverflow.com/comment/31178108
score: 0
has comment: http://stackoverflow.com/comment/31178150
tagged with: android
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: video

http://stackoverflow.com/a/20689985
answers question: http://stackoverflow.com/q/20689900
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Use split(" ") to split the String into words (i.e. breaking on spaces). Then iterate over the resulting array of words and build up the reverse by prepending each word to a StringBuilder. public static void main(String[] args) { System.out.println(reverseOrderOfWords("hello world")); } public static String reverseOrderOfWords(String s) { StringBuilder sb = new StringBuilder(); for (String word : s.split(" ")) { sb.insert(0, word + " "); } return sb.toString().trim(); } Produces: world hello
type: Answer
accepted answer of: http://stackoverflow.com/q/20689900

http://stackoverflow.com/a/22784122
accepted answer of: http://stackoverflow.com/q/20684238
has comment: http://stackoverflow.com/comment/86824140
answers question: http://stackoverflow.com/q/20684238
has body: In most cases, wherever you use Credential, you could use StoredCredential. There is only one point you would work with Credential, which is retrieving the Access Token during the OAuth callback. From there the Credential can be converted to StoreCredential and stored into the DataStore. After that storage and retrieval all works with StoredCredential. But there are places were StoredCredential can't be used. I just encountered one trying to create the Google Drive API Service wrapper. There is a way to get around this with the GoogleCredential object, it can be created from StoredCredential as per this answer: Stored Credential from Google API to be reused using Java import com.google.api.client.auth.oauth2.StoredCredential; public static GoogleCredential createGoogleCredential(StoredCredential storedCredential) { GoogleCredential googleCredential = new GoogleCredential.Builder() .setTransport(new NetHttpTransport()) .setJsonFactory(new JacksonFactory()) .setClientSecrets("client_id", "client_secret") .setAccessToken(storedCredential.getAccessToken()) .build(); return googleCredential; }
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/86763937

http://stackoverflow.com/a/20835911
upvote count: 2
has body: I would say that's not the logically correct way of using ENUMs. Enums are not of any specific java types (like int float etc). They are types themselves. For example, say to define bank account types, public enum AccountTYpe { SAVING(1), CHECKING(2); } Now the advantage of using enum is that for a variable of type AccountTYpe there are only two valid assignments namely the SAVING and CHECKING. Anything else would flag a compile error. Your requirement seems to be integer constants for which I would suggest to use set of values defined inside an interface as follows public interface Value { Integer THREE = 3; Integer SIX = 6; Integer NINE = 9; } Since the variables defined inside the interface are public static and final you can use them as constants in your code as desired. int[] myIntArray = new int[Value.THREE];
has comment: http://stackoverflow.com/comment/31249780
type: Answer
answers question: http://stackoverflow.com/q/20835785
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31250645

http://stackoverflow.com/comment/31219604
score: 0
comment on: http://stackoverflow.com/a/20808264
type: Comment
has text: If the Thread is completed that should be ok. But there is a caveat for threads that aren't started. Such thread stores a reference to itself in the global ThreadGroup.
type: AnswerComment

http://stackoverflow.com/comment/31264141
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/20843815
has text: You might want to understand the tokenization concept first http://en.wikipedia.org/wiki/Tokenization Also read Java docs http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html

http://stackoverflow.com/comment/31165137
type: Comment
has text: Whatever you were doing to launch your Activity before your came here :) there, edited
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20789879

http://stackoverflow.com/comment/31218864
type: QuestionComment
comment on: http://stackoverflow.com/q/20816947
score: 0
has text: In JDBC, you should _definitely_ use a `PreparedStatement` with static SQL rather than evaluating something with a string that comes from a user. Otherwise you may let in the demons of sql-injection…
type: Comment

http://stackoverflow.com/comment/31061242
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20723749
has text: @Voo Yeah it is quite complex, its a pretty big assignment, and programming isn't a strong point for me so all this concurrency stuff boggles my mind
score: 0

http://stackoverflow.com/a/20690762
type: Answer
has body: Ok, when you use an external jar in your java project you have to add it in the axis lib folder (path: /web_server_local_folder/axis/WEB-INF/lib). I resolved my issue adding the gson jar in that folder.
score: 0
accepted answer of: http://stackoverflow.com/q/20688414
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20688414

http://stackoverflow.com/q/20768523
accepted answer: http://stackoverflow.com/a/20770870
type: Question
score: 3
linked to: http://stackoverflow.com/q/21781161
tagged with: libgdx
has title: Why LibGDX doesn't have update and render separated?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33631341
has answer: http://stackoverflow.com/a/20770870
favorite count: 0
has body: I am working currently with LibGDX and Java. Im wonder me, why LibGDX give you only a render Mehtod for game logic and rendering. Why LibGDX do this, why LibGDX does not inherited another mehtod like update ? And should I handle game Logic and rendering in the render method(Of course I split it in an render and update method)
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: render

http://stackoverflow.com/q/20810305
score: 0
has comment: http://stackoverflow.com/comment/31202033
has title: The right way to use BufferdOutputStream to write a large number of different small files
type: UnansweredQuestion
has body: I have a need to write a large number of different small files(about 30kb per file).Below is my java code: for(every file){ File destFile = new File(fileName); try { FileOutputStream fos = new FileOutputStream(destFile); BufferedOutputStream bos = new BufferedOutputStream(fos); // System.out.println(dr.readLine()); bos.write(result.getBytes( "UTF-8")); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Of course ,for every file,I have to new a File object.But is it necessary to new fileOutputStream and BufferdOutputStream object for every distinct file?Is there a more efficient way to write a large number of small files?
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/20810373
tagged with: fileoutputstream
type: Question
answer count: 2
tagged with: bufferedoutputstream
has answer: http://stackoverflow.com/a/20810355

http://stackoverflow.com/comment/31136616
type: Comment
type: QuestionComment
has text: http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
comment on: http://stackoverflow.com/q/20773214
score: 0

http://stackoverflow.com/a/20723023
score: 0
has body: For understanding purpose lets rename argument of doTest() to obj public void doTest(Test1 obj) { obj = new Test1("Test2"); } When you call doTest: test2.doTest(test1);you are passing copy of reference(test1) Now obj and test1 both refer to obj with name = 'Test1' In doTest() you create a new object and obj points to it. But test1 still points to object with name = Test1 in main So when call toString() it prints Test1 In short test1 always referred to obj with name = Test1
type: Answer
answers question: http://stackoverflow.com/q/20722985

http://stackoverflow.com/comment/31075438
type: QuestionComment
has text: I had another installation of 3.1 running before with HTTPS enabled. I copied over the keystore and the necessary configuration parameters for the wrapper. I also entered these information in the respective sonar properties and removed them from the wrapper to see if the error happens there but still the same outcome... It seems the wrapper tries to configure Tomcat with some weird settings... At least that's what I read out of the log file...
comment on: http://stackoverflow.com/q/20704395
score: 0
type: Comment

http://stackoverflow.com/comment/31163348
score: 2
has text: +1 but is the argument then that `JComponent` is more general and the proper target for subclassing, whereas `JPanel` is too specific and subclassing it would just be a hack? Do you concur that it doesn't usually make sense for your custom component to participate in the PLAF framework?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20788869

http://stackoverflow.com/a/20846473
upvote count: 2
has body: The best way is definitely the one where you don't have to take the square root in order to apply Pythagoras. This means that you don't test: distance &lt;= radius But instead, you do: distance^2 &lt;= radius^2 Here is a method that does that: /** * @param x The x coordinate of the point to test. * @param y The y coordinate of the point to test. * @param cX The x coordinate of the center of the circle. * @param cY The y coordinate of the center of the circle. * @param r The radius of the circle. */ public static boolean liesInCircle(double x, double y, double cX, double cY, double r) { double dx = x - cX; double dy = y - cY; return dx * dx + dy * dy &lt;= r * r; }
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20846340

http://stackoverflow.com/comment/31011549
has text: http://people.w3.org/~dom/archives/2005/09/integrating-a-new-uris-scheme-handler-to-gnome-and-firefox/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20704711
score: 0

http://stackoverflow.com/comment/30969864
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20681166
has text: The above comment does not look like a question, rewriting it. My question is there must be some way where we can serialize there characters, because I have written these character in an xml file and opened that xml file with Internet explorer and it worked fine. It displayed the xml. If these were invalid xml characters then why Internet Explorer could display it.
score: 0

http://stackoverflow.com/a/20756232
type: Answer
score: -1
answers question: http://stackoverflow.com/q/20756137
downvote count: 2
upvote count: 1
has body: try following code if(arraryTemplist.size()&gt;0){ adapter = new ListViewAdapter(ListOfContacts.this, arrayTemplist); listview.setAdapter(adapter); }else{ adapter = new ListViewAdapter(ListOfContacts.this, arraylist); listview.setAdapter(adapter); }

http://stackoverflow.com/comment/31230283
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20825271
has text: Yes, the method is overridden.

http://stackoverflow.com/q/20753886
tagged with: playframework
answer count: 1
accepted answer: http://stackoverflow.com/a/20754253
tagged with: scala
tagged with: maven
type: AnsweredQuestion
tagged with: playframework-2.0
has body: I have two Play 2.2.1 applications, X and Y. Both of these applications have a Global object in the default package that extends GlobalSettings and overrides onStart. Application X is published in a maven repo and application Y has X as a dependency. When attempting to run application Y, I keep getting strange exceptions during onStart. These exceptions are getting thrown by code in application X's onStart function. I did not get any compile-time errors or warnings. Is this expected? Is this a Play specific issue or would this happen any time names in the default package conflict like this? How can I prevent the GlobalSettings of the apps from mixing together? I had originally put the common code into its own project that the two Play app's shared as a dependency. This was annoying to maintain and all of the shared code really belonged to app X, so I reorganized.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20754253
score: 0
has title: Intermingling of Play application global settings

http://stackoverflow.com/comment/31988029
comment on: http://stackoverflow.com/a/20684927
score: 0
type: Comment
type: AnswerComment
has text: @EJP, I meant _open and receiving always_

http://stackoverflow.com/a/20809551
downvote count: 0
has comment: http://stackoverflow.com/comment/31219670
has body: You forgot to enable GL_TEXTURE_2D when you draw. Since you were disabling it after texture loading is done. And you have to bind the texture before you start rendering quads.
has comment: http://stackoverflow.com/comment/31212127
accepted answer of: http://stackoverflow.com/q/20809410
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/118664963
score: 2
answers question: http://stackoverflow.com/q/20809410
type: AcceptedAnswer

http://stackoverflow.com/a/20842681
downvote count: 0
answers question: http://stackoverflow.com/q/20842422
type: Answer
score: 2
upvote count: 2
has body: I would rebuild your first table with just 3 columns (you can have a numerical ID too, but I see you don't use it anyway): USER_ID CATEGORY_ID SCORE 25488 o54879 0 25488 o54880 1 25488 o87984 0 ... 35487 o54879 0 35487 o54880 1 35487 o87984 1 ... That would make your system quite more scalable and should take away those problems you talk about

http://stackoverflow.com/q/20746687
score: 0
tagged with: java
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/31258456
answer count: 0
has comment: http://stackoverflow.com/comment/31091924
type: UnansweredQuestion
has body: I am trying to implement a solution which have relational database logic between tables Document and DocumentField. This solution will be used as a web service and will be consumed by a client. I was getting the following exception from my web service client: Exception: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: com.bla.bla.ws.Document@115cfb9 -&gt; com.bla.bla.ws.DocField@94e6ee -&gt; com.bla.bla.ws.Document@115cfb9] In order to solve this problem I added @XmlTransient annotation: Document: @Entity(name = "Document") @Table(name = "DOCUMENT", schema = "DOCUMENT") @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Document extends BasicObject implements Serializable { private static final long serialVersionUID = -5274375009324738532L; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="doc") @XmlTransient private List&lt;DocField&gt; extraInfo; DocField: public class DocField extends BasicObject implements Serializable { private static final long serialVersionUID = -7403660716697161123L; @ManyToOne @JoinColumn(name="DOC_ID") @XmlTransient private Document doc; But now I can not reach my docField from the client with this code snippet: Document testDoc = new Document (); DocField testDocField = new DocField(); testDoc.getDocField.add(testDocField); I think I misunderstood some points in this kind of solution. Can anyone provide some explanation about this? Or any external resource?
tagged with: xmltransient
has title: @XmlAnnotation to solve "A cycle is detected in the object graph." exception
tagged with: netbeans-7
tagged with: netbeans
type: Question

http://stackoverflow.com/q/20805980
tagged with: python
tagged with: m2crypto
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20812386
accepted answer: http://stackoverflow.com/a/20812386
type: Question
possible better answer: http://stackoverflow.com/a/20809265
tagged with: jython
has body: I'm building a cross-platform Java project that has to reference some python2.7 scripts. Jython seems perfect for this, but there are a couple problems: the python script uses M2Crypto. Is there any way to include M2Crypto into Jython in a way that's natively cross platform and doesn't require installing any extra programs? EDIT: To be specific, this is the file that's giving me problems: https://raw.github.com/GotoHack/pymobiledevice/master/ca.py
score: 0
answer count: 2
has title: Reference M2Crypto from within Jython
has answer: http://stackoverflow.com/a/20809265

http://stackoverflow.com/comment/31107157
comment on: http://stackoverflow.com/a/20756903
has text: @Pradeep From [here](http://stackoverflow.com/a/2810790/2970947), Use [this](http://www.microsoft.com/downloads/details.aspx?FamilyID=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20744794
has comment: http://stackoverflow.com/comment/62720954
accepted answer of: http://stackoverflow.com/q/20707821
type: Answer
answers question: http://stackoverflow.com/q/20707821
has body: I found a better way of achieving this without using the page transformer. By using setOnPageChangeListener. I've made an example app here: https://github.com/andreborud/FadingTabs The code is pretty much just this: mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int alphaCurrent = (int) (255 - (128*Math.abs(positionOffset))); int alphaNext = (int) (128 + (128*Math.abs(positionOffset))); if (positionOffset != 0) { switch(position) { case 0: tab0.setTheAlpha(alphaCurrent); tab1.setTheAlpha(alphaNext); break; case 1: tab1.setTheAlpha(alphaCurrent); tab2.setTheAlpha(alphaNext); break; case 2: tab2.setTheAlpha(alphaCurrent); tab3.setTheAlpha(alphaNext); break; } } } });
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31031804
has text: @DanielC.Sobral, when I replace App with def main(args: Array[String]): Unit = { then there is no such the error.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20696299
type: QuestionComment

http://stackoverflow.com/comment/31050887
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20725732
type: AnswerComment
has text: @user3126413 How are you invoking it?

http://stackoverflow.com/a/20750132
upvote count: 3
has body: I'm a little curious what your content view is: setContentView(R.layout.activity_main); What is your R.layout.activity_main? Does it contain your drawer layout? If not, mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); Will cause mDrawerLayout to be null.
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20749928

http://stackoverflow.com/a/20737572
has comment: http://stackoverflow.com/comment/31146791
accepted answer of: http://stackoverflow.com/q/20736221
answers question: http://stackoverflow.com/q/20736221
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31102574
type: Answer
has comment: http://stackoverflow.com/comment/31106639
has comment: http://stackoverflow.com/comment/31105553
downvote count: 2
upvote count: 1
has body: The difference between these two declarations is that the first one produces compiler warning and the second one doesn't. This is because generic types should always be used with parameters. This declaration ensures that if X implements Vector it must be Vector of X : class X implements Vector&lt;X&gt; { ... Anything else will produce a compiler error. Actually such construct is used in JDK: public abstract class Enum&lt;E extends Enum&lt;E&gt;&gt; implements Comparable&lt;E&gt;, Serializable { ... it means that when we declare enum X it (implicitly) extends Enum&lt;X&gt;
has comment: http://stackoverflow.com/comment/31106400
score: -1

http://stackoverflow.com/comment/31196249
type: QuestionComment
has text: use a debugger, you will perfectly understand.
score: 0
comment on: http://stackoverflow.com/q/20807240
type: Comment

http://stackoverflow.com/comment/53629763
has text: shouldn't it be `subArray = [2, 3, 4]` ??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20800608
type: Comment

http://stackoverflow.com/a/20843038
answers question: http://stackoverflow.com/q/20842410
has body: Because when the search method find name(actually "x"),don't reach the line bf.close(), so bf is still opened and file.delete() fails. So, you need to modify the search method to the below: public static int search(String name) { String path = "C:\\Users\\Charbel\\Desktop\\Dictionary.txt"; int countL = 0; String line; BufferedReader bf = null; try { bf = new BufferedReader(new FileReader(path)); while (( line = bf.readLine()) != null) { int indexfound = line.indexOf(name); if (indexfound == 0) { return countL; } countL++; } } catch (IOException e) { System.out.println("IO Error Occurred: " + e.toString()); } finally { if(bf != null) { try { bf.close(); } catch(IOException ignored) {} } } return -1; }
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20842410

http://stackoverflow.com/comment/31275789
type: Comment
comment on: http://stackoverflow.com/a/20841832
type: AnswerComment
has text: ok my class name is ConstsAndStats.cpp not ConstAndStats.cpp (plural), so it was a mispelling. thanks!
score: 0

http://stackoverflow.com/q/20784765
has title: Transformation Matrices set Properties
tagged with: linear-algebra
score: 0
linked to: http://stackoverflow.com/q/4361242
answer count: 1
has answer: http://stackoverflow.com/a/20784961
tagged with: c++
has body: I want to write Custom Matrix class that will allow me to do following things: Matrix m = Matrix().identity(); m.rotateAngle(30); m.scale(2.0); m.scale(1.5); m.rotateAngle(30); All operations above are clear for me but Now I want such thing to do: I want to write a function like: setRotationAngle or setScale which will set value what's passed no matter what's in current value // for example: m.setAngle(45); // clears the currentRotationAngle and then sets rotation to 45 Is there a way to do that? or Game Engines and such stuff just rebuild the matrix if someone wants to set some property? Is there some tutorial which will help me to understand that problem?
tagged with: opengl
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: graphics

http://stackoverflow.com/comment/31152241
has text: @PeterPenzov Try using the same pattern string for your console appender as well, I've updated my answer
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20781711

http://stackoverflow.com/comment/31264932
type: AnswerComment
score: 0
type: Comment
has text: Note that there are *two* [canonical normal forms](http://en.wikipedia.org/wiki/Canonical_normal_form); sum-of-products and product-of-sums.
comment on: http://stackoverflow.com/a/20844237

http://stackoverflow.com/comment/30994601
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20693131
has text: Date/Calendar are confusing because they are poorly designed and implemented classes. Save yourself the headache, avoid those classes and use a decent library instead: Either (a) [Joda-Time](http://www.joda.org/joda-time/) or (b) the new [JSR 310: Date and Time API](https://www.jcp.org/en/jsr/detail?id=310) java.time.* classes bundled with Java 8 and supplanting the java.util.Date/Calendar mess.
type: Comment

http://stackoverflow.com/comment/30976620
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20685164
has text: Are you sure that we cannot load a json file from local system?

spring-boot
tags question: http://stackoverflow.com/q/20707203
type: Tag
tags question: http://stackoverflow.com/q/20685042
tags question: http://stackoverflow.com/q/20848485
tags question: http://stackoverflow.com/q/20731158
tags question: http://stackoverflow.com/q/20782740
tags question: http://stackoverflow.com/q/20707746
tags question: http://stackoverflow.com/q/20755342
tags question: http://stackoverflow.com/q/20707485
tag name: spring-boot
tags question: http://stackoverflow.com/q/20734502

http://stackoverflow.com/comment/31353533
comment on: http://stackoverflow.com/a/20826218
type: AnswerComment
type: Comment
has text: Actually, it looks like you can change the default behavior to do this, but that is not the default (http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-antprefs.htm). I'll have to try this out. Turns out I have similar issues when running JUnit so my problem is bigger than Ant.
score: 0

http://stackoverflow.com/q/20804419
linked to: http://stackoverflow.com/q/9387483
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20974661
score: -1
has answer: http://stackoverflow.com/a/20804512
answer count: 2
has title: Simulate page click with coordinates (x,y)
tagged with: htmlunit
upvote count: 0
favorite count: 0
has body: How do I simulate a click with coordinates on HtmlPage then get the result a HtmlPage? I want to click a button without an id or a name I'm using the library com.gargoylesoftware.htmlunit
type: UnansweredQuestion

http://stackoverflow.com/comment/31093687
has text: I understand now, i can add elements to it, but i cannot even reassign it like `List<String> list1 = new List<String>();`, right?
comment on: http://stackoverflow.com/a/20747008
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31117872
type: Comment
has text: I am sorry but i am new to android and don't know how that would help:(
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20763281

http://stackoverflow.com/a/20799848
type: Answer
answers question: http://stackoverflow.com/q/20799629
has body: There is very little/ negligible difference b/w the execution times of the 2... The compiler optimizes your code... public class Test { public static void main(String[] args) { long l = System.nanoTime(); func1("hi"); System.out.println(System.nanoTime()-l); long l1 = System.nanoTime(); func2("hi"); System.out.println(System.nanoTime()-l1); } public static void func1(String str) { for(int i=0;i&lt;10000;i++) { String s= str ; // System.out.println(s); } } public static void func2(String str) {String s= null; for(int i=0;i&lt;10000;i++) { s= str ; // System.out.println(s); } } } O/p : 1. 277530 265557 2. 267694 243747
score: 0

http://stackoverflow.com/comment/31149415
has text: i am new to birt.i dont know how can i achieve..can u pls share any sample report
type: AnswerComment
comment on: http://stackoverflow.com/a/20780167
type: Comment
score: 0

http://stackoverflow.com/q/20843103
has comment: http://stackoverflow.com/comment/31263017
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31263335
has comment: http://stackoverflow.com/comment/31263400
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31262948
linked to: http://stackoverflow.com/q/1318347
accepted answer: http://stackoverflow.com/a/20843562
linked to: http://stackoverflow.com/q/9554636
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31263171
has title: Form freezing issues after accessing dialogue box
linked to: http://stackoverflow.com/q/7323086
favorite count: 0
has answer: http://stackoverflow.com/a/20843562
has body: I'm in the process of creating a login mechanism for a game. If the user inputs an invalid username-password combination, a dialogue box appears telling them their error. But when I click "OK" in the dialogue box, all components in the previous form become inactive. Here is my code from the event handler method: //Event Handler public void actionPerformed(ActionEvent e){ Scanner fileScan = null; Scanner passwordScan = null; String lineVar; int lineCount=0; //Opens the "Create Account" form if (e.getSource()==CreateNew){ new CreateAccount(); } //user tries to login else if(e.getSource()==submit){ Inputuser = user.getText(); InputPass = Pass.getText(); try{ fileScan = new Scanner(new File(Inputuser + ".txt")); filefound = true; } catch(FileNotFoundException ex){ JFrame FailureFrame = new JFrame("Something went wrong..."); JOptionPane.showMessageDialog(FailureFrame, "The username you have entered does not exist in our records. Please try again"); filefound=false; } //If the file was found (username exists) if (filefound==true){ //Loops while the username while has more lines of content while(fileScan.hasNext()){ lineVar = fileScan.next(); //Each line is considered a token passwordScan = new Scanner(lineVar); passwordScan.useDelimiter("/n"); while (passwordScan.hasNext()){ lineCount +=1; if (lineCount == 2){ if (InputPass.equals( passwordScan.next() ) ){ JFrame successframe = new JFrame("Success!"); JOptionPane.showMessageDialog(successframe, "Login Successful!"); frame.dispose(); new MainProfile(); } //If the password they entered is wrong else{ JFrame notLogin = new JFrame ("Something went wrong..."); JOptionPane.showMessageDialog(notLogin, "You have entered invalid info. Please try again"); CompEnable(); } } } } } } }
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/31132520
score: 0
type: Comment
has text: in that case you have to add objects of one class into another
comment on: http://stackoverflow.com/a/20771288
type: AnswerComment

http://stackoverflow.com/comment/31219934
type: Comment
type: QuestionComment
has text: What database platform is this? Are date/time actually separate fields? Please show your table schema.
score: 0
comment on: http://stackoverflow.com/q/20819872

http://stackoverflow.com/q/20824555
tagged with: java
type: Question
score: 3
tagged with: eclipse
favorite count: 0
upvote count: 3
has title: Eclipse IDE: CamelCase navigation within words via CTRL+left/right in XML editor
has body: In the Eclipse Java editor, using CTRL+left/right lets the cursor stop at every upper case character within a word. In the XML editor, the cursor jumps over the whole word. Is there an option (I'm using Eclipse Indigo) to activate CamelCase navigation in the Eclipse XML editor, so it behaves like the Java editor? Thanks a lot for your help!
tagged with: http://stackoverflow.com/tag/xml
tagged with: editor
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/20751750
has comment: http://stackoverflow.com/comment/31108689
has body: i'm trying to send data from netty channel to an tcp client, but the client does not receive any of it, server: byte b=1; incoming.writeAndFlush(b); // incoming it's Channel client: Socket cleint=new Socket("127.0.0.1",4444); in=client.getInputStream(); in.read();
answer count: 0
has title: send from netty server data to tcp client
type: UnansweredQuestion
tagged with: tcp
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31100084
tagged with: netty

http://stackoverflow.com/q/20775614
answer count: 1
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/31141597
has body: As I know, @Documented annotation is used only by javadoc generator to generate javadocs from sources. So retention type should be SOURCE, but it's RUNTIME. Why? @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface Documented { }
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: javadoc
tagged with: annotations
type: Question
has answer: http://stackoverflow.com/a/51744318
score: 5
has title: Why does @Documented annotation have runtime retention?
has comment: http://stackoverflow.com/comment/88640295

http://stackoverflow.com/comment/30968111
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20679974
score: 0
has text: What is the point of the `userName`? Is it the name of the person using the Singleton? Please explain.

http://stackoverflow.com/comment/31125179
type: AnswerComment
has text: Bu it doesn't. Try in compiler :p. Message: incompatible types.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20767131

http://stackoverflow.com/a/20844237
has comment: http://stackoverflow.com/comment/31265254
has comment: http://stackoverflow.com/comment/31264932
type: Answer
has comment: http://stackoverflow.com/comment/31265021
downvote count: 0
answers question: http://stackoverflow.com/q/20844191
has body: &amp;&amp; is the boolean analogue of multiplication (x &amp;&amp; y == x * y), while || is the boolean analogue of addition (x || y == (bool)(x + y)). Since multiplication has a higher precedence than addition, the same convention is used. Note that the most common "canonical" form for boolean expression is a bunch of or-ed together and-clauses, so this dovetails well with that.
score: 14
upvote count: 14

http://stackoverflow.com/a/20842460
accepted answer of: http://stackoverflow.com/q/20842409
answers question: http://stackoverflow.com/q/20842409
has body: try this: //inside onClick yourEditText.setText(""); doing this, you set a empty text
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37237016
type: AnswerComment
comment on: http://stackoverflow.com/a/23839193
score: 0
type: Comment
has text: i tried ur way to solve but when i put it is showing lots of error how can i resolve

http://stackoverflow.com/q/20844301
type: UnansweredQuestion
tagged with: iis
has body: I am running microstrategy business intelligece software on IIS7. It is an ASPX application with java backend. I am not exactly sure of the architecture behind Java->ASPX. I have developed some extension for this software which includes xml and kml files being written to the IIS web application directory. However when these files are written to this directory they are of size 0. If I alter the code and write to D: they are written properly and have content. I altered the permissions on the IIS application directory to have FC for the everyone group. Are there any other permissions or settings in IIS which needs to be altered? I appreciate any suggestions.
has comment: http://stackoverflow.com/comment/31272687
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31266656
type: Question
linked to: http://stackoverflow.com/q/12267393
has title: IIS7 Java application writing files with size 0
has comment: http://stackoverflow.com/comment/31266907
tagged with: iis-7
has comment: http://stackoverflow.com/comment/31267919
score: 0
tagged with: asp.net

http://stackoverflow.com/q/20808490
has answer: http://stackoverflow.com/a/20821321
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31199063
has comment: http://stackoverflow.com/comment/31198997
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31199183
accepted answer: http://stackoverflow.com/a/20821321
has comment: http://stackoverflow.com/comment/31199436
tagged with: java
has comment: http://stackoverflow.com/comment/31200099
has comment: http://stackoverflow.com/comment/31199708
has body: I'm writing a game using Tiled's TMX format for 2D tile mapping (said format being XML-based). When I build and run the program within the NetBeans IDE, it works flawlessly. However, the JAR file does not, kicking out the following error message: [Fatal Error] :1:1: Content is not allowed in prolog. Naturally this is followed by many NullPointerExceptions after the program continues running and attempts to reference the unloaded map. Use of jar xvf has verified that the file is being built into the JAR correctly, and no extra data is being introduced - the unarchived copy is byte-for-byte identical to the one in my src/assets folder. The relevant code follows; from GameScreenMain.java: try { TMXMapReader mapReader = new TMXMapReader(); map = mapReader.readMap(ClassLoader.getSystemClassLoader().getResourceAsStream("test_map.tmx")); } catch (Exception e) { } From TMXMapReader.java: public Map readMap(InputStream in) throws Exception { xmlPath = makeUrl("."); Map unmarshalledMap = unmarshal(in); //unmarshalledMap.setFilename(xmlFile) // return unmarshalledMap; } private Map unmarshal(InputStream in) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc; try { factory.setIgnoringComments(true); factory.setIgnoringElementContentWhitespace(true); factory.setExpandEntityReferences(false); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(entityResolver); InputSource insrc = new InputSource(in); insrc.setSystemId(xmlPath); insrc.setEncoding("UTF-8"); doc = builder.parse(insrc); } catch (SAXException e) { throw new Exception("Error while parsing map file: " + e.toString()); } buildMap(doc); return map; } From test_map.tmx: <?xml version="1.0" encoding="UTF-8"?> <image source="graphics/Indev.png" trans="ff00ff" width="128" height="64"/> <property name="collision" value="solid"/> eJxjYmBgYKISZiQRU8scXGZhEyfHLEYseok1k5A5uPTgM4sYc/C5DZccPj8yYVGHzRxi0wm10hw6BgB7xwES Why does the exact same file work …
type: Question
has comment: http://stackoverflow.com/comment/31198966
tagged with: jar
has title: XML file is loaded properly in Netbeans IDE but not in JAR that contains it
score: 0

http://stackoverflow.com/a/20739490
upvote count: 3
accepted answer of: http://stackoverflow.com/q/20739462
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20739462
type: Answer
has comment: http://stackoverflow.com/comment/31075503
downvote count: 0
score: 3
has body: This String is URL-encoded. You need to decode it. Make some tests here. http://meyerweb.com/eric/tools/dencoder/ Then try this. String result = URLDecoder.decode("%C5%82%C3%B3", "UTF-8"); See also: http://docs.oracle.com/javase/7/docs/api/java/net/URLDecoder.html

http://stackoverflow.com/a/27406064
type: Answer
has comment: http://stackoverflow.com/comment/108339089
has comment: http://stackoverflow.com/comment/50283698
score: 36
has body: The accepted answer is good, however, I would have needed various library configurations within my multi-project Gradle build to use the same 3rd-party Java library. Adding '$rootProject.projectDir' to the 'dir' path element within my 'allprojects' closure meant each sub-project referenced the same 'libs' directory, and not a version local to that sub-project: //gradle.build snippet allprojects { ... repositories { //All sub-projects will now refer to the same 'libs' directory flatDir { dirs "$rootProject.projectDir/libs" } mavenCentral() } ... } EDIT by Quizzie: changed "${rootProject.projectDir}" to "$rootProject.projectDir" (works in the newest Gradle version).
has comment: http://stackoverflow.com/comment/107909325
has comment: http://stackoverflow.com/comment/63884286
downvote count: 3
has comment: http://stackoverflow.com/comment/45549873
answers question: http://stackoverflow.com/q/20700053
has comment: http://stackoverflow.com/comment/102622243
upvote count: 39

http://stackoverflow.com/comment/31233578
type: Comment
has text: You could replace the direct reference to an object with a WeakReference after the expiration time. That way the object would be around at least until it expired, and then would allow the garbage collector to reclaim it.
comment on: http://stackoverflow.com/q/20827166
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31207248
has text: You're not changing the psw inside the paramsConnect Map.
score: 1
comment on: http://stackoverflow.com/q/20813030
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20726977
downvote count: 0
has title: Lazy loading initialization using hibernate 4
answer count: 1
favorite count: 0
tagged with: lazy-loading
has answer: http://stackoverflow.com/a/20727238
upvote count: 1
has body: I'm writing my apllication using Spring MVC + Hibernate. I have 2 entities: order and items(order items). Order entity: @Entity @Table(name = "orders") public class Order { @Id @GeneratedValue private int id; @Column(name = "time") private long time; @OneToMany(mappedBy = "order") private List&lt;Item&gt; items; Item entity: @Entity @Table(name = "items") public class Item { @Id @GeneratedValue private int @ManyToOne(targetEntity = Order.class) private Order order; @Column private int count; I want to list orders in page '/orders', and order's detail in page '/orders/{id}/view'. In my DAOImpl i write code below: public List&lt;Order&gt; view() { return sessionFactory.getCurrentSession() .createCriteria(Order.class) .addOrder(org.hibernate.criterion.Order.desc("time")) .list(); } This code returns a list of all orders. But if I try see order's detail I have exception: org.apache.jasper.JasperException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ru.drupo.order.domain.Order.items, could not initialize proxy - no Session. There are duplicates of orders in list if I add to order's entity fetch = FetchType.EAGER. But order's detail shows correctly. How I can initialize lazy loading?
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/20727238
tagged with: lazy-initialization

http://stackoverflow.com/q/20683148
score: 0
accepted answer: http://stackoverflow.com/a/20683200
possible better answer: http://stackoverflow.com/a/20683196
answer count: 7
has answer: http://stackoverflow.com/a/20683232
has answer: http://stackoverflow.com/a/20683200
has body: I am trying to understand something that may be very simple, so I apologize if I am looking like a rookie. I have this java class: public class Student { public String name = ""; public int age = 0; public String major = "Undeclared"; public boolean fulltime = true; public void display() { System.out.println("Name: " + name + " Major: " + major); } public boolean isFullTime() { return fulltime; } } And this class from which I call the first one: public class TestStudent { public static void main(String[] args) { Student bob = new Student(); Student jian = new Student(); bob.name = "Bob"; bob.age = 19; jian = bob; jian.name = "Jian"; System.out.println("Bob s Name: " + bob.name); } } This will print: Bob s Name: Jian I am curious about how the assignments are done there.
has comment: http://stackoverflow.com/comment/30973332
has title: Java: object fields assignment
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20683205
has answer: http://stackoverflow.com/a/20683196
tagged with: java
has answer: http://stackoverflow.com/a/20683211
type: Question
has answer: http://stackoverflow.com/a/20683203
has comment: http://stackoverflow.com/comment/30972824
has answer: http://stackoverflow.com/a/20683467

http://stackoverflow.com/comment/31212693
comment on: http://stackoverflow.com/a/20816079
type: AnswerComment
score: 0
type: Comment
has text: I am sorry, I only glanced in search for a `Class.getSuperclass` method and didn't find it. Could you point me to the place where you get the superclass?

http://stackoverflow.com/comment/31274053
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/20848788
has text: If you want to print the content of your array, use `System.out.println(Arrays.toString(xadj))`.
type: Comment

http://stackoverflow.com/comment/31060099
score: 0
type: AnswerComment
type: Comment
has text: Thanks! Solved my problem, there is just one wrong detail in your solution. The divider SHOULDN'T be a layout file. It should be either a drawable or a color. When I added a layout file as a divider, the application crashed.
comment on: http://stackoverflow.com/a/20717768

http://stackoverflow.com/a/20792487
type: Answer
has body: Try changing your dataSource bean to this. beans:bean id="dataSource" name="dataSource" You've given it an id "dataSource" but no name "dataSource". See the last line of your error.
score: 0
answers question: http://stackoverflow.com/q/20792406

http://stackoverflow.com/q/20714238
answer count: 2
has answer: http://stackoverflow.com/a/20714377
has title: Remove specified object from List in Java when iterating
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31029741
has answer: http://stackoverflow.com/a/20714293
has comment: http://stackoverflow.com/comment/31030417
type: Question
tagged with: java
has body: Is it possible to remove an object other than the current when iterating? List&lt;GameObjects&gt; gameObjects = new ArrayList&lt;GameObjects&gt;(); ListIterator&lt;GameObject&gt; iterator = gameObjects.listIterator(); while (iterator.hasNext()) { iterator.next().update(); // Here I would like to do gameObjects.remove(other_object_in_gameObjects); } Obviously that's not allowed. But can an Iterator do it somehow? Or is it not doable at all?
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/31107031
type: QuestionComment
has text: take a look at preparedStatement. http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html
score: 0
comment on: http://stackoverflow.com/q/20756883
type: Comment

http://stackoverflow.com/a/20681502
upvote count: 2
has body: You could do it with generics like this: abstract class AbstractService&lt;T extends BaseResponse&gt; { public void process(T t) { //execute logic that is common to a BaseResponse } } //implementations class FirstService extends AbstractService&lt;FirstResponse&gt; { @Override public void process(FirstResponse firstResponse) { super.process(firstResponse); ... } } public static void main(String[] args) { //usage AbstractService&lt;FirstResponse&gt; myservice = new FirstService(); myservice.process(new FirstResponse()); }
score: 2
has comment: http://stackoverflow.com/comment/30969957
downvote count: 0
has comment: http://stackoverflow.com/comment/30970684
type: Answer
answers question: http://stackoverflow.com/q/20681364

http://stackoverflow.com/a/20760962
answers question: http://stackoverflow.com/q/20760945
has comment: http://stackoverflow.com/comment/31114162
has comment: http://stackoverflow.com/comment/31114208
has comment: http://stackoverflow.com/comment/31114626
has comment: http://stackoverflow.com/comment/31114589
has body: You don't need to pass the HttpServletRequest, I believe. As to the xml parameter, I think you should have a parameter of some other class there, not just of type String. For example Item, Customer, Order, i.e. any business object (bean, POJO). The way you've done it now, you'd better declare @Consumes(MediaType.TEXT_PLAIN) because you declare that you expect just a String in your method. Normally when you expect XML, this XML value is unmarshalled into an object of some type (usually a bean, POJO, etc). You get this on the fly and you can just work with the object. Here is some sample code of a sample Java client. package com.company.api.test; import java.net.URI; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import com.google.gson.Gson; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.LoggingFilter; import com.company.common.DateUtil; import com.company.api.input.ItemOperation; import com.company.api.input.ItemOperationData; import com.company.api.result.ItemResult; public class JavaClientREST { public static void main(String[] args) throws Exception { ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); client.addFilter(new LoggingFilter()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); WebResource service = client.resource(getBaseURI()); ItemOperation op1 = new ItemOperation(); op1.setItemID("447"); Date d1 = DateUtil.getDate(2013, Calendar.DECEMBER, 20); System.out.println("DT1 = " + sdf.format(d1)); op1.setDate(d1); op1.setOperation("pause"); String res = service.path("Item") .entity(op1, MediaType.APPLICATION_XML) .accept(MediaType.APPLICATION_JSON) .post(String.class); Gson gson = new Gson(); ItemResult result = g…
has comment: http://stackoverflow.com/comment/31114126
has comment: http://stackoverflow.com/comment/31114422
score: 0
type: Answer

javascript
tags question: http://stackoverflow.com/q/20794864
tags question: http://stackoverflow.com/q/20711174
tags question: http://stackoverflow.com/q/20793089
tags question: http://stackoverflow.com/q/20737470
tags question: http://stackoverflow.com/q/20796847
tags question: http://stackoverflow.com/q/20696934
tags question: http://stackoverflow.com/q/20774765
tags question: http://stackoverflow.com/q/20756526
tags question: http://stackoverflow.com/q/20740078
tags question: http://stackoverflow.com/q/20817098
tags question: http://stackoverflow.com/q/20834394
tags question: http://stackoverflow.com/q/20771443
tags question: http://stackoverflow.com/q/20839044
tag name: javascript
tags question: http://stackoverflow.com/q/20742558
tags question: http://stackoverflow.com/q/20796774
tags question: http://stackoverflow.com/q/20847764
tags question: http://stackoverflow.com/q/20817409
tags question: http://stackoverflow.com/q/20776290
tags question: http://stackoverflow.com/q/20795847
tags question: http://stackoverflow.com/q/20732109
tags question: http://stackoverflow.com/q/20818150
tags question: http://stackoverflow.com/q/20705162
tags question: http://stackoverflow.com/q/20757276
tags question: http://stackoverflow.com/q/20785977
tags question: http://stackoverflow.com/q/20824384
tags question: http://stackoverflow.com/q/20709611
type: Tag
tags question: http://stackoverflow.com/q/20742992
tags question: http://stackoverflow.com/q/20689800
tags question: http://stackoverflow.com/q/20834999
tags question: http://stackoverflow.com/q/20806092
tags question: http://stackoverflow.com/q/20763619
tags question: http://stackoverflow.com/q/20781322
tags question: http://stackoverflow.com/q/20796162
tags question: http://stackoverflow.com/q/20765872
tags question: http://stackoverflow.com/q/20703873
tags question: http://stackoverflow.com/q/20799237
tags question: http://stackoverflow.com/q/20696325
tags question: http://stackoverflow.com/q/20737191
tags question: http://stackoverflow.com/q/20682039
tags question: http://stackoverflow.com/q/20760608
tags question: http://stackoverflow.com/q/20760928
tags question: http://stackoverflow.com/q/20738656
tags question: http://stackoverflow.com/q/20784560
tags question: http://stackoverflow.com/q/20817308
tags question: http://stackoverflow.com/q/20763515
tags question: http://stackoverflow.com/q/20806637
tags question: http://stackoverflow.com/q/20747647
tags question: http://stackoverflow.com/q/20705106
tags question: http://stackoverflow.com/q/20785056
tags question: http://stackoverflow.com/q/20795554
tags question: http://stackoverflow.com/q/20707373
tags question: http://stackoverflow.com/q/20741166
tags question: http://stackoverflow.com/q/20731850
tags question: http://stackoverflow.com/q/20834889
tags question: http://stackoverflow.com/q/20800763
tags question: http://stackoverflow.com/q/20689895
tags question: http://stackoverflow.com/q/20703119
tags question: http://stackoverflow.com/q/20704711
tags question: http://stackoverflow.com/q/20688288
tags question: http://stackoverflow.com/q/20708635
tags question: http://stackoverflow.com/q/20829680

http://stackoverflow.com/q/20705807
has answer: http://stackoverflow.com/a/20786458
answer count: 4
tagged with: oracle-database
has body: I am using Oracle 11g, I am executing Oracle sql script through java code. My SQL script may contain SQL statements(DDL or DML) or PL/SQL blocks, so I don't want to parse the script in my java code but used This solution to execute complete script at once. Following is the sample code, where SQLExec class is in ant jar. This solution worked for most cases except that if sql script contains create or replace trigger it fails with java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement. I have also specified snippet of sql script which fails. Please note that if I run same script through SQL Developer, it runs fine. Following is the Java code: private void executeSql(String sqlFilePath) { final class SqlExecuter extends SQLExec { public SqlExecuter() { Project project = new Project(); project.init(); setProject(project); setTaskType("sql"); setTaskName("sql"); } } SqlExecuter executer = new SqlExecuter(); executer.setSrc(new File(sqlFilePath)); executer.setDriver(args.getDriver()); executer.setPassword(args.getPwd()); executer.setUserid(args.getUser()); executer.setUrl(args.getUrl()); executer.execute(); } SQL Script snippet: ...... ...... CREATE OR REPLACE TRIGGER MY_TRG BEFORE INSERT ON MY_TABLE FOR EACH ROW BEGIN :NEW.MYNUMBER := MY_SEQUENCENUM.NEXTVAL; END; Following is the Exception trace: Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:398) at com.kuldeep.OracleConnectionTest.executeSql(OracleConnectionTest.java:160) at com.kuldeep.OracleConnectionTest.main(OracleConnectionTest.java:25) Caused by: java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436) at oracle.jdbc.driver.T4CTTIfun.do…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20786458
has title: Running Oracle sql script from java gives SQLSyntaxErrorException: ORA-00900: invalid SQL statement
tagged with: java
has answer: http://stackoverflow.com/a/20705954
type: Question
has answer: http://stackoverflow.com/a/24683713
has answer: http://stackoverflow.com/a/20706244
tagged with: ant
possible better answer: http://stackoverflow.com/a/20706244
score: 0
tagged with: plsql
linked to: http://stackoverflow.com/q/2071682
tagged with: sql

http://stackoverflow.com/comment/31198898
type: QuestionComment
comment on: http://stackoverflow.com/q/20702909
has text: I'm afraid that when I try to parse your sample file using PDFBox 1.8.3 directly, I do succeed while the stack trace in your question indicates that already that step fails. Have you double-checked that for your `lorem.pdf` sample file you get the same stack trace as cited for `DOC-443.pdf` above?
score: 0
type: Comment

http://stackoverflow.com/comment/31066964
type: QuestionComment
has text: In that case check my answer :)
comment on: http://stackoverflow.com/q/20733171
type: Comment
score: 0

http://stackoverflow.com/comment/31203343
has text: Try that. I only know that if it is headless, it will fail.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20800991

file
type: Tag
tags question: http://stackoverflow.com/q/20701686
tags question: http://stackoverflow.com/q/20728848
tags question: http://stackoverflow.com/q/20816652
tags question: http://stackoverflow.com/q/20711964
tags question: http://stackoverflow.com/q/20810305
tags question: http://stackoverflow.com/q/20688712
tags question: http://stackoverflow.com/q/20751237
tag name: file
tags question: http://stackoverflow.com/q/20686344
tags question: http://stackoverflow.com/q/20755005
tags question: http://stackoverflow.com/q/20806428
tags question: http://stackoverflow.com/q/20817588
tags question: http://stackoverflow.com/q/20803500
tags question: http://stackoverflow.com/q/20688705
tags question: http://stackoverflow.com/q/20845622
tags question: http://stackoverflow.com/q/20715945
tags question: http://stackoverflow.com/q/20800765
tags question: http://stackoverflow.com/q/20686686
tags question: http://stackoverflow.com/q/20800360
tags question: http://stackoverflow.com/q/20842959
tags question: http://stackoverflow.com/q/20775501
tags question: http://stackoverflow.com/q/20748726
tags question: http://stackoverflow.com/q/20767241
tags question: http://stackoverflow.com/q/20748433
tags question: http://stackoverflow.com/q/20714058
tags question: http://stackoverflow.com/q/20743872
tags question: http://stackoverflow.com/q/20824136
tags question: http://stackoverflow.com/q/20713016
tags question: http://stackoverflow.com/q/20815102
tags question: http://stackoverflow.com/q/20816157
tags question: http://stackoverflow.com/q/20767984
tags question: http://stackoverflow.com/q/20835236
tags question: http://stackoverflow.com/q/20721269
tags question: http://stackoverflow.com/q/20847047

http://stackoverflow.com/q/20821596
has answer: http://stackoverflow.com/a/20821618
score: 0
answer count: 2
has title: Why does my java file not see the new elements in my R file?
has answer: http://stackoverflow.com/a/20821617
accepted answer: http://stackoverflow.com/a/20821617
tagged with: android
type: AnsweredQuestion
type: Question
possible better answer: http://stackoverflow.com/a/20821618
tagged with: java
has body: I am creating a compound view. I have created a class for my new view: import android.R; public class LogoAndTextButton extends LinearLayout{ public LogoAndTextButton(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(VERTICAL); TypedArray array = context.obtainStyledAttributes(attrs, R. , 0, 0); I have created a attrs.xml for the in my res/values: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;declare-styleable name="LogoAndTextButton"&gt; &lt;attr name="image" format="reference"/&gt; &lt;attr name="text" format="string"/&gt; &lt;/declare-styleable&gt; &lt;/resources&gt; the styleable shows up in my R.java file!!! public static final class style { public static final int AppBaseTheme=0x7f080000; public static final int AppTheme=0x7f080001; } public static final class styleable { public static final int[] LogoAndTextButton = { 0x7f010000, 0x7f010001 }; public static final int LogoAndTextButton_image = 0; public static final int LogoAndTextButton_text = 1; }; but when I go to my LogoAndTextButton java class file and type "R." and cntrl+space, "styleable" does not show up as one of the elements. and if I type it manually it complains that it cant be resolved. I've tried cleaning my project, and closing and re opening eclipse.

http://stackoverflow.com/comment/31119091
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20747980
type: Comment
has text: Actually @JonathonReinhart the question is edited by user before this question contains int randnum=(int)(Math.random()*3)+1; line of code this code just answer unekwu that code .

http://stackoverflow.com/comment/30985931
score: 0
has text: Is `{}` one of the combinations?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20690104

http://stackoverflow.com/a/20764696
has comment: http://stackoverflow.com/comment/31121481
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20764389
answers question: http://stackoverflow.com/q/20764389
score: 1
has comment: http://stackoverflow.com/comment/31121729
has comment: http://stackoverflow.com/comment/31121130
upvote count: 1
type: AcceptedAnswer
has body: You could try using an EmptyBorder when the bevel border is not in use. Give it the same width/height you would the bevel border. I don't do a lot of messing around with layouts or their managers but that's what I would try. Edit Since it seems you may wish to have an overlay type effect instead of a border, you could create a custom JPanel class and include some code in the paintComponent(Graphics g) method to draw this overlay. Something similar to: public class OverlayBorderJPanel extends JPanel { boolean containsMouse = false; //set to true by mouseListener when contains BufferedImage overlay = //you would need to load an image border here, //rather than having a java created border //You could have alpha so it is half see-through public void paintComponent(Graphics g) { super.paintComponent(g); if (containsMouse) { g.drawImage(//use 0,0 position with panel width/height) } } } I think it would work with something like that, but you may need to call the panel's repaint() method in the listener as well.
type: Answer
has comment: http://stackoverflow.com/comment/31122627
has comment: http://stackoverflow.com/comment/31122356

http://stackoverflow.com/comment/31207359
type: Comment
comment on: http://stackoverflow.com/a/20809013
type: AnswerComment
score: 0
has text: I have updated my answer with more test cases. I think my results prove *some* DCE, but also show that it has a secondary effect to the overall timing.---Sorry, only now I see your additional comments. I guess we came to the same conclusion.

http://stackoverflow.com/a/20708107
accepted answer of: http://stackoverflow.com/q/20708022
has comment: http://stackoverflow.com/comment/31017947
has comment: http://stackoverflow.com/comment/31018272
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31017988
has comment: http://stackoverflow.com/comment/31017956
has comment: http://stackoverflow.com/comment/31018048
has body: There was some discussion on this here for deep cloning: Java HashMap - deep copy It's hard in this situation though as the new map and set need to rebuild themselves. Do you also need to clone the contents of the Set? If so then you could just serialize then de-serialize the whole collection. Iterating yourself will almost certainly be faster and will let you control how deep the cloning goes. Serializing will be slower but so long as everything in the object tree is serializable it will copy everything in the object tree and maintain things like circular references etc. (For example if you had 2 keys in the map pointing to the same Set object then iterating will split that into 2 sets, serializing will maintain the link).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31018221
answers question: http://stackoverflow.com/q/20708022
type: Answer

http://stackoverflow.com/comment/31062946
comment on: http://stackoverflow.com/q/20732385
type: QuestionComment
score: 0
has text: This is a practise exercise asked in a Currency Class i'm having at university. It's only possible to use join(), start(), Thread() and sleep() methods. This is not the original exercise, it has a slight change from my part, but the original asks me to create a thread that increments a counter while another thread repeats the stdin to stdout. Can u give me some ints how to do it just using that methods ? (it's not as evalutaion method, just learning myself this and studying to finals)
type: Comment

http://stackoverflow.com/comment/31134976
type: Comment
type: QuestionComment
has text: Actually what I thought is "WTF have you said to this quesion, you really read the question?", no offense
comment on: http://stackoverflow.com/q/20772783
score: 0

http://stackoverflow.com/comment/83044254
type: Comment
comment on: http://stackoverflow.com/a/20851489
has text: OP wants to know how to rewrite it to Java.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31326526
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20822233
has text: @TedHopp I hadn't. It appears the Eclipse documentation is improved over the last time I tried to wade through it, when I just gave up and started going through the source code.

http://stackoverflow.com/q/20742802
has body: I'm trying to use an Ant script to build my Vaadin 6 project. When I manually build and deploy the project, it works (mostly), but when I use the ant script, I get compile-time errors. My ant target looks like this: &lt;target name="build" depends="copyconfig" description="Compiles Java code to build directory"&gt; &lt;javac destdir="build" includeantruntime="false"&gt; &lt;!-- Error here --&gt; &lt;src path="src" /&gt; &lt;src path="generated" /&gt; &lt;src path="config" /&gt; &lt;exclude name="**/*_Ex??.java" /&gt; &lt;classpath refid="compile.classpath" /&gt; &lt;/javac&gt; &lt;/target&gt; In eclipse: windows-> preferences -> Java -> Installed JREs I point to: jdk1.7.0_03. In windows -> preferences -> Java -> Compiler I set compiler complience level: 1.7 When I build via Project->Build project I get no errors, but when I build via the ant script, I get: C:\vaadinSpikeWorkspace\DocumentManager\build.xml:55: java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 51.0 I assume that my ant script is using a different version of the compiler and that's what's causing the problems (which don't appear when I compile manually via eclipse). However, I was under the impressionm that JREs were backwards compatible: I.e. if I'm using the newest version of the JRE (1.7) I shouldn't have issues with different compiler versions? Any help you provide would be greatly appreciated.
type: Question
possible better answer: http://stackoverflow.com/a/20743001
tagged with: ant
tagged with: java
tagged with: eclipse
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20743087
accepted answer: http://stackoverflow.com/a/20743087
favorite count: 0
has answer: http://stackoverflow.com/a/20743001
score: 2
type: AnsweredQuestion
upvote count: 2
has title: Ant Javac target using different JRE from Eclipse? - "java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0"

http://stackoverflow.com/a/21794616
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20782409
has body: Adding SWT.WRAP to the gridTableViewer would not cause the Text in the grid cells to wrap. gridColumn.setWordWrap(true) causes the text entered in the cell to be wrapped after the entered value is applied to the editor(setvalue called). To wrap the text interactively, SWT.WRAP should be added as a style to the TextCellEditor or to Text widget placed in the cells. gridViewerColumn.getColumn.setWordWrap(true); gridTableViewer.setEditingSupport(new EditingSupport(gridTableViewer) { .... @Override protected CellEditor getCellEditor(Object element) { TextCellEditor cellEditor = new TextCellEditor(gridTableViewer.getGrid(), SWT.WRAP) return cellEditor; } Or .... final GridItem item = grid.getItem(grid.getTopIndex()); for (int i = 0; i &lt; grid.getColumnCount(); i++) { final Text text = new Text(grid, SWT.WRAP); Listener textListener = new Listener() { public void handleEvent(final Event e) { switch (e.type) { case SWT.FocusOut: item.setText(column, text.getText()); .... } } } } I have used the SWT.WRAP in the TextCellEditor before, and it works.
upvote count: 2

http://stackoverflow.com/comment/31214544
type: QuestionComment
type: Comment
has text: Sounds Like http://stackoverflow.com/questions/4168772/java-concurrency-countdown-latch-vs-cyclic-barrier?rq=1
score: 2
comment on: http://stackoverflow.com/q/20817063

http://stackoverflow.com/a/20696649
type: Answer
has body: Put the first statement inside a try-catch, if an exception does not occur, then input is definitely a valid float. float aa = 0; try { aa = Float.valueOf(a.getText().toString()); //if above statement executes sucessfully, aa has valid float value here } catch(Exception e){ //if any exception occurs, input is not a valid float, so value of aa is still 0 //no operation required in catch block } The possible exceptions which it may throw are: 1. a.getText() -> NullPointerException 2. Float.valueOf -> NumberFormatException
answers question: http://stackoverflow.com/q/20696542
score: 0

http://stackoverflow.com/q/20796774
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has body: I am new to json and JQuery for clipping html elements from external URL.I tried reading couple books but didn't get it from where and how to start. example how i need. i have a jsp page which has text field and button,I entered "java tutorials" and click on button. then it should go to the google.com and paste the string in the text field and click on the google serach. can anyone please help me how this can be achieved using json and jquery. Thanks in Advance. Srikanth.
downvote count: 0
tagged with: javascript
has answer: http://stackoverflow.com/a/20796886
tagged with: jquery
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31178121
type: UnansweredQuestion
has title: How to submit data to external website using JSON /JQUery and get the results and display in my JSP page
score: 1

http://stackoverflow.com/a/20741399
answers question: http://stackoverflow.com/q/20741168
score: 0
has body: This cannot assign null to testVO. TestVO testVO = new TestVO(); Probably 1) you use testVO before this line is executed, or 2) after this line is executed, you set it to null yourself and then you use it when it's null already. So check your code carefully.
has comment: http://stackoverflow.com/comment/31078651
type: Answer

http://stackoverflow.com/q/20755234
tagged with: swing
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31104279
tagged with: jscrollpane
tagged with: jtextarea
upvote count: 1
has body: As the question states, I'm having trouble with updating the text of a JTextArea that is inside of a JScrollPane. I am able to grab the text from the typecasted getView() of the JScrollPane. However, I have tried the following to update the JTextArea. ((JTextArea)(chatWindow.getViewport().getView())).setText("Hello!"); where chatWindow is the JScrollPane. and I have tried this: chatWindowInsert.setText(processMessage()); where chatWindowInsert is the JTextArea in the JScrollPane Neither work unfortunately. I'm not getting any exceptions, or hanging. Assistance would be appreciated! Here is my complete code. Please excuse me vastly if I've broken a million programming practices. public class ChatterBotClient extends JFrame{ /** * */ private static final long serialVersionUID = 1L; private static ChatterBotFactory chatterBotFactory; private static ChatterBotSession chatterBotSession; private static ChatterBot chatterBot; public static JScrollPane chatWindow; public static JTextField userInput; public static JTextArea chatWindowInsert; public ChatterBotClient() { try{ chatterBotFactory = new ChatterBotFactory(); chatterBot = chatterBotFactory.create(ChatterBotType.CLEVERBOT); chatterBotSession = chatterBot.createSession(); }catch(Exception e) { e.printStackTrace(); System.out.println("Error :O"); JOptionPane.showMessageDialog(null, "There has been a problem initializing the Bot. Please restart."); } initUI(); } public void initUI() { //Define the mainPanel that everything goes into in the JFrame JPanel mainPanel = new JPanel(new BorderLayout()); //Define the child panels of "mainPanel" JPanel infoPanel = new JPanel(new FlowLayout()); JPanel chatHistoryPanel = new JPanel(new FlowLayout()); JPanel userInputAndButtonPanel = new JPanel(new FlowLayout()); setTitle("ChatterBot Chat Client"); setSize(600,300); setResizable(false); //Define each component //Set properties of each component JLabel infoLabel = new JLabel("Welcome to my Cleverbot Client! Please enjoy! :D"); infoL…
answer count: 1
has answer: http://stackoverflow.com/a/20755487
accepted answer: http://stackoverflow.com/a/20755487
favorite count: 0
has comment: http://stackoverflow.com/comment/31104539
type: AnsweredQuestion
downvote count: 0
has title: How do I update the text of a JTextArea inside of a JScrollPane?

http://stackoverflow.com/q/20816142
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/20816337
answer count: 2
has answer: http://stackoverflow.com/a/20816337
has comment: http://stackoverflow.com/comment/31212983
accepted answer: http://stackoverflow.com/a/20816263
has body: I'm currently having problems with accessing and changing the text of jTextField from another class. I'm building an application which has two jTextFields elements in first UI. This two elements serve as boxes for the selected date in the second UI. When a user clicks on the jTextField (first UI) it opens the second UI with a calendar, from which a user selects a date. When user selects a date and confirms it, the selected date appears in the jTextField as text in the first UI. I'm having problems in the last bit. I want to fire the update method for the jTextField (in the first UI which is in the different class) from the class in which I have the second UI.
tagged with: class
score: 0
has title: Accessing and changing text in jTextField from another class
has comment: http://stackoverflow.com/comment/31213065
tagged with: swing
has answer: http://stackoverflow.com/a/20816263
type: AnsweredQuestion

http://stackoverflow.com/q/20739513
answer count: 1
has comment: http://stackoverflow.com/comment/31075860
linked to: http://stackoverflow.com/q/992019
score: 0
tagged with: cryptography
has comment: http://stackoverflow.com/comment/31075442
tagged with: aes
has comment: http://stackoverflow.com/comment/31075446
has comment: http://stackoverflow.com/comment/31076578
has comment: http://stackoverflow.com/comment/31075591
tagged with: encryption
has comment: http://stackoverflow.com/comment/31075647
has answer: http://stackoverflow.com/a/20740597
accepted answer: http://stackoverflow.com/a/20740597
has body: I am trying to encrypt a string in java with AES encryption using a password of any length. Here is my code so far but I do not understand it very well: public static byte[] encrypt(String input, String salt) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { SecretKeySpec key = new SecretKeySpec(salt.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE"); cipher.init(Cipher.ENCRYPT_MODE, key); return cipher.doFinal(input.getBytes()); } How can I make a method to encrypt and decrypt a string of any length using a password of any length it. Also what is salt? I have been using the salt name for the password which only allows me to use a password of 16 characters.
has title: AES encryption in Java using any length password
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/31213570
has text: You can see the solution at the link I have added. the code is pretty standard JPA with a club class and a service Class for handling the add/delete etc. The club has the normal JPA stuff and also the equals/Hash for bean. It also has a converter. So the question is more on a conceptual level. Of course if you have code for a best practice solution it's great.
comment on: http://stackoverflow.com/q/20816405
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31075994
type: Comment
type: QuestionComment
has text: Sorry, I'm new to the site. Uhhhhmm I fixed my "SHOUT" lol sorry about that. Thank you to whoever edited the code structure :D
comment on: http://stackoverflow.com/q/20739836
score: 0

http://stackoverflow.com/a/20687744
answers question: http://stackoverflow.com/q/20687479
score: 2
upvote count: 2
has body: You are calling setContentView() then looking up the view to click, setting a listener AND THEN you are calling setContentView() again. This will wipe out the view you just setup. Not mention that reference to the StepFive button will no longer be in the same hierarchy. Only call setContentView once and then bind your variables and listeners after.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31030919
comment on: http://stackoverflow.com/q/20714804
type: Comment
type: QuestionComment
has text: this kind of information is easy to find with any search engine.
score: 1

http://stackoverflow.com/a/20689618
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20688938
score: 1
upvote count: 1
has body: The Parameter class needs to be able to take a reference to the Sheet object that contains the cell from the formula.

http://stackoverflow.com/comment/31102357
type: QuestionComment
has text: The answer to your question is very dependent on what sort of game this is. Does input from each client need to be pulled, dealt with and sent every tick? are you using a udp or tcp socket? will communication be steady or will it come in bursts?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20753971

http://stackoverflow.com/comment/30984388
score: 0
type: Comment
type: QuestionComment
has text: i have tried with below String className = "test.t456"; Class c = Class.forName(className); Object obj = c.newInstance(); Method[] method = c.getDeclaredMethods(); for(Method m : method) { System.out.println(m.getName()); } able to print method names in console. Now how to run these methods by creating instance of that class.?
comment on: http://stackoverflow.com/q/20689002

http://stackoverflow.com/q/20789441
upvote count: 61
type: Question
has answer: http://stackoverflow.com/a/20789795
tagged with: spring
has answer: http://stackoverflow.com/a/27501557
accepted answer: http://stackoverflow.com/a/20789795
tagged with: java
answer count: 3
has title: How to show localization messages with parameters in Spring 3 / Thymeleaf
possible better answer: http://stackoverflow.com/a/27501557
tagged with: thymeleaf
score: 61
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/57266584
favorite count: 0
has body: I'm using Spring 3 and Thymeleaf to make some webpages and I am lost as for how to show messages like this: welcome.message=Hello {0}, welcome! and then replace {0} with the user name inside thymeleaf tags: Welcome Placeholder I'm not even sure if {0} is the right syntax for the bundle message.

http://stackoverflow.com/q/20691279
tagged with: apache-felix
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20691429
tagged with: osgi-bundle
tagged with: java
type: Question
score: 0
tagged with: osgi
answer count: 1
has title: Call JDBC and UCP connection from OSGI bundle
has body: I have a specific question about calling initializing JDBC and UCP connection into byndle activator. I created this activator: public class Activator implements BundleActivator { @Override public void start(BundleContext bc) throws Exception { testOracleUCP(); System.out.println("Started module"); } @Override public void stop(BundleContext bc) throws Exception { } public void testOracleUCP() throws Exception { System.out.println("Test Oracle UCP"); Connection conn = null; try { conn = OracleDS_UCP.getConnection(); OracleDS_UCP.getPoolDataSourceStatus(); } catch (SQLException e) { throw e; } finally { if (conn != null) conn.close(); } } } And I use this Java class to call initialize the connection: public class OracleDS_UCP { protected static final PoolDataSource pds; static { pds = initPoolDataSource(); } public static Connection getConnection() throws SQLException { if (pds == null) return null; Connection conn = pds.getConnection(); conn.setAutoCommit(false); return conn; } private static PoolDataSource initPoolDataSource() { try { System.out.println("\nStarting Oracle UCP Connection"); PoolDataSource pool = PoolDataSourceFactory.getPoolDataSource(); pool.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource"); pool.setURL("jdbc:oracle:thin:@146.185.142.243:1521:XE"); pool.setUser("SYSTEM"); pool.setPassword("4r3e2w1q"); //Setting pool properties (can be retrieved from config file) pool.setMaxStatements(10); // the maximum number of statements that may be pooled or cached on a connection. pool.setInitialPoolSize(2); pool.setMinPoolSize(1); pool.setMaxPoolSize(50); pool.setLoginTimeout(60); // one minute pool.setConnectionWaitTimeout(60); // one minute pool.setAbandonedConnectionTimeout(30 * 60); // thirty minutes pool.setMaxIdleTime(60 * 60); // one hour and kill inactive or idle connections pool.setInactiveConnectionTimeout(60 * 60); // one hour and kill inactive or idle connections pool.setConnectionWaitTimeout(0); // do not wait for a used connection…

http://stackoverflow.com/comment/31235733
type: AnswerComment
has text: You figured out the most important technique of Swing layout manager wrangling: if the layout manager needs to do two jobs (here forming lines of blocks and centering the lines), liberally add nested JPanels to have extra layout managers at your disposal and make every one of them trivial.
type: Comment
comment on: http://stackoverflow.com/a/20827505
score: 1

http://stackoverflow.com/comment/127393103
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27726471
has text: *Why* is it easier to understand? Can you elaborate?
type: AnswerComment

http://stackoverflow.com/q/20837579
downvote count: 0
score: 7
tagged with: java
has body: I have created a java gwt application in which I want to verify user's email address from client side, is there any way to generate random 5 character code on client side? Any sort of help will be appreciated.
type: Question
has comment: http://stackoverflow.com/comment/31252670
has answer: http://stackoverflow.com/a/20838443
has comment: http://stackoverflow.com/comment/31252779
possible better answer: http://stackoverflow.com/a/20837761
answer count: 3
upvote count: 7
accepted answer: http://stackoverflow.com/a/20851276
favorite count: 0
tagged with: code-generation
has answer: http://stackoverflow.com/a/20851276
has title: Generate random codes in Client-Side of GWT
linked to: http://stackoverflow.com/q/20536566
tagged with: gwt
has comment: http://stackoverflow.com/comment/31253245
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20837761

http://stackoverflow.com/a/20821116
has body: The following code send(new UpdateOneMessage(1 + i, id, "updatedState")); // .. read response suggest that you switch direction of the traffic on each message. That is, you wait on response on each request before sending the next. This architecture is going to put some constraints on how fast you can run. The latency that each message is going to experience is going to hit the general throughput of your server. If you move the client and server to two different locations with some distance between them, you will see an even slower transfer rate. With e.g 1500 km of network, the speed of light will ensure that you at a maximum gets a 100 round trips per second. With 55 bytes per message that's only 5.5 Kb per second. If you need faster transfer you can do several things. The most obvious fix is to increase message size. This will give the most on longer distances. Don't wait for responses before sending the next messages. This can increase throughput tremendously. Use new connection + thread for each request. This way you can have several parallel requests underway at the same time.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20820771
has comment: http://stackoverflow.com/comment/31223159
answers question: http://stackoverflow.com/q/20820771
upvote count: 3

http://stackoverflow.com/a/20849409
upvote count: 2
answers question: http://stackoverflow.com/q/20849263
score: 2
has comment: http://stackoverflow.com/comment/31275327
downvote count: 0
has comment: http://stackoverflow.com/comment/31275861
has comment: http://stackoverflow.com/comment/31275838
type: Answer
has body: Make sure you flush()/close (flush()/close()) the OutputStream after marshalling to it. Demo When I run a slightly modified version of your code (see below), I get a file with contents produced. import java.io.*; import javax.xml.bind.*; public class Demo { public static void main(String[] args) throws Exception { Demo demo = new Demo(); demo.marshal(); } private void marshal() throws Exception { final Kml __balloonKML = new Kml(); //final de.micromata.opengis.kml.v_2_2_0.Document baloonDocument = __balloonKML.createAndSetDocument(); OutputStream o = new FileOutputStream("test.kml"); try { // __balloonKML.marshal(o); Marshaller m = createMarshaller(); m.marshal(__balloonKML, o); //o.flush(); o.close(); } catch (JAXBException _x) { _x.printStackTrace(); } } private JAXBContext getJaxbContext() throws JAXBException { JAXBContext jc = null; jc = JAXBContext.newInstance(new Class[] { Kml.class }); return jc; } private Marshaller createMarshaller() throws JAXBException { Marshaller m = null; m = getJaxbContext().createMarshaller(); //m.setProperty("jaxb.formatted.output", Boolean.valueOf(true)); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //m.setProperty("com.sun.xml.bind.namespacePrefixMapper", true); return m; } } Output File (test.kml) &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;kml/&gt; Java Model (Kml) Below is the simplified model class I am using. import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Kml { }
has comment: http://stackoverflow.com/comment/68198984
has comment: http://stackoverflow.com/comment/31275629

http://stackoverflow.com/q/20809661
has title: Hibernate map several relationship to same table
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20821619
tagged with: oracle11g
type: Question
type: AnsweredQuestion
has body: I have the following ER: I want to know how I can map the third table using hibernate. I have this code: @ManyToOne(optional = false) @JoinColumns({ @JoinColumn(name = "tbl3_tbl1_id", referencedColumnName = "tbl2_tbl1_id", insertable = false, updatable = false), @JoinColumn(name = "tbl3_tbl2_id", referencedColumnName = "tbl2_id", insertable = false, updatable = false)}) public TableDB getTableDB() { return tableDB; } @OneToOne(optional = false) @JoinColumns({ @JoinColumn(name = "tbl3_tbl1_id", referencedColumnName = "tbl2_tbl1_id", insertable = false, updatable = false), @JoinColumn(name = "tbl3_tbl2_id_2", referencedColumnName = "tbl2_id", insertable = false, updatable = false)}) public TableDB getTableDB2() { return tableDB2; } @OneToOne(optional = false) @JoinColumns({ @JoinColumn(name = "tbl3_tbl1_id", referencedColumnName = "tbl2_tbl1_id", insertable = false, updatable = false), @JoinColumn(name = "tbl3_tbl2_id_3", referencedColumnName = "tbl2_id", insertable = false, updatable = false)}) public TableDB getTableDB3() { return tableDB3; } The problem lies in the one to one 2 and 3. When I call the method "save" the insertion code is something like this: insert into table3 (tbl3_desc, tbl3_id, tbl3_tbl1_id, tbl3_tbl2_id) values (?, ?, ?, ?) Where is the column tbl3_tbl2_id_2, tbl3_tbl2_id_3 ? Any comments or advice?
score: 0
answer count: 1
tagged with: hibernate-mapping
tagged with: spring
accepted answer: http://stackoverflow.com/a/20821619

http://stackoverflow.com/comment/31029277
comment on: http://stackoverflow.com/a/20713742
score: 0
type: AnswerComment
has text: it works with jtp.setLineWrap(false); !!! I'm using private JTextWrapPane jtp = new JTextWrapPane() instead of private JTextWrapPane jtp = new JTextWrapPane( sdLog ); can it be an issue?
type: Comment

http://stackoverflow.com/q/20714804
has answer: http://stackoverflow.com/a/20714965
accepted answer: http://stackoverflow.com/a/20714965
possible better answer: http://stackoverflow.com/a/20714850
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31031093
has comment: http://stackoverflow.com/comment/31030961
type: Question
duplicate of: http://stackoverflow.com/q/37335
has answer: http://stackoverflow.com/a/20714850
answer count: 2
downvote count: 2
has body: I have come across heap errors while loading a large dataset into Jena. `Is there some way by which I may allocate the JVM(Java) a large heap space. I know I can achieve this by making changes into eclipse.ini. But is there some way by which I may increase the Java heap size using command line in linux (I using a 64GB RAM server: running 12.04 Ubuntu LTS server)? The error which I am getting due to less heap space is: exception in thread main gc overhead limit exceeded. Also how can I find the maximum amount of heap space which I can set for my systems I tried export JAVA_OPTS= -Xms4096m -Xmx4096m but ended up getting the error: bash: export: -Xms4096m': not a valid identifier bash: export:-Xmx4096m': not a valid identifier
has title: How to allocate space to JAVA using command line
has comment: http://stackoverflow.com/comment/31030822
has comment: http://stackoverflow.com/comment/31030867
favorite count: 0
linked to: http://stackoverflow.com/q/37335
has comment: http://stackoverflow.com/comment/31031079
has comment: http://stackoverflow.com/comment/31030919
upvote count: 4

http://stackoverflow.com/comment/31091392
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20747545
type: Comment
has text: My appology I did'nt understand your graphical mode.But as far as I am getting,you want to show buttons which is attached to JPanel and this panel in turn is attached to JFRAME.If it is the case then we need to create number of JButton objects and add it on the JPanel by selecting desired Layout.

http://stackoverflow.com/comment/31168942
type: AnswerComment
has text: I like AspectJ idea, will research more. disclosure: I'm new to java, have to use it instead of C++.
type: Comment
comment on: http://stackoverflow.com/a/20791866
score: 0

http://stackoverflow.com/a/20696351
has comment: http://stackoverflow.com/comment/30997544
has comment: http://stackoverflow.com/comment/30998441
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/30998067
has comment: http://stackoverflow.com/comment/30998302
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31013888
has comment: http://stackoverflow.com/comment/30998122
upvote count: 2
has comment: http://stackoverflow.com/comment/30998507
has body: It's pointless getting the response code before you've sent anything. You're supposed to send the request first, then get the response code, then get the response if required
answers question: http://stackoverflow.com/q/20696245
has comment: http://stackoverflow.com/comment/30998488
accepted answer of: http://stackoverflow.com/q/20696245

http://stackoverflow.com/q/20692921
tagged with: java
upvote count: 1
type: Question
has body: I have the following query : SELECT * FROM project WHERE year = 11 AND orderDate LIKE ? OR orderNo LIKE ? OR prodNo LIKE ? OR prodName LIKE ? OR inquiryDate LIKE ? OR confirmDate LIKE ? OR deliveryLT LIKE ? OR deliveryRiis LIKE ? OR signsPrice LIKE ? OR vrPrice LIKE ? OR deliveryPrice LIKE ? OR unexpectPrice LIKE ? OR riisBonus LIKE ? OR kennBonus LIKE ? OR profit LIKE ? OR profitPercent LIKE ? OR quantity LIKE ?; The problem is, even though the column year is not 11, I still receive the data, is it because I use OR ? (The question marks are used because I use preparedStatements). When I do SELECT * FROM project WHERE year = 11 AND orderDate LIKE ? ; It works fine, so am I correct in assuming it is the OR? If so, how can I solve it? I want one of those to be true and year to be 100% true;
has answer: http://stackoverflow.com/a/20692964
answer count: 2
tagged with: sql
possible better answer: http://stackoverflow.com/a/20692964
downvote count: 0
has answer: http://stackoverflow.com/a/20692967
favorite count: 0
has title: SQL returns search even though check should not
accepted answer: http://stackoverflow.com/a/20692967
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/20766324
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/20767039
possible better answer: http://stackoverflow.com/a/20766513
tagged with: java
has answer: http://stackoverflow.com/a/20766513
has answer: http://stackoverflow.com/a/20767415
has comment: http://stackoverflow.com/comment/31123823
type: Question
has comment: http://stackoverflow.com/comment/31124467
downvote count: 0
tagged with: serializable
tagged with: threadpoolexecutor
answer count: 3
has comment: http://stackoverflow.com/comment/31125491
tagged with: runnable
accepted answer: http://stackoverflow.com/a/20767415
favorite count: 0
upvote count: 2
has body: I am trying to create a replicated BlockingQueue implementation to use in a cluster environment as a distributed task cache. Since it has to be distributed i need all elements of the queue to be Serializable. This is how i define the class; public class ReplicatedBlockingQueue&lt;E extends Serializable&gt; implements BlockingQueue&lt;E&gt; Then i create a blocking queue implementation with Runnable "Job" class, which is both Serializable and Runnable public class Job implements Runnable,Serializable By the time i use this queue to create a ThreadPoolExecutor, Java complains that ReplicatedBlockingQueue is not a defined constructor new ThreadPoolExecutor(4,4, new ReplicatedBlockingQueue&lt;Job&gt;()); If Runnable interface was extending Serializable i would be able to create replicated queue as follows: new ThreadPoolExecutor(4,4, new ReplicatedBlockingQueue&lt;Runnable&gt;()); But unfortunately Runnable is not Serializable How can i use my ReplicatedBlockingQueue implementation with ThreadPoolExecutor ? EDIT: Using Java6 EDIT: Posted the example on the following link. You can compile online by clicking edit button. http://ideone.com/JFFDNa
has title: Java ThreadPoolExecutor with Serializable and Runnable queue elements (Compile error: no suitable constructor found for...)
has comment: http://stackoverflow.com/comment/31125401

http://stackoverflow.com/a/79097987
score: 0
answers question: http://stackoverflow.com/q/20700053
type: Answer
has body: To refer the local jar from other projects. Add this line in your build.gradle implementation files ("absolute jar URL")

http://stackoverflow.com/q/20817033
accepted answer: http://stackoverflow.com/a/20817092
possible better answer: http://stackoverflow.com/a/20817254
has comment: http://stackoverflow.com/comment/31214478
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/20817254
has title: Using reflection to modify the structure of an object
has comment: http://stackoverflow.com/comment/31214486
favorite count: 0
type: Question
score: 4
tagged with: reflection
has answer: http://stackoverflow.com/a/20817293
tagged with: java
has answer: http://stackoverflow.com/a/20817092
linked to: http://stackoverflow.com/q/351577
has body: From wikipedia: reflection is the ability of a computer program to examine and modify the structure and behavior (specifically the values, meta-data, properties and functions) of an object at runtime. Can anyone give me a concrete example of modifying the structure of an object? I'm aware of the following example. Object foo = Class.forName("complete.classpath.and.Foo").newInstance(); Method m = foo.getClass().getDeclaredMethod("hello", new Class&lt;?&gt;[0]); m.invoke(foo); Other ways to get the class and examine structures. But the questions is how modify is done?
upvote count: 4
answer count: 4
has answer: http://stackoverflow.com/a/20817107

http://stackoverflow.com/comment/31084978
comment on: http://stackoverflow.com/q/20744607
score: 1
has text: Not sure what the answer is, but it's important to note that you've got some potential for a NullPointerException in that first block... you say if(player.isPlaying()) and THEN check for player!=null. If player was null, you would have seen a NPE on the call to player.isPlaying(). You should either move the null check out of the isPlaying() if statement, or remove it completely.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31066865
has text: Also, your title and your question are a little bit out of sync; are you trying to find all corners or just four? (Top/Bottom/Left/Right)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20733044
score: 0

http://stackoverflow.com/comment/31166428
type: AnswerComment
type: Comment
has text: @jalbano The PC's firewall needs to allow the port and the router needs to pass the public port to this machine's port.
comment on: http://stackoverflow.com/a/20777219
score: 0

http://stackoverflow.com/comment/31063667
has text: If you use `A<?>`, you're essentially saying "an `A` of anything". You can't pass an object into any method that expects that *anything* because you don't know its type.
comment on: http://stackoverflow.com/q/20732853
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20790719
has body: According to the docs, it returns an InputStream. But also according to the docs, InputStream is an abstract class. So which particular subclass does .openStream() return?
has title: What does URL.openStream() return?
score: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/20790757
favorite count: 0
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20790757
has comment: http://stackoverflow.com/comment/31166636
has comment: http://stackoverflow.com/comment/31166615

http://stackoverflow.com/comment/31110179
comment on: http://stackoverflow.com/q/20753419
has text: @Luiz I have posted a code that I tried in the answe section
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31257296
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20839623
has text: Have you download the jar?

http://stackoverflow.com/a/20759066
type: Answer
answers question: http://stackoverflow.com/q/20758916
upvote count: 9
accepted answer of: http://stackoverflow.com/q/20758916
score: 9
type: AcceptedAnswer
downvote count: 0
has body: Normally it would be enough to make the constructor private to prevent others classes from instantiating a PicassoSingleton. Throwing an exception in the private constructor seems to be paranoid programming, because the implementor of a class knows it's internal details and must know what he does. But there is one reason when it makes sense. Throwing an exception in the constructor will also prevent others from using reflection to instantiate an object of the class. This will be impossible Constructor&lt;PicassoSingleton&gt; constructor = PicassoSingleton.class.getDeclaredConstructor(); constructor.setAccessible(true); constructor.newInstance(); // will throw the AssertionError - impossible to instantiate it

http://stackoverflow.com/q/20708889
has comment: http://stackoverflow.com/comment/31019708
type: Question
answer count: 2
tagged with: locking
has title: How to load from database and reset Configuration mapping in Web application
has body: I need to load Configuration mapping from the database. The configuration mapping is represented as Hashtable&lt;String, Hashtable&lt;String,String&gt;&gt; We cannot load the mapping on the start since we depend on another war application for database connection. So, the mapping is loaded on the first call to configuration in the class(singleton) ResourcesStorage implementing ServletContextListener. At the same time the reset JSP calls static reset() method in this listener. I added synchronization using reentrant lock. I am locking only resetting because different threads should be able to retrieve data simultaneously. However, this does not work well. I am getting IllegalMonitorStateException on notFull.await(); java.lang.IllegalMonitorStateException at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:127) at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1175) at java.util.concurrent.locks.AbstractQueuedSynchronizer.fullyRelease(AbstractQueuedSynchronizer.java:1606) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1922) Is my design correct? import java.util.Hashtable; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ResourcesStorage implements ServletContextListener { private static ResourcesStorage instance; protected static Log log = LogFactory.getLog(ResourcesStorage.class); protected Hashtable&lt;String, Hashtable&lt;String,String&gt;&gt; DBsettings =new Hashtable &lt;String, Hashtable&lt;String,String&gt;&gt;(); private ServletContext context = null; private boolean isLoading = false; public synchronized boolean isLoading(…
has answer: http://stackoverflow.com/a/20709157
score: 0
accepted answer: http://stackoverflow.com/a/20709157
has comment: http://stackoverflow.com/comment/31019758
tagged with: multithreading
tagged with: web-applications
possible better answer: http://stackoverflow.com/a/20723502
has answer: http://stackoverflow.com/a/20723502
tagged with: servletcontextlistener
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/20787520
score: 0
has comment: http://stackoverflow.com/comment/31160774
upvote count: 1
answer count: 1
downvote count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31160541
has answer: http://stackoverflow.com/a/20787557
accepted answer: http://stackoverflow.com/a/20787557
has body: I was wondering if it's possible to make up a command, let's say we have a Scanner. Here's example: Scanner INPUT = new Scanner(System.in); int IsPoints = 0; String isValue = INPUT.nextLine(); if (isValue.equalsIgnoreCase("give"){ isPoints += The int value you want here; } So my real question is, is it possible to increase the int value of points, via a String command? The output, if it worked, would be give X (Amount of points you want = x) So if I did give 5000 I'd get 5000 points, is that possible to do? Thanks
has title: Java Integer with String?
has comment: http://stackoverflow.com/comment/31160581
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31160585
tagged with: int

http://stackoverflow.com/comment/31230757
has text: Normally you wouldn't do a select using a prepare.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20817417

http://stackoverflow.com/q/20849464
has answer: http://stackoverflow.com/a/20849644
has title: How to add Progress bar to File Copy in Java
accepted answer: http://stackoverflow.com/a/20849644
answer count: 1
type: AnsweredQuestion
has body: so I have class that is used to copy all of a specific file type from one directory to another directory. This class does work, but I am curious on what would be the best method of adding a progress bar to let the users know how far along in copying all the files. So my question is, what would be the best method of adding a progress bar to this class. As you may see, there is no GUI being made by this class as it stands. import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; public class CopyFilesFromType { public static void main(File SourcePath, File DestPath) { new CopyFilesFromType().copy("tif", SourcePath.toString(), DestPath.toString()); } private FileTypeOrFolderFilter filter = null; private void copy(final String fileType, String fromPath, String outputPath) { filter = new FileTypeOrFolderFilter(fileType); File currentFolder = new File(fromPath); File outputFolder = new File(outputPath); scanFolder(fileType, currentFolder, outputFolder); } private void scanFolder(final String fileType, File currentFolder, File outputFolder) { System.out.println("Scanning folder [" + currentFolder + "]..."); File[] files = currentFolder.listFiles(filter); for (File file : files) { if (file.isDirectory()) { scanFolder(fileType, file, outputFolder); } else { copy(file, outputFolder); } } } private void copy(File file, File outputFolder) { try { System.out.println("\tCopying [" + file + "] to folder [" + outputFolder + "]..."); InputStream input = new FileInputStream(file); OutputStream out = new FileOutputStream(new File(outputFolder + File.separator + file.getName())); byte data[] = new byte[input.available()]; input.read(data); out.write(data); out.flush(); out.close(); input.close(); } catch (Exception e) { throw new RuntimeException(e); } } private final class FileTypeOrFolderFilter implements FileFilter { private final String fileType; private FileTypeOrFolder…
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31275388

http://stackoverflow.com/comment/31108661
comment on: http://stackoverflow.com/a/20736634
score: 0
type: Comment
has text: I think so, although I have never tried it in Java. Also, you can find an example about "Embedding Vert.x core" in the vertx doc you mentioned. That example showed how to create a TCP server with an embeded Vert.x. BTW, if your purpose is only to create a websocket server and don't want to use other features in vertx. You can try [Java-WebSocket](https://github.com/TooTallNate/Java-WebSocket) too.
type: AnswerComment

http://stackoverflow.com/q/20829825
has comment: http://stackoverflow.com/comment/31239737
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31238828
answer count: 0
type: UnansweredQuestion
tagged with: logcat
tagged with: java
type: Question
score: 0
has body: Ive created a button that needs to be pressed and it was working for a while but now the program crashes every time its pressed. Heres my logcat: http://pastebin.com/CvJvLmfs Thanks, all help appreciated. Btw. I also found this Fatal Exception:main although I havent extended List Activity?Thanks again.
has title: FATAL EXCEPTION:main &Other logcat errors?
tagged with: android

http://stackoverflow.com/comment/31172971
type: AnswerComment
comment on: http://stackoverflow.com/a/20793335
score: 0
type: Comment
has text: That I did not know. Thanks for the feedback.

http://stackoverflow.com/a/58098678
downvote count: 0
has comment: http://stackoverflow.com/comment/120791029
answers question: http://stackoverflow.com/q/20824634
score: 6
has body: I wrote my own extension for this, very helpful for me. (Kotlin) You can write only like that : editText.customAfterTextChanged { editable -&gt; //You have accessed the editable object. } My extension : fun EditText.customAfterTextChanged(action: (Editable?)-&gt; Unit){ this.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} override fun afterTextChanged(editable: Editable?) { action(editable) } })}
has comment: http://stackoverflow.com/comment/120644241
upvote count: 6
has comment: http://stackoverflow.com/comment/120818309
has comment: http://stackoverflow.com/comment/120804547
type: Answer

http://stackoverflow.com/q/20791996
accepted answer: http://stackoverflow.com/a/20793811
upvote count: 4
answer count: 2
has title: Resize JavaFX table
downvote count: 0
has answer: http://stackoverflow.com/a/20793684
score: 4
favorite count: 0
tagged with: javafx-8
tagged with: javafx-2
type: AnsweredQuestion
has body: I have this simple example of a table. import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellEditEvent; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.stage.Stage; import javafx.util.Callback; public class MainApp extends Application { private TableView&lt;Person&gt; table = new TableView&lt;&gt;(); private final ObservableList&lt;Person&gt; data = FXCollections.observableArrayList( new Person("Processor", "72"), new Person("RAM", "78"), new Person("HDD Free Space", "890"), new Person("Lan Adapter NIC 1", "36"), new Person("Lan Adapter NIC 2", "67")); public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Table View Sample"); //stage.setWidth(850); //stage.setHeight(550); final Label label = new Label("Address Book"); label.setFont(new Font("Arial", 20)); table.setEditable(false); Callback&lt;TableColumn, TableCell&gt; cellFactory = new Callback&lt;TableColumn, TableCell&gt;() { @Override public TableCell call(TableColumn p) { return new EditingCell(); } }; table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); TableColumn firstNameCol = new TableColumn("Credentials"); //firstNameCol.setPrefWidth(300); firstNameCol.setMinWidth(50); //firstNameCol.prefWidthProperty().bind(table.widthProper…
possible better answer: http://stackoverflow.com/a/20793684
type: Question
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/20793811

http://stackoverflow.com/q/20801435
tagged with: java
possible better answer: http://stackoverflow.com/a/20803371
type: Question
has answer: http://stackoverflow.com/a/20801514
linked to: http://stackoverflow.com/q/16408505
answer count: 2
downvote count: 0
has title: Retrieving Image from internet
favorite count: 0
has body: I've got the following code from "Android in Practice" book. It's implementation of custom adapter which downloads images from the internet. It uses private class RetrieveImageTask to retrieve pictures. Can someone explain me why the first thing the adapter class does is to get image from the cache instead of downloading it ? I understand it in a way that, the first time it displays default image which was set in the beginning of getView(), then sets downloaded image, but does it mean that view is being refreshed constantly by calling getView() ? And why author sets tag of image to item ID in getView() and then sets it to null in onPostExecute() ? DealsAdapter private class DealsAdapter extends ArrayAdapter&lt;Item&gt; { public DealsAdapter(List&lt;Item&gt; items) { super(DealList.this, R.layout.list_item, items); } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.list_item, parent, false); } // use ViewHolder here to prevent multiple calls to findViewById (if you have a large collection) TextView text = (TextView) convertView.findViewById(R.id.deal_title); ImageView image = (ImageView) convertView.findViewById(R.id.deal_img); image.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ddicon)); Item item = getItem(position); if (item != null) { text.setText(item.getTitle()); Bitmap bitmap = app.getImageCache().get(item.getItemId()); //&lt;------HERE if (bitmap != null) { image.setImageBitmap(bitmap); } else { // put item ID on image as TAG for use in task image.setTag(item.getItemId()); // separate thread/via task, for retrieving each image // (note that this is brittle as is, should stop all threads in onPause) new RetrieveImageTask(image).execute(item.getSmallPicUrl()); } } return convertView; } } RetriveImageTask private class RetrieveImageTask extends As…
accepted answer: http://stackoverflow.com/a/20801514
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/20803371
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/20735211
type: Question
possible better answer: http://stackoverflow.com/a/20757614
tagged with: guice
has answer: http://stackoverflow.com/a/33397567
answer count: 3
downvote count: 0
has body: Having to deal with Guice, I wonder how I should handle dependencies in terms of modules. In Guice every module is provided by an instance. So if I have a module requiring a certain service it creates the module adding a binding to that service and installs it (binder.install(module)). Now I have two independent modules that make completely sense to be used independently and both install the same database module. Using both modules independently no problem arise but what happens if both modules are used in the same application? The database module will be loaded by both modules independently and that can not be correct. Is there a way to ask the binder if a certain type has already a binding? I can not use getProvider to check on that since all that is returned is a LookupProvider regardless if something is already bind or not. So how one has to deal with this scenario? Update: It seams Guice is unable to provide the following feature: Check if a given module was already loaded. Check if a given class was already bound. Use Providers within the configuration to be able to do distributed configuration (modules being able to configure objects being contributed).
has answer: http://stackoverflow.com/a/20736841
favorite count: 0
upvote count: 13
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20757614
accepted answer: http://stackoverflow.com/a/20736841
score: 13
has title: Ensure Module Is Loaded Only Once In Guice

http://stackoverflow.com/q/20790019
has answer: http://stackoverflow.com/a/20790810
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20790178
has comment: http://stackoverflow.com/comment/31165571
tagged with: repaint
score: 2
upvote count: 2
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31165589
has comment: http://stackoverflow.com/comment/31165564
tagged with: java
answer count: 2
has title: Java Waiting for repaint() method to finish - Don't know how to implement
downvote count: 0
has body: I have searched through the many questions saying wait until repaint has finished but I have never found an answer that I could really implement or understand! I don't want the code to continue when the screen has been repainted! I have a simple function: public static void clearScreen() { panel.repaint(); } I can tell you now that this works! The only problem being that it does not wait to repaint so for example: public static void blah() { drawSomething(); clearScreen(); drawSomething(); } There is a good chance that both drawings would get clear from the screen. As you might be able to guess I do not want this! I would just like to mention that all the separate functions work!
favorite count: 0
has comment: http://stackoverflow.com/comment/31165434

http://stackoverflow.com/comment/32907835
has text: The content of the "activity to test" is what I'm missing. I don't know what methods you are calling, how you use the SiteLoader, even how to reproduce the bug. Sorry I don't think I can help if you cannot provide a reduced test case. :-(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20748988
score: 0

http://stackoverflow.com/comment/30995338
type: Comment
has text: What's the purpose of the `Game` class? Why not just run everything from the Gui class?
type: QuestionComment
comment on: http://stackoverflow.com/q/20695014
score: 0

http://stackoverflow.com/a/20736828
type: Answer
answers question: http://stackoverflow.com/q/20736789
score: 0
has body: When you call insertElement with an array with 3 elements, your array newPets will have a length of 4. These elements are [0], [1], [2] and [3]. Then you try to access the element with the index equal to its length, which is [4]. There is no such element, so you get an out-of-bounds exception.

http://stackoverflow.com/comment/31232523
type: AnswerComment
type: Comment
has text: Thx, it works. You just have to remover "invokeLater" and use "main" method, as I did. Or write About x = new About(this,true); x.setVisible(true);
comment on: http://stackoverflow.com/a/20826477
score: 0

http://stackoverflow.com/comment/57966972
has text: @dmitry.sh What i meant is "for reading operation, why do we need a transaction with commit and rollback?". What it is going to commit/rollback?
comment on: http://stackoverflow.com/a/20781443
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/20740287
has answer: http://stackoverflow.com/a/21300826
has comment: http://stackoverflow.com/comment/31247894
has body: I am trying to run an application using Dropbox core API. The sample program will upload the file to my Dropbox account. I got the app key and secret from the Dropbox. I tried to run the sample program, but got stuck. Facing some problem in authorizing the app. The sample program will print a URL, we have to copy the URL in order to authorize the app. Then authorize the app by clicking allow, I am getting this message: "Enter this code into agri to finish the process". Regarding the code { // Have the user sign in and authorize your app. String authorizeUrl = webAuth.start(); System.out.println("1. Go to: " + authorizeUrl); System.out.println("2. Click (you might have to log in first)"); System.out.println("3. Copy the authorization code."); //got stuck over here String code = new BufferedReader(new InputStreamReader(System.in)).readLine().trim(); DbxAuthFinish authFinish = webAuth.finish(code); DbxClient client = new DbxClient(config, authFinish.accessToken); System.out.println("Linked account: " + client.getAccountInfo().displayName); File inputFile = new File("serialData.xlsx"); inputStream = new FileInputStream(inputFile); DbxEntry.File uploadedFile = client.uploadFile("serialData.xlsx",DbxWriteMode.add(), inputFile.length(), inputStream); System.out.println("Uploaded: " + uploadedFile.toString()); }
has comment: http://stackoverflow.com/comment/31078441
has comment: http://stackoverflow.com/comment/31103150
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31107445
tagged with: dropbox
has comment: http://stackoverflow.com/comment/31104907
has comment: http://stackoverflow.com/comment/31108234
has comment: http://stackoverflow.com/comment/31080170
score: 0
tagged with: api
answer count: 1
has comment: http://stackoverflow.com/comment/31079176
type: UnansweredQuestion
has title: uploading file to dropbox
has comment: http://stackoverflow.com/comment/31107591

http://stackoverflow.com/a/20728827
type: Answer
answers question: http://stackoverflow.com/q/20728621
has comment: http://stackoverflow.com/comment/31056279
has comment: http://stackoverflow.com/comment/31056903
has comment: http://stackoverflow.com/comment/39388575
has comment: http://stackoverflow.com/comment/31057592
has comment: http://stackoverflow.com/comment/44955249
score: 22
has body: Since question is marked with gradle tag I assume you want to run jar from gradle build. I also assume you use java plugin for your gradle build. Add next lines in your gradle: task runFinalJar(type: JavaExec) { classpath = files('build/libs/foo.jar') classpath += sourceSets.main.runtimeClasspath main = full.package.classname } You can now include your task to the build process: build.dependsOn.add("runFinalJar") Or just run it form command line: gradle build runFinalJar UPDATE: It is cleaner to use application plugin as Peter suggested
downvote count: 2
upvote count: 24
has comment: http://stackoverflow.com/comment/44991260

http://stackoverflow.com/a/20705673
has comment: http://stackoverflow.com/comment/31013426
score: 0
type: Answer
has body: You create an array of size 0, ie. no elements int ctr = 0, ... int [] value = new int [ctr]; and then try to access the first element value[ctr] = ... Consider using an ArrayList that dynamically resizes itself and add the elements to it.
has comment: http://stackoverflow.com/comment/31013453
answers question: http://stackoverflow.com/q/20705652

http://stackoverflow.com/comment/31216281
type: Comment
comment on: http://stackoverflow.com/q/20817873
type: QuestionComment
has text: Well actually you are importing `java.util.Set` and your class is calling `set` this is not a good practise, lead to confussion (and you are not following java code conventions). But an ArrayList doesn't implement `Set` interface then it's why you get that error.
score: 0

http://stackoverflow.com/a/20828554
has comment: http://stackoverflow.com/comment/31236595
has comment: http://stackoverflow.com/comment/31236256
type: Answer
has comment: http://stackoverflow.com/comment/31236406
has comment: http://stackoverflow.com/comment/31236659
has comment: http://stackoverflow.com/comment/31236772
has comment: http://stackoverflow.com/comment/31236071
has comment: http://stackoverflow.com/comment/31236649
has body: The number of valid parenthesis generated with n-pairs is nth catalan number which is defined as 2nCn/(n+1) but if u need more simplified bound then it is O(4^N) . More generally any recursive function is upper bounded by its max branching factor and depth as O(b^d) if work done at each level is O(1) so in this case depth = 2N and branching factor is approximately 2 hence T(n) = 2^(2N)=4^N.
has comment: http://stackoverflow.com/comment/31236682
has comment: http://stackoverflow.com/comment/31236490
answers question: http://stackoverflow.com/q/20827649
has comment: http://stackoverflow.com/comment/31236790
has comment: http://stackoverflow.com/comment/31236681
has comment: http://stackoverflow.com/comment/31236622
has comment: http://stackoverflow.com/comment/31236541
score: 0

http://stackoverflow.com/comment/31162164
comment on: http://stackoverflow.com/q/20782210
score: 0
type: QuestionComment
has text: I'm using form submission to save data. It is simple but I still dont know where the error come from
type: Comment

http://stackoverflow.com/a/20717520
answers question: http://stackoverflow.com/q/20717480
upvote count: 7
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/31035477
type: Answer
score: 6
has body: Try this--- import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JTextField; public class TextFieldTest { public static void main(String[] args) { JFrame f = new JFrame(); f.setLayout(new BorderLayout()); JTextField tf = new JTextField(); f.getContentPane().add(BorderLayout.EAST, tf); f.pack(); f.setVisible(true); } }
accepted answer of: http://stackoverflow.com/q/20717480
has comment: http://stackoverflow.com/comment/31041034
has comment: http://stackoverflow.com/comment/31035537

http://stackoverflow.com/q/20814756
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20814814
tagged with: gallery
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: background
type: Question
score: 9
has title: set an image from gallery for background of desktop phone (android-java)
tagged with: slideshow
has body: I have one app that like a Slide show or gallery but i want when anybody use this app be able to set the image to background on android phone the app can show image i just want to able set image to background - and its can be enough if i can set address of image in Variable and then i can use this Code WallpaperManager wpm = WallpaperManager.getInstance(getApplicationContext()); try { wpm.setResource(R.drawable.image_1); } catch (IOException e) { e.printStackTrace(); }
upvote count: 10

http://stackoverflow.com/comment/30985001
type: QuestionComment
comment on: http://stackoverflow.com/q/20689577
has text: I don't think there's such a thing as "overusing." Just make sure that you're using them appropriately (i.e. scope your beans properly). For more information, see [Bean scopes](http://docs.spring.io/spring/docs/3.0.0.M3/reference/html/ch04s04.html).
type: Comment
score: 1

http://stackoverflow.com/a/20680226
has body: This can be done in following way: For the given word, keep a count of all the characters in it. For example for OSTP, count['O'] = 1; count['S'] = 1; count['T'] = 1; count['P'] = 1; You can form an array of 26 elements like this. Then while iterating through the dictionary, just check which word has the same character count.
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/20680145
upvote count: 4
type: Answer

http://stackoverflow.com/a/20736597
score: 1
answers question: http://stackoverflow.com/q/20734913
upvote count: 1
has comment: http://stackoverflow.com/comment/31103240
type: AcceptedAnswer
downvote count: 0
has body: If you have to have two different types of nodes, then you should consider SOA architecture for your application. Create two environments, environment-a and environment-b. Either set all properties for the environments through AWS web console, or can reuse your existing configuration files and just set the specific configuration file name for each environment. #environment-a PARAM1 = config-environment-a.properties #environment-b PARAM1 = config-environment-b.properties You share the same code base and push to either environment with -e modifier. #push to environment-a $ git aws.push -e environment-a #push to environment-b $ git aws.push -e environment-b You can also create git alias to push to both environments at the same time :-) Now, the major benefit of SOA approach is that you can scale and manage those environments separately. It is simple and elegant. If you want more complex and less elegant, use simple token distribution service. On every environment initialization, send two messages to Amazon SQS. Each message should contain configuration name. Then pull those messages from SQS, each instance will get exactly one from the queue. Whichever configuration name the message contains, configure your node with that configuration. :-) Hope it helps. Update after @vcetinick comment: All still seems rather complex for what should be pretty simple. That's why I suggested separate environments. You can make your own registration service, when the node comes up, it registers with the service and in return gets configuration params. You keep available configurations in persistent DB. If the node dies and the service gets another registration request, the registration service can quickly check registered all nodes (because they all left their info during the registration), and if any of the nodes is not responding, its configuration data is reassigned to the new node. And now you have single point of failure on your hands :-) Again, there might be other ways to approach…
type: Answer
has comment: http://stackoverflow.com/comment/31103650
accepted answer of: http://stackoverflow.com/q/20734913

http://stackoverflow.com/comment/31050281
comment on: http://stackoverflow.com/q/20725258
score: 1
type: Comment
type: QuestionComment
has text: Method signature is getSubimage(x, y, w, h) it looks like you might have (x1,y1,x2,y2) on accident? image.getSubimage(34, 1, 54, 45); -> image.getSubimage(34, 1, 23, 43); unless your 2nd frame is more than 2x as wide as your first

http://stackoverflow.com/comment/31233572
comment on: http://stackoverflow.com/q/20827166
type: Comment
type: QuestionComment
has text: The garbage collector destroys objects that are no longer used, so setting it to null makes it more likely to be destroyed sooner.
score: 1

http://stackoverflow.com/q/20849080
tagged with: spring
has comment: http://stackoverflow.com/comment/31274679
score: 2
tagged with: java
tagged with: quartz-scheduler
has comment: http://stackoverflow.com/comment/31275968
type: Question
has comment: http://stackoverflow.com/comment/31277008
has body: I don't know what I'm doing wrong here. I'm getting error java.lang.NoSuchMethodError: org.springframework.scheduling.quartz.SchedulerFactoryBean.getScheduler()Lorg/quartz/Scheduler; this is caused when public class myJobLauncher { @Autowired @Qualifier("myQuartzScheduler") private SchedulerFactoryBean scheduler_factory = null; ....... ........ Scheduler someScheduler = scheduler_factory.getScheduler(); and here are my xml files <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> .... <bean id="myQuartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> true myScheduler org.quartz.simpl.SimpleThreadPool 1 org.quartz.simpl.RAMJobStore true <bean class="org.springframework.scheduling.quartz.SpringBeanJobFactory" /> not sure why i'm getting that exception here is my pom file entries org.quartz-scheduler quartz 1.8.6 using spring framework 4.0.0 added all spring-context-support,spring-context,beans,transaction. we have some client code which is using above version of quartz ,we are integrating their spring project and adding enhancements to it. so bottom line is we cannot modify t…
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31276498
has title: java.lang.NoSuchMethodError: org.springframework.scheduling.quartz.SchedulerFactoryBean.getScheduler()Lorg/quartz/Scheduler;
has comment: http://stackoverflow.com/comment/31274634
favorite count: 0
has answer: http://stackoverflow.com/a/20888403
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/20791363
has answer: http://stackoverflow.com/a/20791411
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31167796
accepted answer: http://stackoverflow.com/a/20791411
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/31167843
has comment: http://stackoverflow.com/comment/31167938
tagged with: android
answer count: 1
favorite count: 0
has title: understanding a practical use for serialization
has body: Here is what i understand about serialization: It lets you take your object and turn it into a stream of bytes so you can save it to a flat file for later use. I would like to know what what benefit this would serve and why would anyone want to do this.
duplicate of: http://stackoverflow.com/q/2232759
downvote count: 2
linked to: http://stackoverflow.com/q/2232759
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/20738255
possible better answer: http://stackoverflow.com/a/20738299
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21750092
type: Question
answer count: 2
has body: How can i expand the actionbar like PlayNewsstand application and the image below :
downvote count: 0
has title: How to expand android ActionBar?
accepted answer: http://stackoverflow.com/a/21750092
has answer: http://stackoverflow.com/a/20738299
favorite count: 0
tagged with: android
tagged with: android-actionbar

http://stackoverflow.com/comment/31220814
type: Comment
type: QuestionComment
has text: No, `Runtime#exec()` returns a `Process` object. Get and read its error input stream.
comment on: http://stackoverflow.com/q/20820213
score: 0

http://stackoverflow.com/q/20738656
tagged with: javascript
score: -1
has comment: http://stackoverflow.com/comment/31074418
has body: I have the following homework: Write a program using Selenium Webdriver Open up the "parent.htm" file in Firefox. Then click the "Open Modal Popup" button. In the pop-up, click "Open Modal Popup" again. Close all windows by clicking the Close buttons in the Pop-Ups Code done till now: import java.util.List; import java.util.Set; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary; public class popup_test { public static void main(String args[]) throws InterruptedException{ parent(); } public static void parent() throws InterruptedException{ System.setProperty("webdriver.chrome.driver","C:\\jars\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); //WebDriver driver = new FirefoxDriver(); driver.get("C:\\Users\\jain\\Desktop\\popup\\parent.htm"); Thread.sleep(1000); String winHandleBefore1 = driver.getWindowHandle(); driver.findElement(By.id("OpenPopupButton")).click(); Set<String> winHandleColl_After = driver.getWindowHandles(); Object[] ObjHwndvals=winHandleColl_After.toArray(); Object Objhwnd=ObjHwndvals[1]; String strHwnd=(String) Objhwnd; driver=driver.switchTo().window(strHwnd); driver.findElement(By.id("OpenPopupButton")).click(); winHandleColl_After = driver.getWindowHandles(); ObjHwndvals=winHandleColl_After.toArray(); Object Objhwnd3=ObjHwndvals[2]; String strHwnd3=(String) Objhwnd; driver.switchTo().window(strHwnd3).findElement(By.id("MyModalPopup")).click(); driver.switchTo().window(strHwnd).findElement(By.id("MyModalPopup")).click(); } Files: Please save this as .htm extension parent: Parent Window child: Child Window
has title: Unable to switch window in Selenium web driver
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/31075378
has answer: http://stackoverflow.com/a/20741631
tagged with: java
tagged with: selenium
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31134899

http://stackoverflow.com/a/20743398
has body: To ensure you are talking to something/someone you trust, you need a mechanism of authenticating the other party. I'm not aware of a way to achieve this without a piece of data remaining secret: Asymmetric authentication (i.e. your current implementation) requires the private key data to remain private. Symmetric authentication requires that the shared secret remains private. In the future, TrustZone will allow applications to store secret data in the secure element of the handset. Until that time, however, you are always at risk of malware on your devices. Adding a password to your keystore (that the user knows, not the app) might add an additional hurdle to an attacker, however once the phone is infected then the password can be snooped. To minimise your risk profile you should produce per-device keys, rather than a single cert/key-pair combo that you incorporate into your application. This will, of course, increase the effort required to add new users as some form of registration will be required (e.g. certifying their key). Alternatively you can push the problem out to your users and have them decide who to trust, PGP-style.
answers question: http://stackoverflow.com/q/20719060
type: Answer
score: 0

http://stackoverflow.com/q/20836485
has answer: http://stackoverflow.com/a/20836761
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31250761
has title: parsing data to listview in android
type: Question
tagged with: android-listview
tagged with: android
accepted answer: http://stackoverflow.com/a/20836761
score: 0
tagged with: java
has body: I am trying to display parsed jason data to listview ListViewAdapterForAtomicListItemtype.java public class ListViewAdapterForAtomicListItemtype extends BaseAdapter { // Declare Variables Context context; LayoutInflater inflater; ArrayList&lt;HashMap&lt;String, String&gt;&gt; data; HashMap&lt;String, String&gt; resultp = new HashMap&lt;String, String&gt;(); public ListViewAdapterForAtomicListItemtype(Context context, ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist) { this.context = context; data = arraylist; } @Override public int getCount() { return data.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } public View getView(final int position, View convertView, ViewGroup parent) { // Declare Variables TextView name; inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View itemView = inflater.inflate(R.layout.listview_item_for_atomic_list_item_type, parent, false); // Get the position resultp = data.get(position); // Locate the TextViews in listview_item.xml name = (TextView) itemView.findViewById(R.id.textView_id_atomic_list_item_type); // Capture position and set results to the TextViews name.setText(resultp.get(MainActivity.NAME)); return itemView; } } BLD_IndividualListOfItems_MainCourse.java public class BLD_IndividualListOfItems_MainCourse extends Activity{ // Declare Variables JSONObject jsonobject; JSONArray jsonarray; ListView listview; ListViewAdapterForAtomicListItemtype adapter; ProgressDialog mProgressDialog; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist; static String NAME = "rank"; String TYPE_FILTER; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from listview_main.xml setContentView(R.layout.listview_main); TYPE_FILTER = getIntent().getExtras().getString("key_title"); Log.v("---- Value-MC---", TYPE_FILTER); // Locate the listview in listview_main.xml…
answer count: 1
has comment: http://stackoverflow.com/comment/31250988

http://stackoverflow.com/q/20750746
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20750782
has answer: http://stackoverflow.com/a/20750782
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/20750853
score: 5
tagged with: for-loop
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/20750853
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31096099
has body: I'm going to make this 2D rendering engine as modular as I possibly can. I've come up with, but haven't yet finished, a priority list for drawing/updating sprites, so that I can control which sprites are in front of each other. This code is meant to loop through each priority list and render every sprite in that list. //I don't entirely understand what this for-each type of loop does. public static void renderSprites(ArrayList&lt;ArrayList&lt;AbstractSprite&gt;&gt; priorities){ for (ArrayList&lt;AbstractSprite&gt; priority : priorities){ for(AbstractSprite sprite : priorities.get(priority)){ renderSprite(/* what should I reference to get the relevant sprite? */); //this is my best guess at what the nested loop would be, but it obviously doesn't work. //any ideas? } } }
has answer: http://stackoverflow.com/a/20750914
has title: How to do a for loop over a nested ArrayList?

http://stackoverflow.com/comment/31062357
comment on: http://stackoverflow.com/q/20730987
score: 0
type: Comment
type: QuestionComment
has text: I would like to be able to edit them in eclipse

http://stackoverflow.com/a/20778212
answers question: http://stackoverflow.com/q/20778181
has body: Another way would be to add an OnClickListener to the itemView itself: // this code goes inside your getView() method itemView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, YourActivity.class); startActivity(intent); } }); return itemView;
type: Answer
downvote count: 0
score: 2
upvote count: 2

http://stackoverflow.com/comment/56346817
type: Comment
score: 3
has text: Direct link to the preview docs for JDK9 Stream, with `takeWhile`/`dropWhile`: http://download.java.net/jdk9/docs/api/java/util/stream/Stream.html
comment on: http://stackoverflow.com/a/32304570
type: AnswerComment

http://stackoverflow.com/q/20744062
score: 6
has body: I've quite new to MongoDB and it's Java driver. I need to update the value of a subfield, but I can't find any examples online. The document: { "_id" : ObjectId("45678942342"), "user" : "me", "aStruct" : { "subfield_1" : true, "subfield_2" : true } } How do I update the value of subfield subfield_1 to false, for every document that has user = me ? Thank you.
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20744087
tagged with: java
type: Question
tagged with: mongodb
has title: Updating value of a subfield in MongoDB with Java driver?
downvote count: 0
has answer: http://stackoverflow.com/a/20744087
answer count: 1
favorite count: 0

http://stackoverflow.com/a/20781878
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31152338
upvote count: 2
answers question: http://stackoverflow.com/q/20781776
has body: Your project contains several version of android.support.v4.jar file. Use same version of android.support.v4 jar file on your MainProject and it's Library Project. android.support.v4.jar file exists on TestProject/libs/android.support.v4.jar folder.
accepted answer of: http://stackoverflow.com/q/20781776
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20810424
type: UnansweredQuestion
has body: So I am looking at some examples of networking code and I can't figure out what this does. I'm assuming that it creates a new variable in the given class but I cannot seem to do that myself. Could someone explain to me what it does? The actual line is: Game.Player playerX = game.new Player(listener.accept(), 'X'); Game is another class in the program and Player is a thread class. I am wondering what Game.Player playerX and game.new Player does. I will paste the rest of relevant code below. Main class: public class TicTacToeServer { public static void main(String[] args) throws Exception { ServerSocket listener = new ServerSocket(8901); System.out.println("Tic Tac Toe Server is Running"); try { while (true) { Game game = new Game(); Game.Player playerX = game.new Player(listener.accept(), 'X'); Game.Player playerO = game.new Player(listener.accept(), 'O'); playerX.setOpponent(playerO); playerO.setOpponent(playerX); game.currentPlayer = playerX; playerX.start(); playerO.start(); } } finally { listener.close(); } } } Game class: class Game { private Player[] board = { null, null, null, null, null, null, null, null, null}; Player currentPlayer; public boolean hasWinner() { return (board[0] != null &amp;&amp; board[0] == board[1] &amp;&amp; board[0] == board[2]) ||(board[3] != null &amp;&amp; board[3] == board[4] &amp;&amp; board[3] == board[5]) ||(board[6] != null &amp;&amp; board[6] == board[7] &amp;&amp; board[6] == board[8]) ||(board[0] != null &amp;&amp; board[0] == board[3] &amp;&amp; board[0] == board[6]) ||(board[1] != null &amp;&amp; board[1] == board[4] &amp;&amp; board[1] == board[7]) ||(board[2] != null &amp;&amp; board[2] == board[5] &amp;&amp; board[2] == board[8]) ||(board[0] != null &amp;&amp; board[0] == board[4] &amp;&amp; board[0] == board[8]) ||(board[2] != null &amp;&amp; board[2] == board[4] &amp;&amp; board[2] == board[6]); } public boolean boardFilledUp() { for (int i = 0; i &lt; board.length; i++) { if (board[i] == null) { return false; } } retur…
has comment: http://stackoverflow.com/comment/31202239
has comment: http://stackoverflow.com/comment/31202266
has comment: http://stackoverflow.com/comment/31202325
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31202279
tagged with: class
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31202253
has answer: http://stackoverflow.com/a/20810477
has answer: http://stackoverflow.com/a/20810478
has title: What does it mean to instantiate an object using X.new Y()?

http://stackoverflow.com/comment/31311290
has text: I like your second idea. I am going to place current main content panel in another and set the size of current to a fixed number. Second panel will have some kind of picture for a wallpaper.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20841988

outputstream
tags question: http://stackoverflow.com/q/20752253
type: Tag
tags question: http://stackoverflow.com/q/20809502
tag name: outputstream
tags question: http://stackoverflow.com/q/20716654
tags question: http://stackoverflow.com/q/20813204

http://stackoverflow.com/comment/31079874
comment on: http://stackoverflow.com/a/20742140
type: AnswerComment
type: Comment
score: 0
has text: thanks for the fast response :) however, i'm totally new to doing things like this, could you explain to me how i can change that variable? :)

http://stackoverflow.com/comment/31141205
has text: I have already declare and initialize serialVersionUID but problem still not solved
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20775875
type: Comment

http://stackoverflow.com/a/20681324
has body: It is because you need to set KEY instead the Value in your person object: person.setCountry("MY1");
score: 0
has comment: http://stackoverflow.com/comment/30971283
answers question: http://stackoverflow.com/q/20680280
type: Answer

http://stackoverflow.com/q/20702257
has comment: http://stackoverflow.com/comment/31007187
accepted answer: http://stackoverflow.com/a/20717376
tagged with: optimization
has title: Solving a non linear system in java (using optim toolbox)
score: 0
has comment: http://stackoverflow.com/comment/31007544
has comment: http://stackoverflow.com/comment/31008462
has comment: http://stackoverflow.com/comment/31034732
tagged with: numerical-methods
linked to: http://stackoverflow.com/q/1607933
has comment: http://stackoverflow.com/comment/31009370
has body: I have a system of nonlinear dynamics which I which to solve to optimality. I know how to do this in MATLAB, but I wish to implement this in JAVA. I'm for some reason lost in how to do it in Java. What I have is following: z(t) which returns states in a dynamic system. z(t) = [state1(t),...,state10(t)] The rate of change of this dynamic system is given by: z'(t) = f(z(t),u(t),d(t)) = [dstate1(t)/dt,...,dstate10(t)/dt] where u(t) and d(t) is some external variables that I know the value of. In addition I have a function, lets denote that g(t) which is defined from a state variable: g(t) = state4(t)/c1 where c1 is some constant. Now I wish to solve the following unconstrained nonlinear system numerically: g(t) - c2 = 0 f(z(t),u(t),0)= 0 where c2 is some constant. Above system can be seen as a simple f'(x) = 0 problem consisting of 11 equations and 1 unkowns and if I where supposed to solve this in MATLAB I would do following: [output] = fsolve(@myDerivatives, someInitialGuess); I am aware of the fact that JAVA doesn't come with any build-in solvers. So as I see it there are two options in solving the above mentioned problem: Option 1: Do it my-self: I could use numerical methods as e.g. Gauss newton or similar to solve this system of nonlinear equations. However, I will start by using a java toolbox first, and then move to a numerical method afterwards. Option 2: Solvers (e.g. commons optim) This solution is what I am would like to look into. I have been looking into this toolbox, however, I have failed to find an exact example of how to actually use the MultiVariateFunction evaluater and the numerical optimizer. Does any of you have any experience in doing so? Please let me know if you have any ideas or suggestions for solving this problem. Thanks!
answer count: 1
has answer: http://stackoverflow.com/a/20717376
has comment: http://stackoverflow.com/comment/31007697
has comment: http://stackoverflow.com/comment/31040370
has comment: http://stackoverflow.com/comment/31009552
has comment: http://stackoverflow.com/comment/31008723
has comment: http://stackoverflow.com/comment/31007259
has comment: http://stackoverflow.com/comment/31008994
tagged with: matlab
has comment: http://stackoverflow.com/comment/31037809
tagged with: java
has comment: http://stackoverflow.com/comment/31007603
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31038250

http://stackoverflow.com/comment/31490380
score: 1
has text: @EJP - Interesting, Could you elaborate? I have found this [link](https://github.com/nicola-amatucci/Android-UDP-Auto-Discovery/blob/master/it/nicola_amatucci/android/discovery/DiscoveryClient.java) which shows a simple UDP example on Android, and also includes a Java Server implementation.
comment on: http://stackoverflow.com/q/20810928
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31238122
has text: @nachokk Personally, I don't think the destination, per say, is a requirement, it's just what the OP has completed up to now and isn't stated as a requirement, this is just my opinion though ;)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20829088

http://stackoverflow.com/a/20736811
type: Answer
has body: You have two problems. Firstly, in insertElement, you're not copying the original array into the new one. Secondly, you're inserting the new element past the end of the array. The array goes from 0 to s-1, but you're trying to insert at index s, which gives your exception.
upvote count: 1
answers question: http://stackoverflow.com/q/20736789
score: 1
downvote count: 0

http://stackoverflow.com/comment/74518208
comment on: http://stackoverflow.com/q/20815412
score: 0
type: Comment
type: QuestionComment
has text: Check my answer here: http://stackoverflow.com/questions/43721384/web-services-mismatch-between-java-model-and-wsdl-model-found-for-wsdl-operat/43737344#43737344

http://stackoverflow.com/q/20697926
has body: My android app gets data from a server API with which it communicates by using several Async Task classes that I've created for each job I need. Here are the names of the classes so far: and here are two classes so you can see what Im talking about: public class DeleteUser extends AsyncTask<String, String, String> { int success; private Context context; private OnUserDeletionListener listener; private String userToBeDeleted; private JSONParser jsonParser = new JSONParser(); private static final String TAG_SUCCESS = "success"; private static final String TAG_DELETION_SUCCESS = "Deletion Success"; private static final String TAG_DELETION_FAILURE_ACCOUNT_NOT_DELETED = "Account Not Deleted"; private static final String TAG_DELETION_FAILURE_CONNECTION_ERROR = "Connection Error"; public DeleteUser(Context context, OnUserDeletionListener listener, String userToBeDeleted) { this.context = context; this.listener = listener; this.userToBeDeleted = userToBeDeleted; } @Override protected void onPreExecute() { ShowLoadingMessage.loading(context); super.onPreExecute(); } @Override protected String doInBackground(String... args) { int success; try { List<NameValuePair> deleteUserAccount = new ArrayList<NameValuePair>(); deleteUserAccount.add(new BasicNameValuePair("user_id", userToBeDeleted)); JSONObject json = jsonParser.makeHttpRequest(Configurationz.URLs.PHP_DELETE_USER_ACCOUNT, "POST", deleteUserAccount); success = json.getInt(TAG_SUCCESS); if (success == 1) { return "Deletion Success"; } else if (success == 2) { return "Account Not Deleted"; } else { return "Connection Error"; } } catch (JSONException e) { e.printStackTrace(); return "Connection Error"; } } @Override protected void onPostExecute(String result) { ShowLoadingMessage.dismissDialog(); if(listener != null) { if (result.contentEquals(TAG_DELETION_SUCCESS)) { listener.onUserDeletionSuccess(); } else if(result.contentEquals(TAG_DELETION_FAILURE_ACCOUNT_NOT_DELETED)) { listener.onUserDeletionFailure(result); } else if…
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20698041
has title: Separate specialized asynctask class for each job or a unified universal class accepting lots of parameters
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/20698041
tagged with: android
type: AnsweredQuestion
tagged with: oop
score: 1
tagged with: java

http://stackoverflow.com/a/60327990
type: Answer
has body: This works for me GridPane.getRowConstraints().size()
score: 0
answers question: http://stackoverflow.com/q/20766363

http://stackoverflow.com/comment/31324350
comment on: http://stackoverflow.com/a/20832734
has text: Thank you for trying to help me, I just don t understand where to start from?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31246821
score: 0
comment on: http://stackoverflow.com/q/20833913
type: Comment
type: QuestionComment
has text: @AndrewThompson I don't mean any disrespect. You seem to be an expert in Swing and creating standard application GUIs, but that's not what I am trying to do. It isn't often that I am dead sure about something, but I do know that the way I am updating is not bad practice. It may be implemented improperly, I have no idea, but using the `paintComponent()` method when doing game painting is never a good idea, due to render/interpolation consistency.

http://stackoverflow.com/a/20829951
answers question: http://stackoverflow.com/q/20829860
downvote count: 0
has comment: http://stackoverflow.com/comment/31239168
has comment: http://stackoverflow.com/comment/31239128
has comment: http://stackoverflow.com/comment/31239169
has comment: http://stackoverflow.com/comment/31238987
has comment: http://stackoverflow.com/comment/31239072
has body: The standard C++ library already implements lists, maps, sets, etc. There is no point in C++ to implement these data structures again. If you implement something like one of these data structures you'd implement the same concept (i.e., use the same function names, order of parameters, names of nested types, etc.). There are various concepts for container (sequence, associative containers, etc.). More importantly, you'd expose the content of your structure using the appropriate iterator concepts. Note: C++ isn't Java. Don't try to program Java in C++. If you want to program Java, program Java: it works a lot better than trying to do so in C++. If you want to program C++, program C++.
type: Answer
has comment: http://stackoverflow.com/comment/31239082
score: 5
upvote count: 5

jogl
tag name: jogl
type: Tag
tags question: http://stackoverflow.com/q/20723935

http://stackoverflow.com/comment/31087506
score: 0
has text: Can this be used with jdbc , I believe we need to do execute(). SO, will it help?
type: Comment
comment on: http://stackoverflow.com/a/20745645
type: AnswerComment

http://stackoverflow.com/comment/31052815
comment on: http://stackoverflow.com/q/20726617
score: 0
type: Comment
has text: The answer is the same. No change. I included if (goal == 0) return 0 case also.
type: QuestionComment

http://stackoverflow.com/q/20807515
has comment: http://stackoverflow.com/comment/31196758
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/31196774
has answer: http://stackoverflow.com/a/20807683
has comment: http://stackoverflow.com/comment/31196815
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20807658
has answer: http://stackoverflow.com/a/20807816
score: 2
has body: I am currently trying to work with a custom text file to read quests for a small game, however i am having trouble getting the code to read each character, I've done my research and somehow come up with nothing. I am unsure of how to read a .txt file character by character, so if anyone can help or point me in the right direction it would be strongly appreciated.
has comment: http://stackoverflow.com/comment/31197147
favorite count: 0
tagged with: character
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/2597841
has comment: http://stackoverflow.com/comment/31196806
has title: Reading a text file, character by character in java
tagged with: text

http://stackoverflow.com/comment/31027192
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20712827
type: Comment
has text: why would you want activityA to know that activityB is created ? may be there is a simpeler way

http://stackoverflow.com/comment/31214622
type: Comment
has text: @user2776828 click on the link
comment on: http://stackoverflow.com/a/20816158
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31267644
type: Comment
type: QuestionComment
has text: @neel yes, I had thought of that but it still only see's - as a binary operator. So the tokens would equal (, 4, (, 2, *, (, -->-, 2,<-- -, 1, ), ), ) not (, 4, (, 2, *, (, -->-2,<-- -, 1, ), ), ) I have placed arrows to show exactly what I mean.
comment on: http://stackoverflow.com/q/20845243
score: 0

http://stackoverflow.com/comment/31186156
type: AnswerComment
has text: @Trying Yes. True. But s4 released the value at run-time.
type: Comment
comment on: http://stackoverflow.com/a/20801720
score: 0

http://stackoverflow.com/comment/31181634
comment on: http://stackoverflow.com/q/20799173
type: Comment
type: QuestionComment
has text: `mc` does exist in `apply()` because it is `final`. If it did not exist, you would get a compilation error. imho, `mc` exists but its id is null. Check with the debugger at the first line of your main method.
score: 1

http://stackoverflow.com/comment/31255230
has text: "i am getting some exceptions" - don't you think they could be relevant for the question?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20839021
score: 0

http://stackoverflow.com/comment/31019410
has text: I think I has an answer to your previous question. I answered with the fix to the book ID. You need to make it static. And declare and initialize it at 0. `int bookID = 0;` Take it out of the constructor. Leave the `bookID++`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20708809
type: AnswerComment

http://stackoverflow.com/comment/31027416
type: Comment
score: 0
has text: Okay, please excuse my stupidity. I had completely forgotten that I had made an exe from the old bat file, and THAT is what I have been running--the exe. So every time I edit the bat file, the exe remains the same. I am going to do some more "sleuthing", but this time using the batch file for testing =P
comment on: http://stackoverflow.com/a/20693517
type: AnswerComment

http://stackoverflow.com/comment/31211880
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20815643
has text: You should also post the variables of your classes and the SQL query with the surrounding code.

http://stackoverflow.com/a/20797482
has body: The straight-forward solution would be if (initialDrawing) { Card card; for (int i = 0; i &lt; deck.size(); i++) { card = deck.get(i); card.setY((int) (50 + 0.2 * i)); card.setX((int) (250 + 0.2 * i)); } initialDrawing = false; } for (Card card : deck) { card.paintCard(g); } This however suggests, that the initialisation should be done elsewhere, maybe in the constructor. In general painting code should do just painting and may be called several times.
type: Answer
accepted answer of: http://stackoverflow.com/q/20796729
answers question: http://stackoverflow.com/q/20796729
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31221876
has text: Ok thanks, but then after clicking the up or down buttons once, it stays white and doesn't change colors.
comment on: http://stackoverflow.com/a/20820855
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20741916
favorite count: 0
tagged with: exception
has title: How to make sure user enters all details before loading next screen
type: UnansweredQuestion
tagged with: android
downvote count: 1
tagged with: android-edittext
has answer: http://stackoverflow.com/a/20742200
tagged with: java
score: -1
type: Question
has body: I want the user to enter all text in edittext before it loads the next screen. If the user presses done and they have not filled in all details, it should display a message telling them to do so. try { if (Integer.toString(cigSmoked).length() &gt; 0) { cigSmoked = Integer.parseInt(cigSmokedText.getText() .toString()); editor.putInt("smokedCigaretes", cigSmoked); editor.commit(); } if (Integer.toString(cigBox).length() &gt; 0) { cigBox = Integer.parseInt(cigBoxText.getText() .toString()); editor.putInt("cigaretteBox", cigBox); editor.commit(); } if (Float.toString(cigCost).length() &gt; 0) { cigCost = Float.parseFloat(cigCostText.getText() .toString()); editor.putFloat("cigaretteCost", cigCost); editor.commit(); } } catch (Exception e) { Toast.makeText(getApplicationContext(), "Did NOT save settings, please fill in all fields", Toast.LENGTH_LONG) .show(); ; } int day = quitYearText.getDayOfMonth(); int month = quitYearText.getMonth(); int year = quitYearText.getYear(); editor.putInt("day", day); editor.putInt("month", month); editor.putInt("year", year); editor.commit(); Context context = getApplicationContext(); CharSequence text = "Saved!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); Intent myIntent = new Intent(Settings.this, Home.class); Settings.this.startActivity(myIntent); }
upvote count: 0
has answer: http://stackoverflow.com/a/20742150
has answer: http://stackoverflow.com/a/20741983
answer count: 3
has comment: http://stackoverflow.com/comment/31079388

http://stackoverflow.com/comment/31074339
type: Comment
has text: Yeah - I was commenting while you were editing. +1
comment on: http://stackoverflow.com/a/20738712
type: AnswerComment
score: 0

jsp-tags
tags question: http://stackoverflow.com/q/20756418
tags question: http://stackoverflow.com/q/20845862
tags question: http://stackoverflow.com/q/20834394
tag name: jsp-tags
type: Tag

http://stackoverflow.com/q/20848522
has title: Octave to Java - InitializeThetas Function
has comment: http://stackoverflow.com/comment/31274466
has comment: http://stackoverflow.com/comment/31275321
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31273869
tagged with: octave
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/20848709
has comment: http://stackoverflow.com/comment/31274217
has comment: http://stackoverflow.com/comment/31275146
has comment: http://stackoverflow.com/comment/31275440
has comment: http://stackoverflow.com/comment/31274996
has body: Hi guys I´m new in java. I'm trying to convert an octave function in to Java(using JBlas) but I´m not sure how to do this line: OCTAVE: Thetas{i} = rand(sizes(i+1), sizes(i) + 1)*2*EPSILON-EPSILON; My code in Java: public class InitializeThetas { public static DoubleMatrix InitializeThetas(DoubleMatrix sizes, double epsilon) { int L= sizes.length; epsilon = 0.03; DoubleMatrix Thetas = new DoubleMatrix(new double[]{}); Random r = new Random(); for (int i = 1; i &lt;= L - 1; i++) { //Thetas{i} = rand(sizes(i+1), sizes(i) + 1)*2*EPSILON-EPSILON; Thetas.data[i]= r.nextInt() * 2 * epsilon - epsilon; } return Thetas; } }
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/20848709
tagged with: java

http://stackoverflow.com/q/20735196
answer count: 2
tagged with: jpanel
score: 0
possible better answer: http://stackoverflow.com/a/20735323
has answer: http://stackoverflow.com/a/20735323
tagged with: layout-manager
has answer: http://stackoverflow.com/a/20735495
has title: Making GridBagLayout looks like in pattern
type: AnsweredQuestion
has body: I want to do something like this: Here is my code: public class MainFrame extends JFrame{ public MainFrame(){ super("Symulator Lotow"); JPanel returnPanel = new JPanel(new GridBagLayout()); add(returnPanel); Vector&lt;JButton&gt; v = new Vector&lt;JButton&gt;(); int licznik = 0; GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.insets = new Insets(0,0,0,0); c.weightx = 1.0; c.weighty = 1.0; c.anchor = GridBagConstraints.CENTER; v.add(new JButton()); c.gridwidth = 6; c.gridheight = 6; c.gridx = 0; c.gridy = 0; v.get(licznik).setBackground(Color.black); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 6; c.gridheight = 4; c.gridx = 6; c.gridy = 0; v.get(licznik).setBackground(Color.white); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 3; c.gridheight = 2; c.gridx = 6; c.gridy = 4; v.get(licznik).setBackground(Color.blue); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 3; c.gridheight = 2; c.gridx = 9; c.gridy = 4; v.get(licznik).setBackground(Color.yellow); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 6; c.gridheight = 2; c.gridx = 0; c.gridy = 6; v.get(licznik).setBackground(Color.yellow); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 6; c.gridheight = 2; c.gridx = 6; c.gridy = 6; v.get(licznik).setBackground(Color.yellow); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 4; c.gridheight = 2; c.gridx = 0; c.gridy = 8; v.get(licznik).setBackground(Color.red); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 4; c.gridheight = 2; c.gridx = 4; c.gridy = 8; v.get(licznik).setBackground(Color.red); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 4; c.gridheight = 2; c.gridx = 8; c.gridy = 8; v.get(licznik).setBackground(Color.red); returnPan…
tagged with: java
accepted answer: http://stackoverflow.com/a/20735495
type: Question
tagged with: gridbaglayout

http://stackoverflow.com/a/20936684
type: Answer
score: 2
has body: Use this tabe value function: ALTER FUNCTION [dbo].[GetPagedData] ( -- Add the parameters for the function here @pagesize int, @pageindex int ) RETURNS TABLE AS RETURN ( SELECT TOP (@pagesize) * ,Row_number() Over(order by a.ID) as count FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY ID) AS num FROM dbo.Employees where IsActive=1 ) AS a WHERE num &gt; @pageindex*@pagesize ) Use like this select * from dbo.GetPagedData(pagesize,pageindex) i.e select * from dbo.GetPagedData(20,0) Note: page index starts from 0. In Java loop over this function by incrementing pageindex each time.
downvote count: 0
answers question: http://stackoverflow.com/q/20798072
accepted answer of: http://stackoverflow.com/q/20798072
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/31199151
comment on: http://stackoverflow.com/q/20808541
score: 0
has text: I'll gladly accept your answer if you'd like to provide one...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31023601
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20710762
has text: Maybe my comment above explains the reason why I would face an issue here. If that is the case, it would mean that you are able to serialize Throwable, just not on GAE.

http://stackoverflow.com/a/20797388
score: 0
type: Answer
has body: Try ImageIO.write(new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR), "jpg", new File("symmetry2.jpg")); and see where the file is written. That is where you have to place your symmetry.jpg
answers question: http://stackoverflow.com/q/20797159

http://stackoverflow.com/comment/31157344
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20785735
type: Comment
has text: Which line throws the exception?

http://stackoverflow.com/comment/31231556
has text: You need to understand how local variables and parameters work.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20826190

http://stackoverflow.com/q/20703434
score: 0
has title: NullPointerException - JavaFX
possible better answer: http://stackoverflow.com/a/35367861
has answer: http://stackoverflow.com/a/46379141
has comment: http://stackoverflow.com/comment/31049820
has answer: http://stackoverflow.com/a/35367861
has answer: http://stackoverflow.com/a/20703470
has answer: http://stackoverflow.com/a/37605283
has answer: http://stackoverflow.com/a/37746093
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/29874521
accepted answer: http://stackoverflow.com/a/20703470
type: Question
has body: I am getting NullPointerException in this code. I am using JavaFX 2.2 , NetBeans IDE 7.3.1, Windows 8, Java 1.7.0 public class SampleController implements Initializable { @FXML GridPane grid; @Override public void initialize(URL url, ResourceBundle rb) { // TODO for(int i=0;i&lt;10;i++){ for(int j=0;j&lt;4;j++){ AnchorPane tile = new AnchorPane(); tile.setMaxSize(225, 225); grid.add(tile, j, i); } } } } -JavaFX 2.2
answer count: 6
linked to: http://stackoverflow.com/q/3988788

http://stackoverflow.com/comment/30988052
type: QuestionComment
type: Comment
has text: Instead of using regular expressions, just store all your words-to-ignore in a `HashSet` or some other O(1)-lookup data structure. Then parse the files word by word and see if each is in the ignore `Set` before processing it further. The `Set` operations will *probably* be faster than any regular expression you can cook up (but I have not run any experiments to know for sure).
comment on: http://stackoverflow.com/q/20691165
score: 0

http://stackoverflow.com/comment/30969623
comment on: http://stackoverflow.com/q/20680377
has text: what's the best way to get the Map<String,Bar> into Map<Foo,Bar> where Foo is an Enum. it just seems awfully complicated when, conceptually, not a complex idea.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31169308
type: Comment
type: QuestionComment
score: 1
has text: Take a look what `get(i)` returns!, and `a.apply` returns an Object
comment on: http://stackoverflow.com/q/20792111

http://stackoverflow.com/q/20810058
has body: I have programatically defined a Jetty server and added an instance of a HttpRequestHandlerServlet. I am trying to do all of this without a web.xml file. Here is a simplified version of my code: import java.io.IOException; import java.util.Enumeration; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.junit.Test; import static org.mockito.Mockito.*; import org.springframework.context.support.StaticApplicationContext; import org.springframework.web.HttpRequestHandler; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.context.support.HttpRequestHandlerServlet; public class TestServer extends Server { public TestServer() throws Exception { super(8888); final ServletContextHandler contextHandler = new ServletContextHandler(this, "/", ServletContextHandler.NO_SESSIONS|ServletContextHandler.NO_SECURITY); final ServletContext context = contextHandler.getServletContext(); StaticApplicationContext applicationContext = new StaticApplicationContext(); applicationContext.registerSingleton("testServlet", TestBean.class); applicationContext.refresh(); GenericWebApplicationContext webApplicationContext = new GenericWebApplicationContext(); webApplicationContext.setParent(applicationContext); webApplicationContext.setServletContext(context); webApplicationContext.refresh(); context.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webApplicationContext); ServletConfig servletConfig = new Se…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20815462
accepted answer: http://stackoverflow.com/a/20815462
tagged with: jetty
tagged with: spring
type: AnsweredQuestion
tagged with: spring-remoting
score: 1
tagged with: java
has title: Using HttpRequestHandlerServlet in programatically configured Jetty embedded server
upvote count: 1
type: Question
tagged with: httpinvoker

http://stackoverflow.com/q/20829802
has comment: http://stackoverflow.com/comment/31239103
has comment: http://stackoverflow.com/comment/31239177
tagged with: java
has title: Comparison method violates its general contract even though Double.compare(v1, v2) is used
has comment: http://stackoverflow.com/comment/31238916
has comment: http://stackoverflow.com/comment/31238727
tagged with: comparator
has comment: http://stackoverflow.com/comment/31238973
answer count: 1
has body: First of all: I know, this question is answered in numerous places on stack overflow, however, this question is different. I'm not trying to make my own comparison, I'm using Double.compare() to compare 2 doubles. So, the Exception: Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeLo(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at repository.corpus.document.Summarizer.summarize(Summarizer.java:53) at muse.GATrainer.RougeNEvaluator.getFitness(RougeNEvaluator.java:63) at muse.GATrainer.RougeNEvaluator.getFitness(RougeNEvaluator.java:1) at org.uncommons.watchmaker.framework.FitnessEvalutationTask.call(FitnessEvalutationTask.java:52) at org.uncommons.watchmaker.framework.FitnessEvalutationTask.call(FitnessEvalutationTask.java:26) ... 4 more the code: List&lt;Sentence&gt; sentenceList = finalRepresentation.getSentences(); Comparator&lt;Sentence&gt; scoreComperator = new Comparator&lt;Sentence&gt;() { public int compare(Sentence o1, Sentence o2) { if (o1.equals(o2)) { System.out.println("Trying to compare a sentence to it self"); } if (Double.isInfinite(o1.getScore()) || Double.isNaN(o1.getScore())) { System.out.println(o1.getSentence() + " score " + o1.getScore()); } if (Double.isInfinite(o2.getScore()) || Double.isNaN(o2.getScore())) { System.out.println(o2.getSentence() + " score " + o2.getScore()); } return Double.compare(o1.getScore(), o2.getScore()); } }; Collections.sort(sentenceList, Collections.reverseOrder(scoreComperator)); // source of the exception this is the sentence class code (the parts of it concerning the score): public class Sentence implements Comparable&lt;Sentence&gt; { // ... private double score = Integer.MIN_VALUE; // the final score of the …
tagged with: sorting
has comment: http://stackoverflow.com/comment/31238804
has answer: http://stackoverflow.com/a/20829814
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31238686
has comment: http://stackoverflow.com/comment/31238797
score: 0
has comment: http://stackoverflow.com/comment/31239319
tagged with: collections
type: Question

infinite-loop
tags question: http://stackoverflow.com/q/20776358
tags question: http://stackoverflow.com/q/20681616
tags question: http://stackoverflow.com/q/20842089
type: Tag
tag name: infinite-loop
tags question: http://stackoverflow.com/q/20730660

http://stackoverflow.com/a/20740827
has body: Fragments don't have onRestoreInstanceState… it's onActivityCreated() (for technical reasons this was horribly implemented this way by the Android team). See this thread on StackOverflow for more information.
answers question: http://stackoverflow.com/q/20740248
score: 0
type: Answer

http://stackoverflow.com/comment/31172420
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20793739
has text: I'm using a Java thread. I'll try out Asynch task, and tell you how it goes. Thanks! Edit - Reason for using a boolean is that I hooked up the buttons (I actually have multiple ones) to one method, and I would have to loop for the buttons if I did .setEnabled(false).
score: 0

http://stackoverflow.com/comment/95406634
type: Comment
has text: take a look here, some clarification that may be important/helpful: https://stackoverflow.com/a/23752530/826946
comment on: http://stackoverflow.com/a/20693877
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31273637
type: Comment
type: QuestionComment
has text: @user1988876: Some blog does not override what the reference docs say. But, even if it did, see the link of [Declaration Statement](http://java.about.com/od/d/g/declarationstatement.htm), where it clearly shows you that `int number = 10;` is a declaration statement.
score: 0
comment on: http://stackoverflow.com/q/20847697

http://stackoverflow.com/comment/31090468
score: 0
type: Comment
type: QuestionComment
has text: Only value of the object is passed not a pointer to it
comment on: http://stackoverflow.com/q/20747884

http://stackoverflow.com/comment/31123215
type: QuestionComment
has text: @AntonKovalenko I would like to get rid off all constraints that come with making the application share the filesystem. The system should be click to deploy. Regarding the size of the file, those should not be big, but they are created frequently, and sent often. I don't think a ftp server would help me. But thank you for answering me.
comment on: http://stackoverflow.com/q/20748433
score: 0
type: Comment

http://stackoverflow.com/comment/31154421
score: 0
type: Comment
type: QuestionComment
has text: @AndrewThompson The SecurityManager is the place to start when doing things like this. Hopefully it will show that it is not easy running arbitrary code in a controlled fashion. After thinking it over the only reliable way to do this - in my opinion - is not to use a full JVM. You must do what Google did with their application engine, and create a special JVM restricted to what you want it to do.
comment on: http://stackoverflow.com/q/20768972

http://stackoverflow.com/q/20801585
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/20785205
has answer: http://stackoverflow.com/a/20801851
answer count: 3
has comment: http://stackoverflow.com/comment/31187151
downvote count: 0
has answer: http://stackoverflow.com/a/20801763
has comment: http://stackoverflow.com/comment/31185894
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
has title: Android handle thread with dynamic activity
has answer: http://stackoverflow.com/a/20805378
has body: I'm developing an Android network application. I want to have one worker thread that will handle all incoming data over a socket). The thread will be active all the time. I can start the thread from one of my activities, but how to handle it after the activity is changed? By handle, I mean how to interact with the thread (passing data from thread to current UI or sending data to the thread from the current UI). I'm looking at AsyncTask but I'm not sure if it can be used with my situation

http://stackoverflow.com/comment/30981533
score: 0
type: Comment
type: QuestionComment
has text: @dcsohl Not a duplicate. This question is about the HTTP header. The other is about custom error pages.
comment on: http://stackoverflow.com/q/20686465

http://stackoverflow.com/comment/30975931
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20684791
has text: Show us your `onCreate()` and explain what you are trying to do.
score: 0

http://stackoverflow.com/a/20848751
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20848714
downvote count: 0
has body: When you have only 2 inputs the range of your parts array is [0..1], thus when you try to access parts[2] here: String part3 = parts[2]; An error will be thrown.
type: Answer

http://stackoverflow.com/comment/31098321
type: Comment
comment on: http://stackoverflow.com/a/20751878
type: AnswerComment
score: 0
has text: But how then? =\ I managed to create the stream with OutputStream os = Channels.newOutputStream(sc), but now it fails when I try to write

http://stackoverflow.com/comment/31010842
has text: Thanks a lot for your help :) Also i found some other ways here : http://stackoverflow.com/questions/2844863/mysql-updating-entry-without-updating-timestamp
comment on: http://stackoverflow.com/a/20702584
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20706262
upvote count: 3
has body: i want to make text like this "Welcome, admin (\n new line) to Car Tooner" can anyone help me? use JTextArea in JScrollPane instead of JLabel use Html for JLabel
type: Answer
answers question: http://stackoverflow.com/q/20706206
downvote count: 0
score: 3

http://stackoverflow.com/comment/31179813
comment on: http://stackoverflow.com/q/20797281
has text: @ TheLostMind - exactly. And I can check whether script execution is finished or not.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20708993
has comment: http://stackoverflow.com/comment/31076866
has body: To me this sounds more like a problem of isolating your integration tests than knowing when a topology is really dead. There should be no problem with running multiple topologies simultaneously on the same cluster, and those old workers, even if they have not fully spun down, should not interfere with new workers that spin up as part of a newly deployed topology. If the concern is about workers accessing resources outside the Storm cluster, you're probably better off trying to isolate those resources between tests than to ensure all Storm workers have died.
answers question: http://stackoverflow.com/q/20687297
score: 1
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31239725
type: Comment
comment on: http://stackoverflow.com/a/20827317
has text: This sounds great, do you have any examples?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31143525
score: 1
has text: @πάνταῥεῖ I understand - just curious. Unfortunately, it seems in StackOverflow, curiosity kills the cat.
type: Comment
comment on: http://stackoverflow.com/q/20777511
type: QuestionComment

http://stackoverflow.com/a/20698865
answers question: http://stackoverflow.com/q/20698836
has body: You would need to store not just the events, but also the time at which you serialized. Then after deserializing, work out the difference between the current time and the serialization time, and update all the events accordingly. So suppose at time T=10 you created an event to fire in 15 ticks time, so T=25. Then at T=20 you serialized the data - leaving 5 ticks remaining. At T=50 you deserialize, and work out the difference between serialization time (20) and now (50) - which means you need to add 30 to each "ready time". Your event will be updated to fire at T=55, which is correct as again it's in 5 ticks time. You could potentially do this with custom serialization code instead, serializing "amount of time left" instead of the absolute deadline, and deserializing to a new deadline.
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31048102
score: 0
comment on: http://stackoverflow.com/q/20724210
type: Comment
type: QuestionComment
has text: This might have been a valid question, but it has been answers time and time again. We downvote when we judge that you've made or shown no effort.

http://stackoverflow.com/comment/31063390
score: 0
type: QuestionComment
type: Comment
has text: Hi. Set JNDI name to you ejb.Remote object and deploy the latest pkg into server. then lookup ejb remote object using that JNDI name.
comment on: http://stackoverflow.com/q/20732328

http://stackoverflow.com/comment/30974843
type: Comment
type: QuestionComment
has text: Because you shouldn't be able to use an un-initialized variable.
score: 1
comment on: http://stackoverflow.com/q/20684345

http://stackoverflow.com/comment/31560149
type: AnswerComment
type: Comment
has text: ZeroMatrix.clone() will create a big dense array at present.... probably not what you want. I think a SparseRowMatrix with a SparseHashedVector in each row is probably best: something like the example code that I posted
comment on: http://stackoverflow.com/a/20783858
score: 0

http://stackoverflow.com/q/20726833
has comment: http://stackoverflow.com/comment/31055092
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
has comment: http://stackoverflow.com/comment/31052858
has body: I am new to Java as well as play. I cannot understand this statement : - public static Result index(){ return ok("Got request " + request() + "!"); } What kind of object is public static Result index() ? Im guessing index is a method and is returning an object of type Result. But how it is defined outside a containing class as it isn't allowed in Java. The documentation states this is a Action Method, but again singular methods aren't allowed in Java isnt it?
type: Question
possible better answer: http://stackoverflow.com/a/20726958
score: 0
accepted answer: http://stackoverflow.com/a/20734760
answer count: 2
tagged with: playframework
has comment: http://stackoverflow.com/comment/31054903
has answer: http://stackoverflow.com/a/20726958
has answer: http://stackoverflow.com/a/20734760
has title: Play Framework Main Code not getting

http://stackoverflow.com/a/20764357
downvote count: 0
has comment: http://stackoverflow.com/comment/31564343
score: 9
answers question: http://stackoverflow.com/q/20764300
upvote count: 9
type: Answer
has body: The Javadoc of next explains The method next is implemented by class Random by atomically updating the seed to (seed * 0x5DEECE66DL + 0xBL) &amp; ((1L &lt;&lt; 48) - 1) and returning (int)(seed &gt;&gt;&gt; (48 - bits)) Clearly, there is no trace of O(n) complexity in these expressions.

http://stackoverflow.com/comment/31204485
has text: try to increase buf size to some big value, I assume your files are bigger than the buffer and get skipped
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20811265

http://stackoverflow.com/comment/31090844
type: AnswerComment
type: Comment
score: 1
has text: can use on touch listener and use Action down to set image 1 and action up to set default. Other option is to use a selector.
comment on: http://stackoverflow.com/a/20748034

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/20744032

http://stackoverflow.com/q/20746464
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31087697
has title: Parse JsonString to JsonObject in Java
has comment: http://stackoverflow.com/comment/31087994
has comment: http://stackoverflow.com/comment/31087898
has comment: http://stackoverflow.com/comment/31088043
accepted answer: http://stackoverflow.com/a/20746673
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/31087751
score: 5
has body: I have the following String : { "response": true, "model_original_id": "5acea0b5:1431fde5d6e:-7fff", "model_new_id": 500568, "model_new_version": 1, "reload": true, "idsModelProperties": [{ "key": "creation_date", "value": "2013-12-23" }, { "key": "state", "value": 1, "displayValue": "Analisi" }], "idsNodes": [], "idsConnectors": [], "idsNodesProperties": [] } and i need to parse it as a JSONObject. I tried to use quickjson but it gives me an exception when it tries to parse an emty string . This is what i tried : JsonParserFactory factory=JsonParserFactory.getInstance(); JSONParser parser=factory.newJsonParser(); Map jsonData=parser.parseJson(response_output); Exception: Exception in thread "main" com.json.exceptions.JSONParsingException: @Key-Hierarchy::root/idsNodes[0]/ @Key:: Value is expected but found empty...@Position::256 Any idea?
upvote count: 5
has comment: http://stackoverflow.com/comment/31087871
possible better answer: http://stackoverflow.com/a/25304039
has answer: http://stackoverflow.com/a/25304039
answer count: 2
has answer: http://stackoverflow.com/a/20746673

variables
tag name: variables
tags question: http://stackoverflow.com/q/20807669
tags question: http://stackoverflow.com/q/20821481
tags question: http://stackoverflow.com/q/20723078
tags question: http://stackoverflow.com/q/20696865
tags question: http://stackoverflow.com/q/20739611
tags question: http://stackoverflow.com/q/20717019
type: Tag
tags question: http://stackoverflow.com/q/20832462
tags question: http://stackoverflow.com/q/20813397
tags question: http://stackoverflow.com/q/20687960
tags question: http://stackoverflow.com/q/20787563
tags question: http://stackoverflow.com/q/20750020
tags question: http://stackoverflow.com/q/20751091
tags question: http://stackoverflow.com/q/20818598
tags question: http://stackoverflow.com/q/20716314
tags question: http://stackoverflow.com/q/20814287

http://stackoverflow.com/comment/30990366
score: 0
type: QuestionComment
type: Comment
has text: If you want to understand the key points, try to implement RSA. There is more you need for a full secure encryption layer, but RSA describes one possibility of secure key exchange via insecure channels.
comment on: http://stackoverflow.com/q/20692425

http://stackoverflow.com/a/21829551
answers question: http://stackoverflow.com/q/20839275
type: Answer
has body: Update Wordnet db version being used in jwnlProperties.xml &lt;version publisher="Princeton" number="3" language="en"/&gt; File names in db have changed over versions, and JWNL supports them. This should solve your problem, discussed in other places as well. http://sourceforge.net/p/jwordnet/discussion/106153/thread/5ccfc039/
score: 0

http://stackoverflow.com/a/20799718
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20797281
downvote count: 0
has body: You could implement polling strategy for the reader, to avoid extra notifications from writer to the reader. Below is working simplified example : Writer updates log file from main thread (by user input from console) Reader periodically polls log file and outputs a single line public class Test { public static void main(String[] args) throws IOException { // async log reader based on timerTask LogReader logReader = new LogReader("test.txt"); logReader.start(); // starts polling log file in Timer thread // main thread simulating writes to file from user input BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter logWriter = new BufferedWriter(new FileWriter(new File("test.txt"))); String line = null; while (!(line = console.readLine()).equals("end")) { logWriter.write(line); logWriter.newLine(); logWriter.flush(); } logReader.stop(); logWriter.close(); } /** * reads file from separate thread */ static class LogReader { File mLogFile = null; BufferedReader mReader = null; TimerTask mCheckFileTask = null; LogReader(String logFile) throws FileNotFoundException { mLogFile = new File(logFile); mReader = new BufferedReader(new FileReader(mLogFile)); } /** * launches checking thread and output thread */ void start() { mCheckFileTask = new TimerTask() { @Override public void run() { // possibly some extra checks : // file size or lastModified() time changed since last time try { writeChange(); } catch (IOException e1) { e1.printStackTrace(); throw new Error(e1); } } }; new Timer().schedule(mCheckFileTask, 500, 500); } private void writeChange() throws IOException { String line; line = mReader.readLine(); if (line != null) { System.out.println("line added: " + line); } } void stop() throws IOException { System.out.println("stopping reader"); mCheckFileTask.cancel(); mReader.close(); } } } You might want add extra file-locking and consistency checks when having multiple readers/writers running in separate threads/processes.

http://stackoverflow.com/comment/31111965
type: AnswerComment
has text: the "div" after "[type=HEADER]" is the key.
type: Comment
comment on: http://stackoverflow.com/a/20759789
score: 0

http://stackoverflow.com/a/36616649
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20773850
has body: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl workes. No need for custom implementation Type type = ParameterizedTypeImpl.make(List.class, new Type[]{childrenClazz}, null); List list = gson.fromJson(json, type); Can be used with maps and any other collection: ParameterizedTypeImpl.make(Map.class, new Type[]{String.class, childrenClazz}, null); Here is nice demo how you can use it in custom deserializer: Deserializing ImmutableList using Gson
upvote count: 5

http://stackoverflow.com/a/20792327
has comment: http://stackoverflow.com/comment/31190494
answers question: http://stackoverflow.com/q/20792111
score: 1
has comment: http://stackoverflow.com/comment/31190551
has comment: http://stackoverflow.com/comment/31390361
upvote count: 1
has comment: http://stackoverflow.com/comment/31194632
has comment: http://stackoverflow.com/comment/31190346
type: Answer
has body: ...However I can't understand why Object elem is used. The likelihood is that EArrayList extends ArrayList, but doesn't give it a type bound - hence, it can hold any object. Typically, you find Lists with some type bound, such as List&lt;String&gt;, or List&lt;Integer&gt;. If you omit that, then you are dealing with only Objects. You're also doing it again with Func a - it has a type bound of &lt;S, T&gt;, which one could presume that you're going from a type of S to a type of T. But that is omitted as well, so you're only dealing with Func&lt;Object, Object&gt;. That's where this cast comes from: (Boolean)a.apply(elem) You can omit the == true part. You're checking boolean values. Java only knows that it is returning an Object from apply, but you don't want an Object - you want a Boolean. Java will attempt to cast it to a Boolean for you, if it can be cast to one. That could blow up at runtime, which means that this particular piece of code is a bug waiting to have a AbstractObjectFactoryImpl inserted into the list, waiting to try to be cast to a Boolean. This is why you want to use Generics. They protect you from runtime failures like that by enforcing this stuff at compile time, virtually eliminating type casts. Had this been done with generics, you would see declarations like this: // Assuming that there is a generic type T on the class: public EArrayList&lt;T&gt; filter(Func&lt;Boolean, T&gt; a) { int size = size(); EArrayList&lt;T&gt; arr = new EArrayList&lt;T&gt;(); for(int i = 0; i &lt; size; i++) { T elem = get(i); if(a.apply(elem)) { arr.add(elem); } } return arr; }
downvote count: 0

http://stackoverflow.com/comment/31092568
comment on: http://stackoverflow.com/q/20748974
type: QuestionComment
type: Comment
has text: I put `mapView = (ImageView) findViewById(R.id.imageView1);` in onCreate and it works. Thanks.
score: 0

http://stackoverflow.com/comment/31203144
comment on: http://stackoverflow.com/a/20810885
score: 0
type: AnswerComment
has text: BUt i dont want them to cast at all. Thats the problem. I dont know why its casting.
type: Comment

http://stackoverflow.com/q/20791874
tagged with: java
has body: What are the valid keys in CodeNameOne List Component's ListItems? In the CodeNameOne GUI builder, you can set keys for each item in a list. The default behavior is that certain keys will cause additional behaviors, like showing icons or navigation. However, I can't seem to find any documentation for what the recognized keys are. I know of $navigation, destination, and icon, but are there anymore keys that the default renderer and controller can use?
upvote count: 1
tagged with: codenameone
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/20796218
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/20796218
type: Question
has title: What are the valid keys in CodeNameOne List Component ListItems?

http://stackoverflow.com/comment/31064425
type: AnswerComment
comment on: http://stackoverflow.com/a/20733131
score: 2
type: Comment
has text: Java object fields go through two steps. Before any constructor or initializer execution, each is initialized to a default value that depends only on its type, 0 for numeric fields, null for references, false for booleans. That value can be changed later by an initializer or by constructor code.

http://stackoverflow.com/a/20737730
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/20733703
answers question: http://stackoverflow.com/q/20733703
type: Answer
has body: Following step by step closely the jbehave Getting Started tutorial, the Run story section says: [...] the ICanToggleACell.java class will allow itself to run as a JUnit test. This means that the JUnit library is required in your Build path. Using Eclipse: Select your current project and right-click it, Build path, Configure Build Path... Properties for [current project], Java Build Path, Libraries, click [Add Library...] Add Library, select JUnit, click [Next] JUnit Library, JUnit library version, select the version you wish to use, click [Finish] Java Build Path, click [OK] Project Explorer, select your ICanToggleACell.java class, right-click it, then Run As, and click on JUnit Test So this is the same here as for the above-example code. The StackBehaviourStory.java class should let itself run as a JUnit test after you add the proper library to the Java build path.
downvote count: 1
upvote count: 5

eclipse-plugin
tags question: http://stackoverflow.com/q/20787704
tags question: http://stackoverflow.com/q/20758242
tags question: http://stackoverflow.com/q/20822820
tags question: http://stackoverflow.com/q/20685405
tags question: http://stackoverflow.com/q/20714756
type: Tag
tags question: http://stackoverflow.com/q/20779554
tags question: http://stackoverflow.com/q/20755770
tags question: http://stackoverflow.com/q/20834981
tags question: http://stackoverflow.com/q/20738788
tags question: http://stackoverflow.com/q/20779899
tags question: http://stackoverflow.com/q/20839754
tags question: http://stackoverflow.com/q/20844913
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/20742107

http://stackoverflow.com/comment/31068617
type: Comment
has text: Exactly. See also [this](http://stackoverflow.com/questions/20704125/read-gmail-inbox-using-javamail-works-in-eclipse-but-not-outside), which is likely the same underlying problem.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20734866

http://stackoverflow.com/comment/31224913
comment on: http://stackoverflow.com/a/20822221
score: 0
type: AnswerComment
has text: Right, customer is free to use Future as he likes
type: Comment

http://stackoverflow.com/q/20760945
has title: Testing Jersey resourse with parameters
tagged with: rest
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20760962
type: Question
tagged with: jersey
has body: I'm using Jersey resourse in my project, like: @Path("/api") public class MyResource { @Path("/create") @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response handle(final String xml, @Context final HttpServletRequest request) { ..... } and I'm trying to test it: public class MobipayResourceTest extends JerseyTest { private MockHttpServletRequest servletRequest; @Override @Before public void setUp() throws Exception { servletRequest = new MockHttpServletRequest(); servletRequest.setMethod("POST"); } public MobipayResourceTest() throws TestContainerException { super("ua.privatbank.mobipay.api.resource"); } @Test public void testRes(){ WebResource webResource = resource(); webResource.path("/api/create").post(???); // I need to pass 2 parameters in the request - xml (in the body of post) and HttpServletRequest } How can I pass 2 my parameters (String xml and HttpServletRequest) to the resourse in test?
tagged with: integration-testing
score: 0
answer count: 1

http://stackoverflow.com/a/20711915
downvote count: 0
has comment: http://stackoverflow.com/comment/31025891
has comment: http://stackoverflow.com/comment/31026092
type: Answer
answers question: http://stackoverflow.com/q/20711819
has body: The code inside SwingUtilities is something like this private Runnable runnable; private void invoke(){//called at some point from inside the runnable runable.run(); } public void invokeLater(Runnable runnable){ this.runnable=runnable; } These are called callbacks.
upvote count: 3
score: 3

http://stackoverflow.com/comment/31242743
comment on: http://stackoverflow.com/q/20831782
score: 0
has text: Ah, yes. Sorry. I was kind of in a hurry.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31147711
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20779743
type: Comment
has text: As by Mr. Rafa El, don't use key-event, rather than this use onClick event and in your logic check if enrollment no. is already available or not if it is available, update/store for same other-wise increment it by 1.

http://stackoverflow.com/comment/31245613
comment on: http://stackoverflow.com/a/20833406
has text: @edwin Because you are not altering the reference. You are _dereferencing_ the reference to access the referenced object.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31001699
type: Comment
type: AnswerComment
has text: Thank you for the code. But why the text is not expanding, eventhough the assigned space get expanded?
comment on: http://stackoverflow.com/a/20698847
score: 0

http://stackoverflow.com/q/20705082
tagged with: unit-testing
type: Question
accepted answer: http://stackoverflow.com/a/20705402
has title: SpringJUnit4ClassRunner with declarative and annotated beans
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20705402
tagged with: spring
has body: I have a declarative spring config @Configuration public class SpringConfig { @Bean public someBean() { return new Bean1(); } } and a @Component annotated Bean @Component public class Bean2 { } Now I would like to use both of then in my UnitTest @RunWith(SpringJUnit4ClassRunner.class) public void UnitTest { @Autowired Bean1 bean1; @Autowired Bean2 bean2; } but I have no idea how to do it.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31128128
has text: Are you getting any errors? Looking at this code, the empoyye_table seems to be null. but maybe you are setting it somewhere else?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20768645

http://stackoverflow.com/a/20710164
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20710140
has body: Have a Thread's run method call the static method: new Thread(Call::yourStaticMethod).start();
score: 9
type: AcceptedAnswer
upvote count: 9
type: Answer
answers question: http://stackoverflow.com/q/20710140

http://stackoverflow.com/comment/31150616
type: AnswerComment
has text: `port` is optional. And even `localhost` if on local machine.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20781761

http://stackoverflow.com/comment/31178722
comment on: http://stackoverflow.com/a/20797380
has text: the classes Ciudadano and FicherosDeCiudadanos are in the same package and still, both are imported in the class that calls the method `leerFichero()`. Sorry if I'm difficult to understand
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20755532
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31105158
accepted answer of: http://stackoverflow.com/q/20755516
answers question: http://stackoverflow.com/q/20755516
has body: Is this anonymous class ??????????? Yes this is anonymous inline class implementation. This is used when you want to create a thread object of your class locally using the inline class implementation.
type: AcceptedAnswer

http://stackoverflow.com/q/20842409
answer count: 1
duplicate of: http://stackoverflow.com/q/5308200
has comment: http://stackoverflow.com/comment/31261614
has answer: http://stackoverflow.com/a/20842460
linked to: http://stackoverflow.com/q/5308200
tagged with: android
downvote count: 1
favorite count: 0
has title: Android : Function to delete a sentence in a EditText
upvote count: 0
has comment: http://stackoverflow.com/comment/31261715
has comment: http://stackoverflow.com/comment/31261695
has comment: http://stackoverflow.com/comment/31261669
type: Question
type: AnsweredQuestion
tagged with: java
has body: I have a EditText and near to it I have a button with the cross. What I want is to know the Function to put in my ButtonX.setOnclickListener to clear the EditText !! is that something like setClear() or something ? Thank you !
score: -1
accepted answer: http://stackoverflow.com/a/20842460
has comment: http://stackoverflow.com/comment/31261616

http://stackoverflow.com/a/20724987
downvote count: 0
has comment: http://stackoverflow.com/comment/31049568
has comment: http://stackoverflow.com/comment/31049527
has comment: http://stackoverflow.com/comment/31049599
type: Answer
has comment: http://stackoverflow.com/comment/31049869
has comment: http://stackoverflow.com/comment/31049656
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/20724591
has body: Date-Time Library A good date-time library such as: Joda-Time New java.time.* JSR 310 classes bundled with Java 8 …makes this kind of work much easier and more reliable. Joda-Time Example In Joda-Time 2.3, basically one line of code… Months.monthsBetween( start, stop ) // © 2013 Basil Bourque. This source code may be used freely forever by anyone taking full responsibility for doing so. // import org.joda.time.*; // import org.joda.time.format.*; String przekazaneDataOd = "2013-10-26" ; String przekazaneDataDo = "2014-03-11" ; DateTime start = new DateTime( przekazaneDataOd ); DateTime stop = new DateTime( przekazaneDataDo ); // Exclusive of the months of the dates. Just the full months *between* the dates. Months monthsBetween = Months.monthsBetween( start, stop ); int monthsNumber = monthsBetween.getMonths(); // Inclusive of the months of the dates. DateTimeZone timeZone_Warsaw = DateTimeZone.forID("Europe/Warsaw" ); // Get first day of the month containing start date. DateTime outside_begin = new DateTime( przekazaneDataOd, timeZone_Warsaw ).withDayOfMonth( 1 ).withTimeAtStartOfDay(); // Get first day of the month *after* the month containing the stop date. DateTime outside_end = new DateTime( przekazaneDataDo, timeZone_Warsaw ).plusMonths(1).withDayOfMonth( 1 ).withTimeAtStartOfDay(); int outside_months = Months.monthsBetween( outside_begin, outside_end ).getMonths(); Dump to console… System.out.println( "start: " + start ); System.out.println( "stop: " + stop ); System.out.println( "monthsNumber: " + monthsNumber ); System.out.println( "outside_begin: " + outside_begin ); System.out.println( "outside_end: " + outside_end ); System.out.println( "outside_months: " + outside_months ); When run… start: 2013-10-26T00:00:00.000-07:00 stop: 2014-03-11T00:00:00.000-07:00 monthsNumber: 4 outside_begin: 2013-10-01T00:00:00.000+02:00 outside_end: 2014-04-01T00:00:00.000+02:00 outside_months: 6 CAVEAT Generally, a better practice is to always specify a named time zone such…

http://stackoverflow.com/comment/31176021
type: QuestionComment
comment on: http://stackoverflow.com/q/20795488
score: 0
has text: I am little confused that whether I am getting correct response in json or the format is incorrect
type: Comment

http://stackoverflow.com/q/20827354
tagged with: performance
has answer: http://stackoverflow.com/a/20827496
has title: Slow down enemy movement
has comment: http://stackoverflow.com/comment/31233912
score: 0
has comment: http://stackoverflow.com/comment/31233910
answer count: 1
tagged with: game-engine
has body: I'm making a game using slick2d - and ive created a pathfinding algorithm, that will allow a 'zombie' to find the shortest path to the main hero. public void findPrey(int characterXPosition,int characterYPosition){ Pathfinder p = new Pathfinder(); n = p.aStar(xPosition,yPosition,characterXPosition,characterYPosition); //n is a linked list which holds node objects in the path if(!n.isEmpty()){ xPosition = (n.get(0).x); yPosition = (n.get(0).y); } } At the moment this works, but it just moves the zombie a tile (32x32) really quickly - like way too quickly! I tried this instead: if(xPosition &gt; n.get(0).x){ xPosition -= .1f * delta; } else if(xPosition &lt; n.get(0).x){ xPosition += .1f * delta; } if(yPosition &lt; n.get(0).y){ yPosition += .1f * delta; } else if(yPosition &gt; n.get(0).y){ yPosition -= .1f * delta; } Which only works if the zombie goes up or left - even then its really jumpy and if its meant to go down or right it goes mental and just keeps going up out of the screen. So anyone any idea how I can either slow down the movement of the first technique - or know why the second one isnt working? Thanks for any help! EDIT - ANSWER Okay figured a solution out - was pretty basic , I think just staring at the same code for a few hours did me. In the render method of my 'world' class where the zombies were getting rendered I just put this change in: Iterator&lt;Zombie&gt; i = zombies.iterator(); while (i.hasNext()) { Zombie z = i.next(); if (!z.isDead()) { z.updateDelta(newDelta); z.incrementCounter(); //put a counter variable in if(z.getCounter() % 40 == 0){ z.findPrey((int)shiftX,(int)shiftY); } z.render(gc, sbg, g); }else{ i.remove(); } } So i basically just added a counter variable in the Zombie class and then used modular so that it wouldnt get called as frequently. Thanks for everyone for trying to help.
has comment: http://stackoverflow.com/comment/31234056
has comment: http://stackoverflow.com/comment/31235320
has comment: http://stackoverflow.com/comment/31233955
type: UnansweredQuestion
tagged with: java
tagged with: slick2d
type: Question
has comment: http://stackoverflow.com/comment/31235331

http://stackoverflow.com/comment/30973285
has text: @A.S.: That is certainly correct, but he is developing on the client side and the server side is most likely fixed and 3rd party, so he can't change how the server handles messages, thus if it's not accepting JSON, you have no chance using JSON.
comment on: http://stackoverflow.com/q/20683260
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20771245
favorite count: 0
has title: how to get some particular word from String in JAVA Android?
has answer: http://stackoverflow.com/a/20771266
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/20934816
answer count: 4
linked to: http://stackoverflow.com/q/5414657
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31132320
has body: I have one String String path = /PravinSB/servlet/com.gjgj.rmf.controllers.Hello from this String I need only word - PravinSB. How can I do this in JAVA
type: Question
has answer: http://stackoverflow.com/a/20771349
has answer: http://stackoverflow.com/a/20772171
upvote count: 3
tagged with: string

http://stackoverflow.com/a/20687374
has comment: http://stackoverflow.com/comment/30981091
answers question: http://stackoverflow.com/q/20686951
has body: With apologies to Satheesh Cheveri, I am removing some of the bugs in his suggestion. String cols[] = line.split("\\|"); // since the argument to split is a regex and | is a special character, it must be quoted. double v1 = Double.parseDouble(cols[3]); double v2 = Double.parseDouble(cols[4]); double v3 = Double.parseDouble(cols[5]); handleValuesFromLine(v1, v2, v3); // accumulate stuff for averaging later I would also recommend that you do an Extract Method to create a loadDataFromFile(BufferedReader in) method. That way you can write a second app to test your file parsing logic without having to run a GUI and click on 5 things just to test a code change.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/20686951
type: Answer

http://stackoverflow.com/a/20729746
answers question: http://stackoverflow.com/q/20728848
has body: Suppose you are looking for the host string in the file. You could possible do it like this. public boolean contains(Reader in, String word) throws IOException { BufferedReader inf = new BufferedReader(in); String l; boolean found = false; while((l=inf.readLine())!=null){ if (l.contains(word)) { found = true; break; } } return found; }
score: 0
type: Answer

http://stackoverflow.com/a/29371802
has body: Inside NetBeans IDE, you can view the implementation details of Paths class by doing the following: Step one: click your cursor on the line where you have written your Path code. An example Path would be: Path p = Paths.get("someDir\someOtherDir"); Step Two: Click Debug | Step Into (F7) It will bring up the implementation details of Paths
type: Answer
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20836121

http://stackoverflow.com/a/20840253
has comment: http://stackoverflow.com/comment/36415069
has comment: http://stackoverflow.com/comment/36400000
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31258184
accepted answer of: http://stackoverflow.com/q/20839099
answers question: http://stackoverflow.com/q/20839099
type: Answer
score: 2
downvote count: 0
has body: Caused by: java.lang.NoClassDefFoundError: it.sephiroth.android.library.easing.Cubic at it.sephiroth.android.library.imagezoom.ImageViewTouchBase.&lt;init&gt;(ImageViewTouchBase.java:72) at it.sephiroth.android.library.imagezoom.ImageViewTouch.&lt;init&gt;(ImageViewTouch.java:42) at pl.XXX.app.utils.ImageViewZoom.&lt;init&gt;(ImageViewZoom.java:21) at pl.XXX.app.utils.ImageViewZoom.&lt;init&gt;(ImageViewZoom.java:17) Your ImageViewZoom constructor eventually calls ImageViewTouchBase constructor which it.sephiroth.android.library.easing.Cubic that cannot be found. Make sure the code is included in your project.
has comment: http://stackoverflow.com/comment/31258484

http://stackoverflow.com/comment/31198386
has text: What do you mean by click through. Please give a specific scenario and the code you have attempted to write up to now.
score: 1
comment on: http://stackoverflow.com/q/20808331
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20831786
upvote count: 5
score: 4
answers question: http://stackoverflow.com/q/20831722
type: Answer
has body: Dynamic Binding refers to the case where compiler is not able to resolve the call and the binding is done at runtime only. Let's try to understand this. Suppose we have a class named 'SuperClass' and another class named 'SubClass' extends it. Now a 'SuperClass' reference can be assigned to an object of the type 'SubClass' as well. If we have a method (say 'someMethod()') in the 'SuperClass' which we override in the 'SubClass' then a call of that method on a 'SuperClass' reference can only be resolved at runtime as the compiler can't be sure of what type of object this reference would be pointing to at runtime. ... SuperClass superClass1 = new SuperClass(); SuperClass superClass2 = new SubClass(); ... superClass1.someMethod(); // SuperClass version is called superClass2.someMethod(); // SubClass version is called .... Here, we see that even though both the object references superClass1 and superClass2 are of type 'SuperClass' only, but at run time they refer to the objects of types 'SuperClass' and 'SubClass' respectively. Hence, at compile time the compiler can't be sure if the call to the method 'someMethod()' on these references actually refer to which version of the method - the super class version or the sub class version. Thus, we see that dynamic binding in Java simply binds the method calls (inherited methods only as they can be overriden in a sub class and hence compiler may not be sure of which version of the method to call) based on the actual object type and not on the declared type of the object reference. Copied from the following site
has comment: http://stackoverflow.com/comment/31273131
has comment: http://stackoverflow.com/comment/31249392
downvote count: 1

http://stackoverflow.com/a/20708360
has body: You want fictionArray[i] != null. = is the assignment operator. ! is the logical not operator. It only applies to boolean expressions.
accepted answer of: http://stackoverflow.com/q/20708341
answers question: http://stackoverflow.com/q/20708341
score: 6
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6

http://stackoverflow.com/q/20781549
type: Question
has answer: http://stackoverflow.com/a/20781748
answer count: 2
tagged with: awt
has answer: http://stackoverflow.com/a/27680222
upvote count: 1
has comment: http://stackoverflow.com/comment/31311832
has comment: http://stackoverflow.com/comment/31150301
downvote count: 0
has comment: http://stackoverflow.com/comment/31311774
tagged with: paintcomponent
has title: How can I update my Java AWT frame when an element on it changes?
has body: I'm new to programming and I can't seem to sort this problem: how can I make the frame of my app change? It's a Minesweeper game. The program logic is good, events are working, but the frame itself isn't repainting itself... I did not have this kind of problem with applets.. how can I make this work? public void paint(Graphics g) { Graphics2D g2=(Graphics2D)g; _Main.toPaint(g2); } public void update(Graphics g) { Graphics offgc; Image offScreen=null; Dimension d=size(); offScreen=createImage(d.height, d.width); offgc=offScreen.getGraphics(); offgc.setColor(getBackground()); offgc.fillRect(0, 0, d.width, d.height); offgc.setColor(getForeground()); paint(offgc); g.drawImage(offScreen,0,0,this); }
has comment: http://stackoverflow.com/comment/31165325
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31173281
linked to: http://stackoverflow.com/q/6255106
score: 1
tagged with: java

http://stackoverflow.com/comment/31164205
has text: It does not work **how**? People, is it really that hard to imagine that things may fail in multiple ways?
score: 1
comment on: http://stackoverflow.com/q/20789418
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20712893
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/20712921
has body: I am trying to develop collision detection. For some reason, the collision is working for the last entity in the LinkedList. I have tried my best to debug it using the console to see where it's stopping, but I had no luck. All the other entities are not working, only the last one is. Here is the code : public class Player implements Entity { Image player; public float x = 100f; public float y = 100f; public boolean canGoLeft = true; public boolean canGoRight = true; public boolean canGoUp = true; public boolean canGoDown = true; public float speed = 0.15f; public Rectangle leftRect; public Rectangle rightRect; public Rectangle topRect; public Rectangle bottomRect; int i = 0; Entities entities = new Entities(); public Player() { } public void update(GameContainer game, int delta) { if(Keyboard.isKeyDown(Keyboard.KEY_D)) { if(canGoRight) { x += speed * delta; } } if(Keyboard.isKeyDown(Keyboard.KEY_A)) { if(canGoLeft) { x -= speed * delta; } } if(Keyboard.isKeyDown(Keyboard.KEY_W)) { if(canGoUp) { y -= speed * delta; } } if(Keyboard.isKeyDown(Keyboard.KEY_S)) { if(canGoDown) { y += speed * delta; } } for(Entity entity : Game.entities.entities) { checkCollisions(entity); } } public void render(GameContainer game, Graphics g) { leftRect = new Rectangle(x, y + 5, 2, 80); rightRect = new Rectangle(x + 45, y + 5, 2, 80); topRect = new Rectangle(x + 6, y, 36, 2); bottomRect = new Rectangle(x + 6, y + 90, 36, 2); //rect = new Rectangle(200, 100, 60, 88); try { player = new Image("res/Player.png"); player.setFilter(Image.FILTER_NEAREST); } catch (SlickException e) { e.printStackTrace(); } player.draw(x, y, 60, 88); //g.draw(leftRect); //g.draw(rightRect); //g.draw(topRect); //g.draw(bottomRect); } public void checkCollisions(Entity entity) { // Collision Detection if(leftRect.intersects(entity.getRect())) { canGoLeft = false; } if(rightRect.intersects(entity.getRect())) { canGoRight = false; } if(topRect.intersects(entity.getRect())) { canGoUp = false; } if(bottomRect.intersec…
favorite count: 0
possible better answer: http://stackoverflow.com/a/20712921
has answer: http://stackoverflow.com/a/20712960
tagged with: collision
type: AnsweredQuestion
has title: Why isn't the LinkedList going through all entities?
accepted answer: http://stackoverflow.com/a/20712960
tagged with: java
tagged with: collision-detection
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/comment/31214692
comment on: http://stackoverflow.com/a/20817092
has text: You can set field values via the reflection api, that's more than just introspection, but it's not a structural change.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20806127
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: How can i assign test to str ?? No simply you cannot. Java plays on server side and javascript on server side. A client doesn't execute the java code. You can assign a java value to javascript variable with jsp or Expression language on server side. To send a javascript value to java you have to make a server request, So the server process your string and send the results back to client. Most probably you are looking for AJAX request. Ajax. Do not confuse that JSP and java script existed on same document(or file). Yes but JSP part compiles on server side and JavaScript executes by browser. A clear cut example found here for a start.
upvote count: 2
answers question: http://stackoverflow.com/q/20806092
score: 2
accepted answer of: http://stackoverflow.com/q/20806092
has comment: http://stackoverflow.com/comment/31194191

http://stackoverflow.com/q/20781500
has comment: http://stackoverflow.com/comment/71434483
score: 4
tagged with: java
tagged with: orm
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20786506
upvote count: 5
type: UnansweredQuestion
has title: Storing a Map<Locale,String> using JPA
tagged with: jpa
favorite count: 0
type: Question
has body: What's the simplest way to store a Map&lt;Locale,String&gt; attribute using JPA annotations? The application that I'm working on needs to store multilingual text – that is (essentially) the same text but written in multiple languages. Note that a good number of entities require this kind of attribute (and multiple of such attributes per entity). Therefore the solution needs to be easily replicable and not copy-pasting gobs and gobs of code to each entity. To illustrate, the application will need to store data for these things: (notice that the same item is written in five languages)

http://stackoverflow.com/a/20836360
has body: As you have pointed outNullPointerException is because the Async task take time to generate the String, and the getPrediction() method returns the string before it is ready. You should run your network based operation in thread in doInBackground and then join that thread. Then you should call getPrediction() in onPostExecute(). Thus you'll have the data before the method is called.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20836245

http://stackoverflow.com/comment/31052049
type: Comment
has text: The previous line is the problem. Use a real IDE.
type: QuestionComment
comment on: http://stackoverflow.com/q/20726402
score: 1

http://stackoverflow.com/q/20803029
has answer: http://stackoverflow.com/a/20803051
type: Question
score: 5
tagged with: sum
accepted answer: http://stackoverflow.com/a/20803051
has body: The sum of two double is infinity even though these numbers are not infinity. The code is following. entropy += (probs.get(key)* (Math.log(probs.get(key)) / Math.log(2.0))); if(entropy == Double.POSITIVE_INFINITY || entropy == Double.NEGATIVE_INFINITY){ System.out.println("Prob:"+probs.get(key)); System.out.println("base 10: "+Math.log(probs.get(key))); System.out.println("base 2: "+Math.log(2.0)); System.out.println("result: "+(probs.get(key)*(Math.log(probs.get(key))) / Math.log(2.0))); System.out.println("entropy before sum "+temp); break; }` And the result is: Prob:1.0476603084695572E305 base 10: 702.3350127634005 base 2: 0.6931471805599453 result: 1.0615472972511642E308 entropy before sum: 1.246498306457423E308 So how can it be possible that the sum of result + entropy = 1.0615472972511642E308 + 1.246498306457423E308 = INFINITY
answer count: 2
tagged with: infinity
favorite count: 0
possible better answer: http://stackoverflow.com/a/20803352
tagged with: double
has answer: http://stackoverflow.com/a/20803352
upvote count: 6
type: AnsweredQuestion
has title: Sum of two double numbers in java is infinity
tagged with: java
downvote count: 1

guice
tags question: http://stackoverflow.com/q/20749404
tag name: guice
tags question: http://stackoverflow.com/q/20778090
tags question: http://stackoverflow.com/q/20758541
type: Tag
tags question: http://stackoverflow.com/q/20728826
tags question: http://stackoverflow.com/q/20731500
tags question: http://stackoverflow.com/q/20735211
tags question: http://stackoverflow.com/q/20799913
tags question: http://stackoverflow.com/q/20745423
tags question: http://stackoverflow.com/q/20713086
tags question: http://stackoverflow.com/q/20772851

http://stackoverflow.com/comment/30967977
has text: @xedo: A good hash function will almost always give you unique value. But it is not guaranteed. After all, you can only have finitely many 8 character strings.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/20679964
type: QuestionComment

http://stackoverflow.com/comment/31217340
type: QuestionComment
comment on: http://stackoverflow.com/q/20818425
type: Comment
score: 0
has text: I would use `JPanel` per square. There is no performance problem since you use fixed square count and its easy to handle styles, BG, images ....

http://stackoverflow.com/comment/30980294
has text: @ArlaudPierre Yeah but creating new scanner objects is wasteful.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20686352

http://stackoverflow.com/comment/31113405
score: 0
type: Comment
type: QuestionComment
has text: Hi Tim. I've edited the above post and added the onCreate from MainActivity.
comment on: http://stackoverflow.com/q/20760676

http://stackoverflow.com/comment/31068662
has text: @camickr. Setting the preferred size to 0,0 should not be a problem since you always specify the fill as BOTH.
comment on: http://stackoverflow.com/a/20735323
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/30971798
has text: How can we escape it, I have used String xml = "ﾝￊￒ%ﾝￋ\\&amp;"; in the above code but still it throws the same exception.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20681166

http://stackoverflow.com/a/60017378
score: 0
upvote count: 1
type: Answer
downvote count: 1
has body: In Addition to @JB Nizet answer, To Provide our own string representation, we have to override toString() in our class which is highly recommended because There are some classes in which toString() is overridden already to get the proper string representation. Examle: String, StringBuffer, StringBuilder and all wrapper classes Integer ob1 = new Integer("10"); String ob2 = new String("Doltan Roy"); StringBuffer ob3 = new StringBuffer("The Rock"); StringBuilder ob4 = new StringBuilder("The Joshua"); System.out.println(ob1); System.out.println(ob2); System.out.println(ob3); System.out.println(ob4); Output: 10 Doltan Roy The Rock The Joshua Hope this would help!
answers question: http://stackoverflow.com/q/20735132

http://stackoverflow.com/q/20826371
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20830154
tagged with: glassfish
score: 0
answer count: 1
has body: I have a dilemma. I’m developing a web app using glassfish4.0 opensource edition, springframework MVC. How do I apply modified classes without stopping application, after launching this application? I know dynamic reload in glassfish. But this function is needed a few times. If application has a payment service, then this is very critical issue. So I wonder: how do I apply modified classes without stopping application? Thanks for reading.
has title: How to modify real servicing environment when using glassfish?
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20830154

http://stackoverflow.com/comment/31027209
type: AnswerComment
type: Comment
score: 0
has text: No problem, we were thinking the same thing, I just thought it needed some clarification was all
comment on: http://stackoverflow.com/a/20712885

http://stackoverflow.com/comment/31086265
comment on: http://stackoverflow.com/q/20745679
has text: Either *you* will loop, or a method you call will do the looping for you. That's a mighty small difference in the end.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20784493
has comment: http://stackoverflow.com/comment/31155573
score: 2
tagged with: overloading
tagged with: oop
has comment: http://stackoverflow.com/comment/31155162
tagged with: java
has comment: http://stackoverflow.com/comment/31155828
has answer: http://stackoverflow.com/a/20784683
has body: I was studying about static and dynamic polymorphism and got these links: http://guruzon.com/1/oop-concepts/polymorphism/what-is-polymorphism-example-tutorial-uml-diagram-notation http://www.coderanch.com/t/379004/java/java/static-polymorphism-dynamic-polymorphism http://javarevisited.blogspot.in/2011/08/what-is-polymorphism-in-java-example.html In all these links , It has been said that Overloading is an example of polymorphism , then I came across two more places where it has been said that overloading has nothing to do with polymorphism, the links are: Is Method Overloading considered polymorphism? Head First Java 2nd Edition Chapter 7 (Inheritence and Polymorphism) Last topic: Overloading a method . Now I am not able to figure out whether it is a kind of polymorphism or not and if it is not the is there anything called static polymorphism in OOPs ?
type: Question
tagged with: object-oriented-analysis
downvote count: 0
has comment: http://stackoverflow.com/comment/31155651
has comment: http://stackoverflow.com/comment/31155641
linked to: http://stackoverflow.com/q/2400284
answer count: 1
tagged with: polymorphism
favorite count: 0
duplicate of: http://stackoverflow.com/q/2400284
upvote count: 2
type: UnansweredQuestion
has title: Is Method Overloading a Type of Polymorphism?
has comment: http://stackoverflow.com/comment/31155779

http://stackoverflow.com/a/20711388
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31264402
accepted answer of: http://stackoverflow.com/q/20707993
answers question: http://stackoverflow.com/q/20707993
has body: at the beginning of shell script that start cassandra add export JAVA_HOME=/path/to/java_v7 export PATH=$JAVA_HOME/bin:$PATH and it should help
type: AcceptedAnswer

http://stackoverflow.com/a/20700982
downvote count: 0
has comment: http://stackoverflow.com/comment/31004740
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20700898
has comment: http://stackoverflow.com/comment/31004789
has body: You will first need to read the files content. Then you could use a regular expression that matches the ip address (e.g. \d+\.\d+\.\d+\.\d+) and replace it with the new one. When you've done that write it back in the file again. Here is a regex tester: http://www.regexplanet.com/advanced/java/index.html Here a tutorial of how to read and write files: http://www.java-samples.com/showtutorial.php?tutorialid=392

http://stackoverflow.com/a/20842180
has body: I did a demo and unit test for you, currently I use java.util.Date to substitute your SomeDate class . update: 2013-12-31 I am not trying to make things complex,but I really feel it is my responsibility to not mislead others,so I try to fixed the code again.Currently, HashMap can't be append,please improve it.Thanks! this code refactored from your code: import java.io.*; import java.util.*; /** * refactored by your code * append object stream haven't realized,please help * 2013-12-31 */ public class Reminder implements Serializable { public static void main(String[] args) { //do some initialization Reminder re = new Reminder(); re.put(new Date(System.currentTimeMillis()), "Hope it work!"); re.put(new Date(System.currentTimeMillis()+100), "it work!"); re.put(new Date(System.currentTimeMillis()+200), "Wake up!"); //save to file ,using append mode String filpath = "/tmp/reminder.ser"; re.save(filpath,true); //load from file and iterate the key-value pair Reminder reLoad = Reminder.Load(filpath); if(reLoad != null) { Iterator&lt;Map.Entry&lt;Date,String&gt;&gt; it = reLoad.entrySet().iterator(); while(it.hasNext()) { Map.Entry&lt;Date,String&gt; entry = it.next(); System.out.format("reminder: %tc---%s%n",entry.getKey(),entry.getValue()); } } } public Set&lt;Map.Entry&lt;Date,String&gt;&gt; entrySet() { return reminderMap.entrySet(); } public void put(Date chosenDate, String string) { reminderMap.put(chosenDate, string); } public String get(Date chosenDate) { return reminderMap.get(chosenDate); } /** * serializing an object * @param filePath path to save file * @param append indicate whether append or not */ public void save(String filePath,boolean append){ System.out.println("Trying to save"); try { ObjectOutputStream out = new ObjectOutputStream ( new FileOutputStream(filePath,append)); out.writeObject(this); out.close(); System.out.printf("Serialized data is saved in "+filePath); }catch(IOException e) { e.printStackTrace(); } } /** * deserialize ,load from file and re…
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20841731
type: Answer
accepted answer of: http://stackoverflow.com/q/20841731
upvote count: 1

http://stackoverflow.com/q/20832277
has answer: http://stackoverflow.com/a/20832457
score: 0
answer count: 1
has title: Unable to find explicit activity class even though it exists
type: UnansweredQuestion
tagged with: android
has body: I don't understand why I am getting this error. It looks like everything is setup correctly in the manifest so I don't understand the logcat error: 12-29 17:22:50.111: E/AndroidRuntime(24103): FATAL EXCEPTION: main 12-29 17:22:50.111: E/AndroidRuntime(24103): java.lang.IllegalStateException: Could not execute method of the activity 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.view.View$1.onClick(View.java:3633) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.view.View.performClick(View.java:4240) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.view.View$PerformClick.run(View.java:17721) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.os.Handler.handleCallback(Handler.java:730) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.os.Handler.dispatchMessage(Handler.java:92) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.os.Looper.loop(Looper.java:137) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.app.ActivityThread.main(ActivityThread.java:5103) 12-29 17:22:50.111: E/AndroidRuntime(24103): at java.lang.reflect.Method.invokeNative(Native Method) 12-29 17:22:50.111: E/AndroidRuntime(24103): at java.lang.reflect.Method.invoke(Method.java:525) 12-29 17:22:50.111: E/AndroidRuntime(24103): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 12-29 17:22:50.111: E/AndroidRuntime(24103): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 12-29 17:22:50.111: E/AndroidRuntime(24103): at dalvik.system.NativeStart.main(Native Method) 12-29 17:22:50.111: E/AndroidRuntime(24103): Caused by: java.lang.reflect.InvocationTargetException 12-29 17:22:50.111: E/AndroidRuntime(24103): at java.lang.reflect.Method.invokeNative(Native Method) 12-29 17:22:50.111: E/AndroidRuntime(24103): at java.lang.reflect.Method.invoke(Method.java:525) 12-29 17:22:50.111: E/AndroidRuntime(24103): at android.view.View$1.onClick(View.java:3628) 12-29 17:22:50.111: E/AndroidRuntime(24103): ... 11 more 12-29 17:…
has comment: http://stackoverflow.com/comment/31243649
has comment: http://stackoverflow.com/comment/31243870
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31243819
tagged with: eclipse

http://stackoverflow.com/q/20745415
has body: I am new to using arrays of objects but can't figure out what I am doing wrong and why I keep getting a Null pointer exception. I am trying to create TextReport on JTextArea using array of String input.even i am working on Text spillover to get extra text on next line and it should be display as in table format on JTextArea. my boss told me to make simple report for bank project. For more simplicity. Thanks in advance. import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.border.Border; public class testit extends JApplet implements ActionListener { String[] colName = new String[]{"Date", "Account.No", "Description", "Deposit", "Withdraw"}; String A[][] = {{"13/12/2013", "101", "AlphaSoft Infotek Ltd. Nashik", "3000", "0"}, {"15/12/2013", "103", "Bank Ladger ", "5000", "0"}}; String[][] B = new String[3][5]; String[] K = new String[5]; Container c; JTextArea outputArea; //JScrollPane js1; JButton b; public void init() { c = getContentPane(); c.setLayout(new FlowLayout()); outputArea = new JTextArea(20, 80); Border border = BorderFactory.createLineBorder(Color.RED); outputArea.setBorder(BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(10, 10, 10, 10))); c.add(outputArea); //js1=new JScrollPane(outputArea); // add(js1); b = new JButton("Show Report"); b.addActionListener(this); c.add(b); } public void actionPerformed(ActionEvent e) { outputArea.setEditable(false); outputArea.setFont(new Font("Times New Roman", Font.PLAIN, 14)); outputArea.setText(" "); outputArea.append("ALPHASOFT -- BANK LADGER , REPORTS.\n\n"); //outputArea.append("Sr.No"); for (int j = 0; j &lt; colName.length; j++) { outputArea.append("\t" + colName[j]); } outputArea.append("\n"); for (i…
has title: Null Pointer Exception in Array of String
has comment: http://stackoverflow.com/comment/31086046
upvote count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20745446
type: Question
tagged with: jtextarea
score: -1
answer count: 1
downvote count: 1
tagged with: arrays
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31085701

http://stackoverflow.com/comment/31140066
type: AnswerComment
comment on: http://stackoverflow.com/a/20735512
type: Comment
has text: Thanks for your help! I edited the question again... sorry, I'm a bit newbie in LibGDX...
score: 0

http://stackoverflow.com/comment/31242776
type: QuestionComment
comment on: http://stackoverflow.com/q/20831411
type: Comment
score: 1
has text: Swing can do it, but for some reason, the designers of the Transfer API decided to make nigh on impossible to actually do this particular task...don't know why and I don't like them for it either

http://stackoverflow.com/comment/31250040
type: AnswerComment
type: Comment
has text: @PrakharBansal Log it in the appropriate 'areDifferent' methods. For eg; logTheDifference("font bold formatting differs"); will be done in the FontComparer's areDifferent method.
comment on: http://stackoverflow.com/a/20782923
score: 0

http://stackoverflow.com/comment/31379097
type: Comment
has text: You're missing a "/" after hotfolder, so your concatenated filename is "/Users/majid/Documents/workspaceRest/RESTfulWebserviceExample/Temp/hotfold‌​erpic1.jpg". Add a trailing slash to the directory name : `File f = new File("/Users/majid/Documents/workspaceRest/RESTfulWebserviceExample/Temp/hotfold‌​er/" + image);`
type: AnswerComment
comment on: http://stackoverflow.com/a/20843701
score: 0

http://stackoverflow.com/a/20824477
type: Answer
has body: I would implement this as a flexible solution of a 2D matrix. Where each row corresponds to a range of the systolic, each column in each row corresponds to a range of diastolic, and the value in the matrix (row, column) is the resulting value..... Given systolic find the row that corresponds, within the row find the column that corresponds using diastolic and read out value. Then map value to text/color for box with result. This would allow you to have multiple mappings for different genders, ages, weights, ethnicity....and just one code, plus combinations impossible to model with your AND / OR code.....
has comment: http://stackoverflow.com/comment/31228424
downvote count: 0
answers question: http://stackoverflow.com/q/20821311
score: 1
upvote count: 1

http://stackoverflow.com/a/20711923
has comment: http://stackoverflow.com/comment/31025623
has comment: http://stackoverflow.com/comment/31025816
upvote count: 1
has comment: http://stackoverflow.com/comment/31025656
has comment: http://stackoverflow.com/comment/31025712
has body: Use DES.class.getName() instead of DES.getClass().getName() getClass() is a member function and can be invoked only on instance of a class, not the type of the class DES represents a class, not an instance of the class DES.
type: Answer
has comment: http://stackoverflow.com/comment/31025584
downvote count: 0
has comment: http://stackoverflow.com/comment/31025677
answers question: http://stackoverflow.com/q/20711837
score: 1

http://stackoverflow.com/a/20800124
has body: Generating a device id is actually not as simple as it seems since the result may vary depending on the android version, manufacturer, etc. Checkout this great post which explains the pros and cons of each method of generating a device id: http://developer.samsung.com/android/technical-docs/How-to-retrieve-the-Device-Unique-ID-from-android-device
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/20799986
accepted answer of: http://stackoverflow.com/q/20799986
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31266416
comment on: http://stackoverflow.com/a/20828937
score: 0
type: AnswerComment
type: Comment
has text: how do you package it as a war file - I've managed to generate the wsgen files - but as the project is a normal java se application i am unable to export as war

http://stackoverflow.com/comment/31064301
type: Comment
has text: The original Java was really low level --- e.g. memory allocation only ever happened in the `new` operator! --- and they wouldn't have been able to implement something like this without silently emitting calls to run-time functions, which they wouldn't have wanted to do. Plus they had a philosophical objection to operator overloading (although the language has it in places...). Plenty of languages have these kind of features; as you point out they're useful and the syntax is unambiguous. Just, Java doesn't. Try Scala instead.
type: QuestionComment
comment on: http://stackoverflow.com/q/20732995
score: 0

http://stackoverflow.com/q/20786995
tagged with: class
has answer: http://stackoverflow.com/a/20787189
score: 0
accepted answer: http://stackoverflow.com/a/20787158
has body: I am working on a project to parse the text. I am parsing for specific text and store them in the array. I have written a class for it. If I get improper text so that I cannot find what I want in the given input, What is the best practice, should I return the empty array and let the calling class handle it or should I raise a custom exception to the calling class.
answer count: 4
tagged with: convention
tagged with: exception
type: AnsweredQuestion
tagged with: java
has title: Custom exceptions or empty list
type: Question
has answer: http://stackoverflow.com/a/20787173
possible better answer: http://stackoverflow.com/a/20787154
tagged with: arrays
has answer: http://stackoverflow.com/a/20787154
has answer: http://stackoverflow.com/a/20787158

http://stackoverflow.com/q/20815475
has comment: http://stackoverflow.com/comment/31221359
has comment: http://stackoverflow.com/comment/31211819
has comment: http://stackoverflow.com/comment/31232674
has comment: http://stackoverflow.com/comment/31211894
tagged with: c++
has body: I'm tring to run jar file from C++ I wrote this code: #include "stdafx.h" #include &lt;iostream&gt; #include &lt;strsafe.h&gt; #include &lt;stdexcpt.h&gt; #include "jni.h" #include &lt;conio.h&gt; #include &lt;Windows.h&gt; using namespace std; #pragma comment (lib,"C:\\Users\\Hilla\\Documents\\Visual Studio 2012\\helloworld\\helloworld\\jvm.lib") int main() { JavaVM *jvm; JNIEnv *env; JavaVMInitArgs vm_args; JavaVMOption options[3]; options[0].optionString = "-Djava.compiler=NONE"; options[1].optionString="-Djava.class.path=C:\\Users\\Hilla\\Documents\\Visual Studio 2012\\helloworld\\Debug\\hello.jar"; options[2].optionString="verbose.jni"; vm_args.version=JNI_VERSION_1_6; vm_args.nOptions=3; vm_args.options=options; vm_args.ignoreUnrecognized=0; int ret=JNI_CreateJavaVM(&amp;jvm,(void**)&amp;env,&amp;vm_args); printf("hilla"); } I work with the x64 compiler. I add the JVM lim to the system path. And it's still giving me this error: 'helloworld.exe' (Win32): Loaded 'C:\Users\Hilla\Documents\Visual Studio 2012\helloworld\x64\Debug\helloworld.exe'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Program Files\Java\jdk1.7.0_45\jre\bin\server\jvm.dll'. Cannot find or open the PDB file. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110d.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\msvcr110d.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\wsock32.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. Symbols loaded. 'helloworld.exe' (Win32): Loaded …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/52437853
type: Question
has comment: http://stackoverflow.com/comment/31211811
has comment: http://stackoverflow.com/comment/31211922
tagged with: java-native-interface
tagged with: java
linked to: http://stackoverflow.com/q/12954821
score: 0
answer count: 1
tagged with: jar
linked to: http://stackoverflow.com/q/15937707
has title: Cannot find or open the PDB file Visual studio 2012
tagged with: jvm

http://stackoverflow.com/comment/31113015
type: Comment
has text: But `str` does change. Every time you write `str = str_buf.deleteCharAt(str.length() - 1).toString();` it changes. The only problem is that there are multiple copies of `str`. But all of them get shorter, and get to zero length eventually. This program does terminate, even with the `while` present. It just prints a lot more stuff than you might expect it to.
comment on: http://stackoverflow.com/a/20760128
score: 0
type: AnswerComment

http://stackoverflow.com/comment/88131750
type: QuestionComment
has text: Not sure if this is the original file but I found this: https://github.com/stratosphere/stratosphere/blob/master/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/AtomicEnum.java
comment on: http://stackoverflow.com/q/20685995
score: 0
type: Comment

http://stackoverflow.com/a/37180770
answers question: http://stackoverflow.com/q/20702884
type: Answer
upvote count: 1
score: 1
has body: I have to do the following to make it work with tomcat 7.0.69 and java 1.8, and jersey 2.22.2 Just sharing it if it comes to any use of any body. Add the following dependency in your Pom file : org.glassfish.jersey.containers jersey-container-servlet-core 2.22.2 org.glassfish.jersey.core jersey-client 2.22.2 org.glassfish.jersey.media jersey-media-json-processing 2.22.2 org.glassfish.jersey.containers jersey-container-servlet 2.22.2 org.glassfish.jersey.media jersey-media-sse 2.22.2 Needs to be servlet 3 so Heading of the web.xml should be like this : < ?xml version="1.0" encoding="UTF-8"? > < web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" > Jersey Servlet Container should be async-supported, so add it in the jersey servlet in the web.xml : < async-supported>true< /async-supported > If you use any filter make sure it also async-supported : < async-supported>true< /async-supported>
downvote count: 0

http://stackoverflow.com/q/20735956
has comment: http://stackoverflow.com/comment/31069595
has answer: http://stackoverflow.com/a/20736241
tagged with: pointers
favorite count: 0
possible better answer: http://stackoverflow.com/a/20735983
answer count: 5
has answer: http://stackoverflow.com/a/20736055
score: -3
has body: I’ve read a lot of articles about how “pass-by-reference” doesn’t exist in Java since a copy of the value of the reference is passed, hence “pass-by-copy-of-reference-value”. The articles also say a reference value is a pointer. (So pointers do exist in Java.) Some other articles say: Java has no pointers. So what is the correct solution? How does a pointer differ from a reference (or reference value), and do they exist in Java?
has answer: http://stackoverflow.com/a/20736054
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/20736559
tagged with: pass-by-reference
tagged with: reference
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31069764
upvote count: 2
linked to: http://stackoverflow.com/q/7436581
tagged with: java
has comment: http://stackoverflow.com/comment/31091728
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/31069570
type: Question
accepted answer: http://stackoverflow.com/a/20736055
has comment: http://stackoverflow.com/comment/31069656
duplicate of: http://stackoverflow.com/q/40480
has title: Difference between reference and pointer
downvote count: 5
has comment: http://stackoverflow.com/comment/31091528
has answer: http://stackoverflow.com/a/20735983

web-applications
tags question: http://stackoverflow.com/q/20796162
tags question: http://stackoverflow.com/q/20708889
tags question: http://stackoverflow.com/q/20784031
tags question: http://stackoverflow.com/q/20685358
tags question: http://stackoverflow.com/q/20760274
tag name: web-applications
tags question: http://stackoverflow.com/q/20837177
tags question: http://stackoverflow.com/q/20704086
tags question: http://stackoverflow.com/q/20829417
tags question: http://stackoverflow.com/q/20704917
type: Tag

http://stackoverflow.com/q/20698084
answer count: 1
has body: I am trying to run connectorZ JCA 1.6 Executor implementation, For that I downloaded Zip from github and try to execute the client, (Work Manager: JCA implementation of java.util.concurrent.Executor) I am able to run the application in Eclipse, (after solving some of dependency issues) the jsp page loading fine with the link "Execute 5 blocking tasks", when I click on particular link I am getting below Exception: Caused by: java.lang.NullPointerException at org.connectorz.threading.ThreadsResource.overload(ThreadsResource.java:72) [classes:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_40] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_40] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_40] at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_40] Here the Issues is executorFactory is null, I am not sure about jndi_name "jca/workmanager". @Resource(name="jca/workmanager") WorkExecutorFactory executorFactory; //NPE at executorFactory(not injecting). Whether I am missing any configuration related to jndi or any resource file? How can I solve this Issue?
tagged with: connector
favorite count: 0
upvote count: 5
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21814206
tagged with: java
type: Question
score: 5
tagged with: jca
tagged with: frameworks
tagged with: jboss6.x
has title: Exception while running connectorz Executor framework

http://stackoverflow.com/q/20758505
has comment: http://stackoverflow.com/comment/31110013
has comment: http://stackoverflow.com/comment/31109863
has answer: http://stackoverflow.com/a/20758610
downvote count: 0
has answer: http://stackoverflow.com/a/20758574
has title: Combining three arrays into one
favorite count: 0
has body: Here's my program, but it won't run and I don't know how to fix it...It throws an exception! It's supposed to combine the three arrays and sort the new array of length 12 and print that out. I would appreciate it if you didn't fix it right away, since this is homework. But I know everything, I just can't seem to be able to figure this out! I'm bad with exceptions...Here's the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at Combine.Combine(Combine.java:25) at Combine.main(Combine.java:12) here's the program: public class Combine { public static void main(String[] args){ int[] a = {1,4,5,6 }; int[] b = {3,8,9,11}; int[] c = {0,2,7,10}; Combine( a, b, c); } public static int[] Combine(int[] a, int[] b, int[] c) { int[] answer = new int[12]; int i = 0, j = 0, k = 0, p = 0; while (i &lt; 5 &amp;&amp; j &lt; 5) { if (a[i] &lt; b[j]) answer[k++] = a[i++]; else answer[k++] = b[j++]; } while (i &lt; 5 &amp;&amp; p &lt; 5 ) { if (a[i] &lt; c[p]) answer[k++]= a[i++]; else answer[k++]= c[p]; } while (j &lt; 5 &amp;&amp; p &lt; 5 ) { if (b[j] &lt; c[p]) answer[k++]= b[j++]; else answer[k++]= c[p++]; } while (i &lt; 5) answer[k++] = a[i++]; while (j &lt; 5) answer[k++] = b[j++]; while (p &lt; 5) answer[k++] = c[p++]; return answer; } }
has comment: http://stackoverflow.com/comment/31109685
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31109737
tagged with: merge
has answer: http://stackoverflow.com/a/20758679
has answer: http://stackoverflow.com/a/20758606
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20758557
upvote count: 1
type: Question

http://stackoverflow.com/comment/31125558
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20767374
has text: " each has assigned to its variable ID the value 1". I don't think you really have two objects in your static list. Do you call "new" twice?
score: 0

http://stackoverflow.com/comment/30979183
has text: The reason why `++` is special is that it is 3 operations: get, increment, set. That has to be done atomically. There is no such operation when setting an enum. Also, you can use `AtomicInteger` which can atomically increment _without_ a synchronized lock @Johnny.
score: 1
comment on: http://stackoverflow.com/a/20686023
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20754272
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31103842
type: Question
has answer: http://stackoverflow.com/a/20763716
has comment: http://stackoverflow.com/comment/31103490
tagged with: android-mediaplayer
has comment: http://stackoverflow.com/comment/31104471
has answer: http://stackoverflow.com/a/20762285
accepted answer: http://stackoverflow.com/a/20763716
has comment: http://stackoverflow.com/comment/31103931
has title: How do I release my media player after it is done playing?
has body: I am creating a sound board and after clicking about 30 different sounds it stops working; I believe android is running out of memory. Below is my code. How can I implement .release() so that when the sound is done playing it is released? I don't really care if two things play at the same time; the clips are t0o short for this to be possible. I would just like to get my code set. public class soundPageOne extends Activity { public void onCreate(Bundle savedState) { super.onCreate(savedState); setContentView(R.layout.soundsone); final MediaPlayer pg1 = MediaPlayer.create(this, R.raw.peter1); Button playSound1 = (Button) this.findViewById(R.id.peter1Button); playSound1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pg1.start(); } }); I have done a lot of searching around but due to my lack of java/android knowledge I have not been able to get anything to work. Thanks in advance, let me know if anyone needs anymore code.
score: 0
has comment: http://stackoverflow.com/comment/31103320
tagged with: release
has comment: http://stackoverflow.com/comment/31118724
has answer: http://stackoverflow.com/a/20754397
possible better answer: http://stackoverflow.com/a/20754377
has comment: http://stackoverflow.com/comment/31103916
has answer: http://stackoverflow.com/a/20754377
tagged with: android
has comment: http://stackoverflow.com/comment/31118560
has comment: http://stackoverflow.com/comment/31118268

http://stackoverflow.com/q/20687407
has comment: http://stackoverflow.com/comment/30981711
has body: Any clue why I'm not able to create transparent textures using LWJGL? I am using .gif images because .PNG images cause weird spotting issues with the textures. I have tried some other answers I have found but it did not solve the issue I am having. I'm not the greatest with OpenGL but I have spent many days trying to figure it out. texure.java public class Sprite { /** The texture that stores the image for this sprite */ private Texture texture; /** The width in pixels of this sprite */ private int width; /** The height in pixels of this sprite */ private int height; /** * Create a new sprite from a specified image. * * @param loader the texture loader to use * @param ref A reference to the image on which this sprite should be based */ public Sprite(TextureLoader loader, String ref) { try { texture = loader.getTexture(ref); width = texture.getImageWidth(); height = texture.getImageHeight(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(-1); } } /** * Get the width of this sprite in pixels * * @return The width of this sprite in pixels */ public int getWidth() { return texture.getImageWidth(); } /** * Get the height of this sprite in pixels * * @return The height of this sprite in pixels */ public int getHeight() { return texture.getImageHeight(); } /** * Draw the sprite at the specified location * * @param x The x location at which to draw this sprite * @param y The y location at which to draw this sprite */ public void draw(int x, int y) { // store the current model matrix glPushMatrix(); // bind to the appropriate texture for this sprite texture.bind(); // translate to the right location and prepare to draw glTranslatef(x, y, 0); // draw a quad textured to match the sprite glBegin(GL_QUADS); { glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(0, texture.getHeight()); glVertex2f(0, height); glTexCoord2f(texture.getWidth(), texture.getHeight()); glVertex2f(width, height); glTexCoord2f(texture.getWidth(), 0); glVertex2f(width, 0); } glEnd(); // rest…
tagged with: transparency
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/30981749
has answer: http://stackoverflow.com/a/20688039
has title: LWJGL transparency not working?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/30981899
tagged with: java
tagged with: lwjgl
type: Question
accepted answer: http://stackoverflow.com/a/20688039
has comment: http://stackoverflow.com/comment/30981636

http://stackoverflow.com/comment/31231540
has text: What are you trying to do in the above code?? And obvious, your list is empty.... how can you get something from this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20826190

http://stackoverflow.com/comment/31273536
has text: then how to logout the user then? 2. I have to show some success / error page after logout or logout fail. no?
type: Comment
comment on: http://stackoverflow.com/a/20848370
type: AnswerComment
score: 0

http://stackoverflow.com/q/20719723
has body: I'm having a problem which is saying <uses-permission> tag appears after tag and the error is showing in this line: <uses-permission android:name="android.permission.INTERNET" /> This is my AndroidMainfest.xml, I hope you can help me and thanks in advance :D <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
upvote count: 18
has answer: http://stackoverflow.com/a/20719756
favorite count: 0
has answer: http://stackoverflow.com/a/57900056
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31039346
tagged with: android
has answer: http://stackoverflow.com/a/20721643
has answer: http://stackoverflow.com/a/20719772
answer count: 4
tagged with: java
score: 17
has title: <uses-permission> tag appears after <application> tag
downvote count: 1
type: Question

http://stackoverflow.com/comment/31117833
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20763269
has text: A `NullPointerException` means that the program has tried to access an object and has found nothing.

http://stackoverflow.com/q/20795169
has comment: http://stackoverflow.com/comment/31175208
tagged with: file-io
answer count: 1
favorite count: 0
has body: I am doing the experiment for my own curiosity about transferring any file over the TCP connection between server and client My project is "Server receives a file" and "Client sends that file" But seems like something going wrong, The client-end can send the whole file and Server-end also can receive the whole file BUT after receiving at the server-end the file cannot be open it's like something went wrong while reading and sending its chunks Could you check if I'm doing something wrong Here's my code for Server side import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class TFServer2 { private static ServerSocket servSock; private static int port; public static void main(String[] args) throws NumberFormatException, IOException{ if(args.length &lt; 1){ port = 1500; }else{ port = Integer.parseInt(args[0]); } servSock = new ServerSocket(port); int i = 1; while(true){ System.out.println("Listening connection..."); Socket client = servSock.accept(); System.out.println("Client " + i + "requires connection!"); ClientHandler ch = new ClientHandler(client); ch.setNumber(i++); ch.start(); } } } and here's ClientHandler import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.net.Socket; public class ClientHandler extends Thread{ private int i; private Socket client; private ObjectInputStream sInt; private String fileName; private int file_size; private File file; private FileOutputStream outStr; private BufferedOutputStream bos; public ClientHandler(Socket client) throws IOException{ this.client = client; this.sInt = new ObjectInputStream(this.client.getInputStream()); } public void setNumber(int i){ this.i = i; } public void run(){ try { System.out.println("Client " + i + ": " + client.getInetAddress() + " connected on port " + client.getPort()); //get filename fileName = (String) sInt.readObject(); String[] str = fileName.split("."…
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/31174653
has comment: http://stackoverflow.com/comment/31175008
tagged with: tcp
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/20795489
has title: File transferring over TCP java
upvote count: 0
score: -2

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/20798936
tags question: http://stackoverflow.com/q/20748997
tags question: http://stackoverflow.com/q/20813710
tags question: http://stackoverflow.com/q/20817818
tags question: http://stackoverflow.com/q/20721262
tags question: http://stackoverflow.com/q/20686951
tags question: http://stackoverflow.com/q/20733938
tags question: http://stackoverflow.com/q/20753419
tags question: http://stackoverflow.com/q/20787983
tags question: http://stackoverflow.com/q/20775501

http://stackoverflow.com/comment/30972898
has text: OP said this is an introductory class so he/she's just trying to learn basics
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20683229
type: AnswerComment

http://stackoverflow.com/q/20760389
tagged with: custom-component
has answer: http://stackoverflow.com/a/20772974
accepted answer: http://stackoverflow.com/a/20782388
possible better answer: http://stackoverflow.com/a/20772974
downvote count: 0
linked to: http://stackoverflow.com/q/17131589
favorite count: 0
has body: I have a question about implementing a Swing control which uses a custom class as one of its properties. My goal is to use this control within the netbeans IDE and configure it in design-time like any other component. I already implemented a custom property editor for my ConnectionInfo object which works fine. However - when I configure my IntLEDs ConnectionInfo property in Netbeans and save it, I can see, in the generated code by Netbeans, that it had troubles to init my ConnectionInfo class. This is actually what the Netbeans IDE generated: intLED1.setConnection(???); So I guess that Netbeans doesn't know how to instantiate my ConnectionInfo class. But how to tell Netbeans how to do it? :) This code is basicly a stripped version of my component public class IntLED extends JPanel { private ConnectionInfo connection = new ConnectionInfo("", 11159, "", "", Variable.VARIABLE_TYPE.INT); public IntLED() { initComponents(); PropertyEditorManager.registerEditor(ConnectionInfo.class, PviCpuPropertyEditor.class); } public ConnectionInfo getConnection() { return connection; } public void setConnection(ConnectionInfo connection) { this.connection = connection; } } Here the ConnectionInfo code. Just some members and Getters/Setters. public class ConnectionInfo { private String pviHost = ""; private int pviPort = 11159; private String pviTask = ""; private String pviVarname = ""; private Variable.VARIABLE_TYPE pviType; public ConnectionInfo() { } public ConnectionInfo(String pviHost, int pviPort, String pviTask, String pviVarname, Variable.VARIABLE_TYPE type) { this.pviHost = pviHost; this.pviPort = pviPort; this.pviTask = pviTask; this.pviVarname = pviVarname; this.pviType = type; } public String getPviHost() { return pviHost; } public void setPviHost(String pviHost) { this.pviHost = pviHost; } public int getPviPort() { return pviPort; } public void setPviPort(int pviPort) { this.pviPort = pviPort; } public String getPviTask() { return pviTask; } public void setPviTask(String …
tagged with: swing
tagged with: properties
type: AnsweredQuestion
tagged with: netbeans
score: 1
has answer: http://stackoverflow.com/a/20782388
tagged with: java
upvote count: 1
type: Question
answer count: 2
has title: Netbeans Custom Component with Custom-Class Property

http://stackoverflow.com/a/20784625
type: Answer
has comment: http://stackoverflow.com/comment/31155495
answers question: http://stackoverflow.com/q/20784560
has body: For my knowledge you can just do the following. &lt;div href="your href here" onclick="and your function"&gt; Or am i not correctly understanding your question?
score: 0
has comment: http://stackoverflow.com/comment/31155404
has comment: http://stackoverflow.com/comment/31170723

http://stackoverflow.com/comment/31013156
has text: Classes and interfaces should be written in [Pascal Case](http://c2.com/cgi/wiki?PascalCase), otherwise known as UpperCamelCase. Methods should be in camelCase, starting with a lower-case letter. That is the canonical Java naming convention, and that's what your getters follow as well.
comment on: http://stackoverflow.com/a/20697268
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31011575
has text: Are they all properly annotated with @Entity?
type: QuestionComment
comment on: http://stackoverflow.com/q/20704741
score: 0
type: Comment

http://stackoverflow.com/a/20778321
type: Answer
has comment: http://stackoverflow.com/comment/31145227
score: 2
has comment: http://stackoverflow.com/comment/31145410
has body: public class CurrentClass extends Activity { . . . . . @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int position, long id) { // put a switch statement if you want start different activities for each corresponding list item //Start other activities Intent toActivity = new Intent(CurrentClass.this, ToNewActivity.class) startActivity(toActivity); } // If you would like to pass some data along to the new activity..... 'SomePojoClass' must implement Serializable //Seek and store Data Object SomePojoClass somePojoClass = (SomePojoClass) listView .getItemAtPosition(position); // you can also pass some object data or just a string data by using 'putExtra', just like a key-value pair Intent toActivity = new Intent(CurrentClass.this, ToNewActivity.class).putExtra("passingObjectData", somePojoClass); startActivity(toActivity); } . . . . . }
upvote count: 2
has comment: http://stackoverflow.com/comment/31153438
answers question: http://stackoverflow.com/q/20778181
has comment: http://stackoverflow.com/comment/31145385
downvote count: 0
has comment: http://stackoverflow.com/comment/31145510
has comment: http://stackoverflow.com/comment/31145412

http://stackoverflow.com/comment/31006865
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20690321
has text: dispose after doing alBufferData() or before using it again?

http://stackoverflow.com/q/20770151
has comment: http://stackoverflow.com/comment/31136141
has comment: http://stackoverflow.com/comment/31131853
has comment: http://stackoverflow.com/comment/31131787
accepted answer: http://stackoverflow.com/a/20836069
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31131840
tagged with: java
has body: the question i am going to ask is very old and i think it asked on SO 5-10 times. but mine has a different situation. Read my Problem before making it duplicate by so many wise (over) SO users. I am importing CSV sheet containing 10K records in my application. My logic works in following manner, (1) Validate &amp; Import Sheet (2) Save to the database if record does not exist Step 2 is done for each and every record of the sheet. in the step -2 i have to generate UUID to identify a particular record later , in my first solution // this might be unique in some cases String id = UUID.randomUUID().toString(); but i checked that it does generate unique id in each case , for example if i import 10 sheet one by one with different records in it, all 10 times i am getting duplicate key error from database for at least 4000 times in each import and save operation, that means that out of 10,000 key generation it generates only 6000 unique ids. so then i generate an alphanumeric code which length is 6 , some thing like eSv3h7 and append it to previously generated id and hence get the following id d545f2b2-63ab-4703-89b0-f2f8eca02154-eSv3h7 after testing still there is a problem of id duplication. I also tried several combination mentioned here and on other sites but still there is a same problem of id duplication, Now i am wondering that this occurs only for 10k records saving in loop , actually i need to import sheet which is having 8 million records in it so how can i solve my problem of generating a Unique id in my particular case ? Update 1 - based on all the comments Try this thing at you end. loop through 1 to 10,000 generate uuid in the loop store it somewhere in simple text file then make a simple program to find the duplicates from them , if you do not find any one duplicate in first attempt , repeat all above steps again and again and i am sure you will find duplicates. in the past i am also strong believer of the same thing that UUID will never generates duplicates,…
has comment: http://stackoverflow.com/comment/31132809
linked to: http://stackoverflow.com/q/325443
type: Question
has comment: http://stackoverflow.com/comment/31131805
has comment: http://stackoverflow.com/comment/31132098
has comment: http://stackoverflow.com/comment/31133512
has comment: http://stackoverflow.com/comment/31132321
has comment: http://stackoverflow.com/comment/31130668
answer count: 1
has title: Generate Unique Identifier in Very Big Loop - Java
has answer: http://stackoverflow.com/a/20836069
score: 0
has comment: http://stackoverflow.com/comment/31130608
has comment: http://stackoverflow.com/comment/31130604
has comment: http://stackoverflow.com/comment/31137195
has comment: http://stackoverflow.com/comment/31141734
has comment: http://stackoverflow.com/comment/31130656
has comment: http://stackoverflow.com/comment/31249950
has comment: http://stackoverflow.com/comment/31136061
has comment: http://stackoverflow.com/comment/31131800
has comment: http://stackoverflow.com/comment/31131952
has comment: http://stackoverflow.com/comment/31130640
has comment: http://stackoverflow.com/comment/31131999
has comment: http://stackoverflow.com/comment/31131819

http://stackoverflow.com/a/20801022
has body: You always overwrite the student info with the call to add student. If you just have one ID and one name, and always set those to a new value it replaces the previous information. You also should not assign the addStudent method to the Student object, as it doesn't relate to a single student but to a collection of students. You could create a class that holds a collection of Student-objects and place it there. You then create a new Student object within addStudent() and place it into the collection.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20800962

http://stackoverflow.com/comment/31244919
type: Comment
has text: Yes, it's tough to absorb, but your points make good sense. Let me go through the other answer also.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20833011

http://stackoverflow.com/comment/31113612
comment on: http://stackoverflow.com/q/20760889
has text: Is the version is set to default version?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20811539
accepted answer of: http://stackoverflow.com/q/20810786
answers question: http://stackoverflow.com/q/20810786
score: 0
type: AcceptedAnswer
type: Answer
has body: I finally got it after a few hours by playing around with input streams. try { final ZipFile zipFile = new ZipFile("input.zip"); File output = new File("out.zip"); byte[] read = new byte[1024]; ZipInputStream zis = new ZipInputStream(new FileInputStream(zip)); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(output)); ZipEntry ze; zos.setLevel(ZipOutputStream.STORED); zos.setMethod(ZipOutputStream.STORED); while((ze = zis.getNextEntry()) != null) { int l; zos.putNextEntry(ze); System.out.println("WRITING: " + ze.getName()); while((l = zis.read(read)) &gt; 0) { zos.write(read, 0, l); } zos.closeEntry(); } zis.close(); zos.close(); return "Done"; } catch (Exception e) { e.printStackTrace(); return "Error"; } Thanks so much for your answer Evgeniy Dorofeev, I literally just got my answer when I read yours! However, I prefer my method as it only takes up a maximum of 1 MB in memory (Am I right?). Also, I tried executing your code and only the first file in the input zip was transferred.

http://stackoverflow.com/comment/31260251
score: 0
type: Comment
has text: Please print the entire stack trace.
type: QuestionComment
comment on: http://stackoverflow.com/q/20841581

http://stackoverflow.com/q/20778284
has title: Access Google Notes using Android API (Java)
type: UnansweredQuestion
type: Question
has body: I want to make an Android Application in Eclipse that accesses the Notes Inbox in Gmail and can edit, create, or delete them. How would I do this? In iOS there is a preinstalled application that does this. Is there an API that I could use to do this in Android?
tagged with: java
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/24595264
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/38105112
tagged with: inbox
tagged with: gmail

http://stackoverflow.com/a/20777559
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31143596
has body: I'm assuming you want to do something similar to what is done in Java and create some kind of anonymous class that is used only in one place. This is not possible in C++ the same way that it is in Java. Something similar that you could do is have your 'interface' (although it will no longer be that) use lambdas, which are specified the moment where you instantiate the class. This is not exactly what you're looking for, and is not very idiomatic C++, but can be done.
upvote count: 1
answers question: http://stackoverflow.com/q/20777511
type: Answer

http://stackoverflow.com/q/20827118
has answer: http://stackoverflow.com/a/20828796
has body: If i want to create a cluster of 2 tomcats: Tomcat1 - ip 111.111.111.111 Tomcat2 - ip 222.222.222.222 Where exactly the in the server.xml i should say that my cluster contains both of these ips? If you will take alook at my server.xml (which i copy pasted from the tutorial) it looks like this: <?xml version='1.0' encoding='utf-8'?> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8109" protocol="AJP/1.3" redirectPort="8443" /> <Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: session-replication
type: Question
has title: Tomcat session replication - different machines configuration
tagged with: apache
tagged with: session
tagged with: tomcat

http://stackoverflow.com/comment/31204643
type: Comment
has text: that would not work because I would only be showing the array of questions in the 2 textviews, but I need to see a different text in the Answer Textview
score: 0
comment on: http://stackoverflow.com/a/20795013
type: AnswerComment

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/20826684
tags question: http://stackoverflow.com/q/20753084
type: Tag

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/20790859

http://stackoverflow.com/comment/31180950
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20798586
has text: @MarkoTopolnik Thanks for the insightful comments. Updated the answer. Heap resizing can be prevented when -Xmx is equal to -Xms, right?

http://stackoverflow.com/comment/31003262
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20700061
score: 0
has text: Unknown method `append()`

http://stackoverflow.com/a/20817723
answers question: http://stackoverflow.com/q/20805029
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/31216371
has comment: http://stackoverflow.com/comment/31216405
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20805029
has body: You are not pooling: you are using just single instance of the object. Generic object pool looks something like this: public class ObjectPool&lt;T&gt; { private List&lt;T&gt; objects; private Class&lt;T&gt; clazz; private int size; public ObjectPool(Class&lt;T&gt; clazz, int size) throws IllegalStateException { this.clazz = clazz; this.size = size; this.objects = new ArrayList&lt;T&gt;(); for (int i = 0;i &lt; size;i++) { objects.add(newInstance()); } } // You can override this method with anonymous class protected T newInstance() { try { return clazz.newInstance() } catch (Exception exception) { throw new IllegalStateException(exception); } } public synchronized T getInstance() { if (objects.isEmpty()) { return null; } return objects.remove(objects.size() - 1); } public synchronized void returnInstance(T instance) { if (objects.size() &lt; size) { objects.add(instance); } } } Unfortunately I do not have compiler to test the code, but it should give you a hint what to change.

http://stackoverflow.com/q/20756233
favorite count: 0
tagged with: android
answer count: 0
has body: For my android app, I am looking for a lib (or the source code) that would allow me to easily cut a mp3 file from the startTime to the endTime I provide. The declaration of the function I am looking for is something like this: public void mp3Cutter(URL urlSrcMp3File, URL urlResMp3File,Time start,Time Stop) For example, the following call to this function : mp3Cutter(ladygaga-telephone.mp3, ladyshort.mp3, 20, 30) would create file ladyshort.mp3 that contains the song from the 20th to the 30th seconds of the original file. I already tried to look in the source code of existing Mp3 cutter Android App but it’s not easy to find out exactly where and how the cut is done. Thanks in advance. Gilles
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/mp3
type: Question
has title: mp3 cutter lib in android/java?
downvote count: 0

http://stackoverflow.com/q/20680377
type: Question
has comment: http://stackoverflow.com/comment/30997776
has comment: http://stackoverflow.com/comment/30990176
tagged with: hashmap
has comment: http://stackoverflow.com/comment/30968831
downvote count: 0
has title: How to best convert Map<String,Foo> to Map<MyEnum,Foo> in a wrapper
answer count: 1
favorite count: 0
has body: Update, adding the question from the comments: what's the best way to get the Map into Map where Foo is an Enum. it just seems awfully complicated when, conceptually, not a complex idea. This code functions, it's part of a simple MUD client. The basic idea is that Monitor holds data (hit points, etc) which will be displayed to the user during game play, perhaps in a secondary JPanel; something along those lines. The possible values for this report are in the Attribs as an Enum. Before going too far down that path, when I look at the Monitor class and what it takes to create a single instance it seems more than a little verbose. If I move convertToEnumEntry out of Monitor then the class won't work. So, the class can't get smaller, I don't think. Is there a pattern I could use (or use better)? Everything in this class rests on the assumption that if convertToEnumEntry returns a null reference to a Map.Entry to then get the one, specific String which doesn't fit in Attribs: enemy = stringEntry.getKey(); Unlike the other keys, the enemy can be any String. The other keys are limited to the Enum values of Attribs (attributes). public class Monitor { private static Logger log = Logger.getLogger(Monitor.class.getName()); private Map&lt;Attribs, Ratio&gt; mapOfAttributes = new HashMap&lt;&gt;(); private String enemy = null; private Monitor() { } public Monitor(Map&lt;String, Ratio&gt; mapStringToRatio) { init(mapStringToRatio); } private void init(Map&lt;String, Ratio&gt; mapStringToRatio) { SimpleEntry&lt;Attribs, Ratio&gt; attribsEntry = null; for (Entry&lt;String, Ratio&gt; stringEntry : mapStringToRatio.entrySet()) { attribsEntry = null; attribsEntry = convertToEnumEntry(stringEntry); if (attribsEntry != null) { mapOfAttributes.put(attribsEntry.getKey(), attribsEntry.getValue()); } else { enemy = stringEntry.getKey(); //assumes key is enemy value mapOfAttributes.put(Attribs.ENEMY, stringEntry.getValue()); } } } private SimpleEntry&lt;Attribs, Ratio&gt; convertToEnumEntry…
upvote count: 2
tagged with: code-organization
type: UnansweredQuestion
tagged with: design-patterns
has answer: http://stackoverflow.com/a/20694528
has comment: http://stackoverflow.com/comment/30969623
score: 2
tagged with: enums
tagged with: java

http://stackoverflow.com/a/20828595
has comment: http://stackoverflow.com/comment/31236278
has comment: http://stackoverflow.com/comment/31236390
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31238262
has comment: http://stackoverflow.com/comment/31236975
has comment: http://stackoverflow.com/comment/31236409
has comment: http://stackoverflow.com/comment/31236354
type: Answer
has body: Bind your server socket to one of the IP addresses of your PC which is accessible from your android, and not to 127.0.0.1. Or alternatively bind it to all available interfaces (0.0.0.0). Then connect from your android to that IP. E.g. if your PC has IP address 1.2.3.4 then use this IP in both applications. Use netstat to see if the port is really open on your PC. Check to see if your android application has the permission to use the internet (specified in the manifest: "USES_INTERNET" or something like that). Also your python script discards the connection as soon as it is made.
accepted answer of: http://stackoverflow.com/q/20828412
has comment: http://stackoverflow.com/comment/31238528
downvote count: 0
answers question: http://stackoverflow.com/q/20828412
score: 1

http://stackoverflow.com/a/20684619
accepted answer of: http://stackoverflow.com/q/20684412
answers question: http://stackoverflow.com/q/20684412
has comment: http://stackoverflow.com/comment/30975375
has body: Should I be using java sockets? Depends on the type of server you connect to. You can use an existing library which will abstract the interaction with the server for you (recommended) or implement the required protocol yourself (not recommended). Can Java sockets only connect to java based servers? Sockets in Java are just an interface to the native socket API of the OS you are on. Every program that connects to a server over the network has to use them, regardless of whether it is a C/C++/Python/Java/... application. So, to answer your question; no, "Java sockets" can connect to any server. Read more about sockets in this Wikipedia article about sockets in general or this one about Berkeley sockets (the socket API implemented by most operating systems).
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/31141296
score: 0
type: Comment
has text: @SSpoke Actually no it won't. the `Thread.sleep(1000);` is to wait for an interrupt. In the game class, you need an instance of `FPSCounter` and you call `nameOfInstance.interrupt();` when each frame is finished. You should read through [this](http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html).
comment on: http://stackoverflow.com/a/20769932
type: AnswerComment

http://stackoverflow.com/comment/31035165
comment on: http://stackoverflow.com/q/20717151
score: 0
has text: You can add the link to the image and we can add it for you. Just upload it to some image host.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31114612
type: AnswerComment
type: Comment
has text: I honestly only answered cause I saw the buzzwords 'Java' and 'Concurrency' and thought easy reputation :) Insta-upvote. You're very welcome for any help I could give.
comment on: http://stackoverflow.com/a/20761514
score: 1

http://stackoverflow.com/a/20734130
has body: @HectorLector's response will optimize the reading a bit, but they're right; utltimately, reading a file is going to take as long as it takes. I suspect that your underlying question might be "how can I make my UI responsive while I'm reading this file?" - right now, since you're doing the reading inside an ActionListener, your UI will be completely blocked while the file is read, which makes for a terrible user experience. The answer to this is that long-running operations like filesystem access should be done on a background thread. Consider using a SwingWorker (see the tutorial) for a task like this; the worker thread can build the string and use the done() method to update the text area (or, if you want to show the file as it's being read, use a combination of the publish() and process() methods). Also, as a side note, be sure you're close()ing that BufferedReader you're using to read the file. Wrap the reading itself in a try block, and close inside finally in case there are any problems during reading. Something like this: BufferedReader in = new BufferedReader(new FileReader(f)); StringBuilder output = new StringBuilder(); try { while (in.hasNext()) { output.append(in.readLine()); output.append("\n"); } finally { in.close(); }
accepted answer of: http://stackoverflow.com/q/20733938
type: AcceptedAnswer
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20733938

javac
tags question: http://stackoverflow.com/q/20844631
tag name: javac
type: Tag
tags question: http://stackoverflow.com/q/20738264
tags question: http://stackoverflow.com/q/20721739
tags question: http://stackoverflow.com/q/20810586
tags question: http://stackoverflow.com/q/20828625
tags question: http://stackoverflow.com/q/20745575
tags question: http://stackoverflow.com/q/20680330
tags question: http://stackoverflow.com/q/20689204

http://stackoverflow.com/q/20733913
type: Question
possible better answer: http://stackoverflow.com/a/20734866
tagged with: java
has answer: http://stackoverflow.com/a/20750728
score: 0
tagged with: jakarta-mail
answer count: 2
has title: NoSuchProviderException for java mail api
has body: I created a simple maven project in eclipse in order to send some emails with one personal gmail account. In eclipse, the mail was successfully sent. Then I built the project into an executable jar with dependencies. However, when I run the jar from the command line, it throws the following exception : Exception in thread "main" java.lang.RuntimeException: javax.mail.NoSuchProviderException: smtp at EmailSender.send(EmailSender.java:75) at EmailSender.createNewAccount(EmailSender.java:33) at EmailSender.main(EmailSender.java:18) Caused by: javax.mail.NoSuchProviderException: smtp at javax.mail.Session.getService(Session.java:792) at javax.mail.Session.getTransport(Session.java:728) at javax.mail.Session.getTransport(Session.java:668) at javax.mail.Session.getTransport(Session.java:648) at javax.mail.Session.getTransport(Session.java:705) at javax.mail.Transport.send0(Transport.java:248) at javax.mail.Transport.send(Transport.java:124) at EmailSender.send(EmailSender.java:73) ... 2 more Does anyone know what's the difference between executing the program inside Eclipse, and the jar outside ? Thanks a lot!
accepted answer: http://stackoverflow.com/a/20750728
linked to: http://stackoverflow.com/q/20704125
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20734866
tagged with: maven

http://stackoverflow.com/q/20742115
score: 0
tagged with: java
tagged with: jboss
has body: I am struggling with one problem while we are trying to deploy some ears into the different server versions as per clients interest, so that now i am trying to deploy our multiple ears into the jboss7. The current problem is that datasources are bounded successfully as shown in below log 16:18:47,246 INFO [org.jboss.as.jacorb] (MSC service thread 1-2) JBAS016330: CORBA ORB Service started 16:18:47,267 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/OfflineDS] 16:18:47,268 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/jdbc/JISPDS] 16:18:47,269 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/IntegrationViewDS] 16:18:47,270 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/IntegrationDS] 16:18:47,271 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/jdbc/RATINGDS] 16:18:47,271 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/ChargingDS] 16:18:47,272 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/AccountDS] 16:18:47,273 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/RATINGDS] 16:18:47,274 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/OfflineInsertionDS] 16:18:47,356 INFO [org.jboss.as.jacorb] (MSC service thread 1-3) JBAS016328: CORBA Naming Service started but it is giving some error some thing related to ds binding as shown in below log, if any of you please help me, atleast i am not able to analyse why this error is coming. Thanx in advance. 16:19:10,022 ERROR [org.jboss.as]…
answer count: 1
type: UnansweredQuestion
has title: Error with jboss7 migration
has answer: http://stackoverflow.com/a/20755091
has comment: http://stackoverflow.com/comment/31080550
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31085069
type: Question

http://stackoverflow.com/q/20782856
tagged with: spring
has body: I define a properties holder: <util:properties id="myProps" location="file:my.properties" /> Then I can use #{} expression in : But when I define this bean: #{ myProps['db.timeout']} My Intellij-IDEA mark #{ myProps['db.timeout']} in red, and has tip: Can't resolve symbol: #{ myProps['db.timeout']} Does '' support #{} expressions? And how to fix this problem? Thank for subhashis's answer, but I forgot to mention I can't use org.springframework.beans.factory.config.PropertyPlaceholderConfigurer in the project due to some design limitations.
tagged with: java
has title: Does spring '<props>' support '#{ myprops['abc'] }' expression?
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20783521
type: UnansweredQuestion

http://stackoverflow.com/comment/31194568
has text: How is this an answer to OP's question (which was why the second output from `main` was 12 instead of 13).
type: Comment
comment on: http://stackoverflow.com/a/20806082
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31072024
has text: Hi, you should use any JSON library for return JSONArray from servlet. after that you can use this example for grid http://extjswithjava.blogspot.in/2013/12/hello-world-with-ext-js-mvc.html . In this example you can replace your sevlet URL.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20737044

http://stackoverflow.com/comment/31246166
has text: Still no answers/comments to my question. I think there is no way to solve my issue. So as a solution, when I need to use this tomcat6 Java local site, I should connect the machine to internet. Thanks to all. [To site administrator, you can close this session]
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20716551
score: 0

http://stackoverflow.com/q/20759447
favorite count: 0
has answer: http://stackoverflow.com/a/50969673
answer count: 1
upvote count: 3
type: UnansweredQuestion
score: 3
has title: How to get values from Ms word merge field using Docx4j Java
tagged with: java
type: Question
tagged with: docx4j
downvote count: 0
has body: I am trying to retrieve value from merge field using Docx4j in java. Currenty I'm retrieving all the contents of the word document using: WordprocessingMLPackage newWordMLPackage = WordprocessingMLPackage .load(new java.io.File("C:/Users/admin/Desktop/test" + i + ".docx")); MainDocumentPart documentPart = newWordMLPackage.getMainDocumentPart(); System.out.println(documentPart.getContent()); This returns a list of contents from the word document. What I'm currently getting is MERGEFIELD lastName \* MERGEFORMAT himura What I want is to get the value 'himura' from the merge-field 'lastName'. How can I achieve this? Thanks

http://stackoverflow.com/q/20822395
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has title: Exception Handling in Java/checked exceptions
upvote count: 0
has body: I am new to Java, and would appreciate any help in the following program, where I am trying to provide for a checked exception. Her's example: package book1; import java.io.*; public class CheckedException { public static void main(String[] args) { openFile("D:Java.txt"); } public static void openFile(String name) { try { FileInputStream f=new FileInputStream(name ); } catch(FileNotFoundException e) { System.out.println("File Not Found!!"); } } } The problem: The ideal path to a text file on Windows should be D:\file.txt. But in this program, this syntax gives an error, indicating an incorrect escape syntax(\n,\t etc). Why is the compiler(I'm using Eclipse Kepler on Windows 8.1) treating the path file as an escape seq? Even when I removed the \ from the notation(path D:java.txt), the program throws the file not found exception, and is subsequently caught which displays the file not found message. Please help, thank you.
score: -1
accepted answer: http://stackoverflow.com/a/20822410
answer count: 1
has answer: http://stackoverflow.com/a/20822410
favorite count: 0
tagged with: exception
linked to: http://stackoverflow.com/q/10264803
type: AnsweredQuestion

http://stackoverflow.com/a/20829107
answers question: http://stackoverflow.com/q/20829005
type: Answer
score: 0
has body: When you assign listOfDoors=new ArrayList&lt;Doors&gt;(numOfDoors); in run, you are not changing doors, because it is a different reference. Calling run(doors) creates a new reference to the object which doors refers to, which you are then setting and doing nothing with (this reference loses scope when run exits). The doors reference is never set to the object you're creating in run.

http://stackoverflow.com/a/20799387
answers question: http://stackoverflow.com/q/20798696
has comment: http://stackoverflow.com/comment/31185300
has comment: http://stackoverflow.com/comment/31182262
score: 0
type: Answer
has body: To enable CDI in JSF2.0 , you need to use beans.xml or faces-config.xml to define your managed beans. It is recommended to use a seperate file for configuring the beans since faces-config.xml will have application specific configuration. Please read this link to gain more understanding on how CDI works. Please note that CDI works based on the JAVA EE version. Update: You need to check whether you are naming your beans correctly everywhere in your xhtml page and make sure your class and configuration files are properly loaded
has comment: http://stackoverflow.com/comment/31185395
has comment: http://stackoverflow.com/comment/31183001

http://stackoverflow.com/comment/31236549
type: AnswerComment
has text: It's missing a space before the `and`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20828582

http://stackoverflow.com/q/20702368
tagged with: java
has answer: http://stackoverflow.com/a/20702555
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31007495
has body: I have a thread which repeats an action each second (shooting): long lasttime; Creature owner; public Attacker(Creature actor) { super("Attacker - "+actor.getClass().getSimpleName()); lasttime=System.currentTimeMillis(); owner=actor; owner.lockedon=true; } @Override public void run() { super.run(); while(!owner.dead &amp;&amp; owner.lockedon) { List pl=TVS.getGameScreen().projectiles; synchronized (pl) { //here long curtime=System.currentTimeMillis(); if(curtime-lasttime&gt;1000) { owner.attack(); lasttime=curtime; } } } } But when the main program thread slows down, this thread executes faster than main and shooting becomes too frequent relatively to the main thread. What should I do?
score: 0
has comment: http://stackoverflow.com/comment/31007499
has title: One thread timing is faster than other
has comment: http://stackoverflow.com/comment/31007414
has answer: http://stackoverflow.com/a/20702734
tagged with: time
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/a/20710294
answers question: http://stackoverflow.com/q/20710200
upvote count: 2
type: Answer
has body: Html to servlet Communication without form tag Regardless the communication is being happen through a Form, it is essentially a GET or POST request. Look up for that to understand that better. For this 'Name' I need to provide a link" that should display Details regarding Database Table content of 'name' Contained Table. If I undertood you well, you should create a link that, when clicked, should open a new page with the Details, right? You can generate a link similar to this: Show details Where X is the ID that would be retrieved on your sevlet (or JSP file): public class DetailsServlet implements HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { int id = Integer.parseInt(request.getParameter("id")); // Get details based on ID and show the page } } After that, you only have to get the Details using that ID and then show them in another page. A fancier alternative would involve AJAX, but you should really stick to the basics in your state.
score: 2
downvote count: 0

http://stackoverflow.com/comment/31109805
score: 0
type: Comment
type: QuestionComment
has text: @Adarsh - Yes that is correct Adarsh. However, I don't know how to extract the data from and to a certain index in a string. If you could suggest a solution, that would be great.
comment on: http://stackoverflow.com/q/20753419

http://stackoverflow.com/q/20766044
has answer: http://stackoverflow.com/a/40298183
has comment: http://stackoverflow.com/comment/31124669
has body: Trying to send an email using java mail api. And I keep getting MailConnectException. I have tried multiple ways to solve it without success. Exception is thrown by this statement transport.connect("smtp.gmail.com", "someone@gmail.com", "myPassword"); Can anyone tell me what I'm doing wrong? public static void main(String[] args) { String host = "smtp.gmail.com"; String from = "someone@gmail.com"; Properties props = System.getProperties(); props.put("mail.smtp.host", host); props.put("mail.smtp.user", from); props.put("mail.smtp.password", "myPassword"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.auth", "true"); try{ Session session = Session.getDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipients(Message.RecipientType.TO, "someone@hotmail.com"); message.setSubject("sending in a group"); message.setText("Welcome to JavaMail"); Transport transport = session.getTransport("smtp"); transport.connect("smtp.gmail.com", "someone@gmail.com", "myPassword");//CAUSES EXCEPTION transport.sendMessage(message, message.getAllRecipients()); }catch(MessagingException e){ e.printStackTrace(); } } Stack trace: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 465; timeout -1; nested exception is: java.net.ConnectException: Connection timed out: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1984) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:656) at javax.mail.Service.connect(Service.java:345) at javax.mail.Service.connect(Service.java:226) at com.karmacrafts.util.CustomEmail.main(CustomEmail.java:127) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at jav…
upvote count: 2
has answer: http://stackoverflow.com/a/20767000
has answer: http://stackoverflow.com/a/56115467
answer count: 7
tagged with: registration
has answer: http://stackoverflow.com/a/20773467
linked to: http://stackoverflow.com/q/46663
has answer: http://stackoverflow.com/a/77668980
tagged with: java
possible better answer: http://stackoverflow.com/a/20773467
has answer: http://stackoverflow.com/a/74117987
tagged with: jakarta-mail
accepted answer: http://stackoverflow.com/a/20767000
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/64953062
favorite count: 0
has title: MailConnectException while sending mail using java mail api
type: Question

http://stackoverflow.com/comment/31205930
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20812125
score: 0
has text: I have tried part_id as caps in @JoinColumn(name="PART_ID", itdidn't work well.As well all db names are match with pojo classes.

http://stackoverflow.com/a/20807633
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/20801833
answers question: http://stackoverflow.com/q/20801833
has body: I face the same problem but it select the element from start to last and give some Error like Cannot perform native interaction: Could not get node for element - cannot interact I got the solution by this way you can do this for your problem builder.clickAndHold(dropdownlists.get(0)).moveToElement(dropdownlists.get(6)).release().build().perform();
score: 2
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31197006
has comment: http://stackoverflow.com/comment/31205108

http://stackoverflow.com/q/20745439
tagged with: apache
downvote count: 0
answer count: 1
favorite count: 0
tagged with: linux
has body: I am having 3 agents. 1 is running on windows using memory channel and other 2 are on Linux using File Channel to get data from windows agent and put in to Hbase. Can any one suggests why the following error occurs and what are the step to stop it? 2013-12-23 14:50:15,290 (SinkRunner-PollingRunner-DefaultSinkProcessor) [DEBUG - org.apache.flume.sink.AvroSink.destroyConnection(AvroSink.java:199)] Avro sinksink1 closing avro client: NettyAvroRpcClient { host: 192.168.101.232, port: 3001 } 2013-12-23 14:50:15,290 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:160)] Unable to deliver event. Exception follows.org.apache.flume.EventDeliveryException: Failed to send events at org.apache.flume.sink.AvroSink.process(AvroSink.java:325) at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68) at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.flume.EventDeliveryException: NettyAvroRpcClient { host: 192.168.101.232, port: 3001 }: Failed to send batch at org.apache.flume.api.NettyAvroRpcClient.appendBatch(NettyAvroRpcClient.java:236) at org.apache.flume.sink.AvroSink.process(AvroSink.java:309) ... 3 more Caused by: org.apache.flume.EventDeliveryException: NettyAvroRpcClient { host: 192.168.101.232, port: 3001 }: Handshake timed out after 20000ms at org.apache.flume.api.NettyAvroRpcClient.appendBatch(NettyAvroRpcClient.java:280) at org.apache.flume.api.NettyAvroRpcClient.appendBatch(NettyAvroRpcClient.java:224) ... 4 more Caused by: java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.flume.api.NettyAvroRpcClient.appendBatch(NettyAvroRpcClient.java:278) Following is my windows config file a1.sources = source1 a1.channels = channel1 channel2 a1.sinks = sink1 sink2 a1.sources.source1.handler = com.flume.handler.DynamicJSONHandler a1.sources.source1.typ…
tagged with: hbase
type: UnansweredQuestion
tagged with: flume
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20750969
upvote count: 1
type: Question
has title: Flume agent unable to deliver event

http://stackoverflow.com/a/20828878
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20827379
downvote count: 0
has body: You can either put the object class and factory in the same package, and make the mutable methods package-scoped (this is the default visibility in Java, simply don't declare the methods to be public, private or protected), or make the class truly immutable and do all the work in the constructor. If you find that there are too many arguments in the constructor and it is difficult to understand, consider the Builder Pattern.

http://stackoverflow.com/comment/31034816
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20717047
type: Comment
has text: @user3081519 First initialized in class and overridden in constructor. No scope here.

http://stackoverflow.com/q/20765667
tagged with: tile
tagged with: libgdx
has body: I'm using Libgdx and I'm still kind of a noob with it (not programming, just Libgdx). I have one of those large png tile sheets, and I also have the individual tiles. What I'd like to do is make it easy on myself how I load these things. Right now, I'm loading them individually by passing a filename like this: final String[] fileNames = { "data/brick_dark1.png", "data/dngn_open_door.png", "data/cobble_blood1.png", "data/misc_box.png", "data/brick_dark6.png", "data/stone_stairs_down.png", "data/stone_stairs_up.png", "data/dngn_unseen.png", "data/dirt1.png", "data/dragon1.png", }; for (String s : fileNames) { texture = new Texture(Gdx.files.internal(s)); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); // TextureRegion region = // new TextureRegion(texture, 0, 0, spriteWidth, spriteHeight); sprite = new Sprite(texture); thingRepo.add(sprite); } This works just fine, but it also means that my fileNames array has to have every asset known to man explicitly specified. So, can I do it one of these ways, or am I doing it right already? Generically load all assets in my assets folder without knowing the file name. I suppose that's hard because I have to have a way to easily map them as I load (say, in a Map). Load the large tile sheet, index it and store it in a map. Same problem as number 1. Do it the right way, which someone will hopefully now explain to me. Bonus brownie points for other improvement ideas!
accepted answer: http://stackoverflow.com/a/20777374
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 1
has title: Loading tile sheet in Libgdx
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20777374
type: Question
tagged with: graphics

http://stackoverflow.com/comment/30997862
type: Comment
has text: Unless I am a retard, you are adding up the time each thread spends....and combining. Adding them together gives you a value close to 4 times longer than what it really took, because they run concurrently/parallel, not one after the other.
score: 0
comment on: http://stackoverflow.com/q/20696213
type: QuestionComment

http://stackoverflow.com/a/20728631
has comment: http://stackoverflow.com/comment/31055964
accepted answer of: http://stackoverflow.com/q/20728602
answers question: http://stackoverflow.com/q/20728602
score: 2
type: AcceptedAnswer
downvote count: 0
has body: According to the javadoc the VelocityConfigurer has a setter for the resourceLoaderPath. The setter is inherited from the VelocityEngineFactory. So it should be possible to set it: @Bean public VelocityConfigurer velocityConfig() { VelocityConfigurer velocityConfigurer = new VelocityConfigurer(); velocityConfigurer.setResourceLoaderPath("/WEB-INF/velocity/"); return velocityConfigurer; }
upvote count: 2
type: Answer

http://stackoverflow.com/a/20690186
has comment: http://stackoverflow.com/comment/30986347
has comment: http://stackoverflow.com/comment/61768206
score: 31
has body: This is because of a higher JDK during compile time and lower JDK during runtime. So you just need to update your JDK version, possible to JDK 7 You may also check Unsupported major.minor version 51.0
has comment: http://stackoverflow.com/comment/30986389
has comment: http://stackoverflow.com/comment/30986198
answers question: http://stackoverflow.com/q/20690143
type: Answer
upvote count: 32
has comment: http://stackoverflow.com/comment/30986681
downvote count: 1

http://stackoverflow.com/comment/31269660
comment on: http://stackoverflow.com/a/20846331
score: 0
type: AnswerComment
type: Comment
has text: thank you for taking the time! I usually do post SSCCE but I wasn't sure I needed it since this was pretty much writing it from the ground up with few defined variables. Also, I'm not sure how your code is different than mine other than the arrayList at the top. The problem I would run into is that 1) I don't know how to create a new label at runtime and 2) it seems like repeatedly adding the same thing to it is going to not work as I would need both the names of the label to modify it and a variable like slot1Card to modify it.

http://stackoverflow.com/comment/31245977
type: AnswerComment
type: Comment
has text: I am sorry I reply late.To make sure,I have tried your method,but in fact, it doesn't work.
comment on: http://stackoverflow.com/a/20815062
score: 0

http://stackoverflow.com/q/20725961
tagged with: tomcat
tagged with: servlets
has comment: http://stackoverflow.com/comment/31051643
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20726169
upvote count: 2
has comment: http://stackoverflow.com/comment/31051388
tagged with: spring
has title: Servlet Spec 3.0 not rendering JSP include
score: 2
type: AnsweredQuestion
has body: I have tried using both Tomcat 7 and Tomcat 8 RC 5 but my JSP include is not rendering. I am using Spring MVC (don't think this matters though). My JSP looks like this: <jsp:include page="includes/header.jsp" /> It Worked! <jsp:include page="includes/footer.jsp" /> When the page gets rendered it looks like this <jsp:include page="includes/header.jsp" /> It Worked! <jsp:include page="includes/footer.jsp" /> In my Pom file I am including: org.springframework spring-beans 3.2.4.RELEASE javax.servlet javax.servlet-api 3.0.1 My web.xml file looks like this: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="Blog" version="3.0"> Blog 404 /WEB-INF/jsp/error/404.html My App Initializer looks like this: public class AppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setConfigLocation("com.package.to.AppConfig"); servletContext.addListener(new ContextLoaderListener(context)); ServletRegistration.Dynamic servlet = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context)); servlet.setLoadOnStartup(1); servlet.addMapping("/*"); } What am I doing wrong? Why is my include not being rendered correctly? I have also tried the following with the same result: <%@ include file="includes/header.jsp" %> It Worked! <%@ include file="includes/footer.jsp" %> Controller Method: @Controller public class PageController { @Autowired PageService pageService; @RequestMapping(value = "/*", method = RequestMethod.GET) public String index(HttpServletRequest request){ String path = request.getRequestURI().substring(request.getContextPath().length()); Page page = pageServ…
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20726169
has comment: http://stackoverflow.com/comment/31051715
tagged with: jsp
has comment: http://stackoverflow.com/comment/31051655

http://stackoverflow.com/comment/31248772
comment on: http://stackoverflow.com/q/20835236
type: Comment
has text: Consider to store with the md5 hash: http://stackoverflow.com/questions/415953/generate-md5-hash-in-java to get some uniform names.
score: 0
type: QuestionComment

http://stackoverflow.com/q/20840709
has answer: http://stackoverflow.com/a/20840820
has comment: http://stackoverflow.com/comment/31258424
has comment: http://stackoverflow.com/comment/31258719
has comment: http://stackoverflow.com/comment/31258662
type: Question
has comment: http://stackoverflow.com/comment/31258421
tagged with: awt
has comment: http://stackoverflow.com/comment/31258720
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31258670
has comment: http://stackoverflow.com/comment/31258760
type: UnansweredQuestion
has title: Displaying GUI Issue
tagged with: swing
has body: I am trying to display a gui but cannot get the frame to show here is the code so far: The idea behind this is that the string path (which is the path to an image) is calculated in another class, it is then passed to this class where the image is to be displayed. I cannot get the frame to be displayed, my usual method would be: new displayWindow(); but this does not work. What would be the best method of displaying the gui? public class displayWindow { public displayWindow(String path) { JLabel label = new JLabel(); ImageIcon icon = new ImageIcon(speed); label.setIcon(icon); label.setText(path); JPanel panel = new JPanel(); panel.add(label); JFrame frame = new JFrame("Speed Limit"); frame.setSize(500, 500); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setVisible(true); System.out.println(path); frame.setLayout(new BorderLayout()); frame.setLayout(new FlowLayout()); frame.setSize(430, 430); frame.getContentPane().removeAll(); frame.getContentPane().add(panel); frame.repaint(); } public static void displayWindow() { new displayWindow(); } }
tagged with: java

xpages
tags question: http://stackoverflow.com/q/20805464
tag name: xpages
type: Tag

http://stackoverflow.com/comment/31036527
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20716169
has text: Actually I need to run queries as fast as possible. I first did used c3p0 but its performance for my application was really less that traditional singleton connection (around 90% slower!)
score: 0

http://stackoverflow.com/comment/31041925
score: 0
comment on: http://stackoverflow.com/q/20718845
type: Comment
has text: Also, what class do you want? MyResponse?
type: QuestionComment

http://stackoverflow.com/comment/31191432
score: 1
comment on: http://stackoverflow.com/q/20804698
has text: Didn't I see this exact post the other day? Why are you reposting it?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31001508
type: AnswerComment
type: Comment
has text: Yes, i know that is a possibility, but that is supposed to be fixed using "error-if-maximum-exceded=true". Anyway, bth sessions are active at the same time. But thank you anyway. Iw ill keep on working on this.
comment on: http://stackoverflow.com/a/20689805
score: 0

http://stackoverflow.com/comment/31186188
type: AnswerComment
comment on: http://stackoverflow.com/a/20801720
has text: @IanRoberts so s3==s4 return true not false but op has mentioned false.
type: Comment
score: 0

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/20679669
tags question: http://stackoverflow.com/q/20709611
type: Tag

http://stackoverflow.com/q/20766572
has body: i am doing work on images using java. i read a gray scale image and convert the pixel values to 0 and 1 i got the output image correctly for only some images. in others some image portions are lost here is the code i am using to make the image array back into image `BufferedImage I = ImageIO.read(new File("path")); SampleModel sampleModel; Raster pixelData; pixelData = I.getData(); int[][] pixels=new int[wid][hgt]; sampleModel=pixelData.getSampleModel(); BufferedImage image=new BufferedImage(wid,hgt,BufferedImage.TYPE_BYTE_BINARY); WritableRaster raster=Raster.createWritableRaster(sampleModel,new Point(0,0)); for(int i=0;i&lt;wid;i++) { for(int j=0;j&lt;hgt;j++) { raster.setSample(i,j,0,pixels[i][j]); } } image.setData(raster); File output=new File("path"); ImageIO.write(image,"png",output); System.out.println("..End..");` size of the image is same as original but the entire size contains only a portion of original image.can u help me
has comment: http://stackoverflow.com/comment/31124601
has comment: http://stackoverflow.com/comment/31129445
tagged with: image
has comment: http://stackoverflow.com/comment/31124297
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/20793307
favorite count: 0
has answer: http://stackoverflow.com/a/20846391
has comment: http://stackoverflow.com/comment/31205599
has comment: http://stackoverflow.com/comment/31134577
type: Question
has title: loss of image parts while setting pixel values to 0 and 1 from grayscale in java
linked to: http://stackoverflow.com/q/19209650
possible better answer: http://stackoverflow.com/a/20846391
upvote count: 3
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/31146941
accepted answer: http://stackoverflow.com/a/20793307
has comment: http://stackoverflow.com/comment/31146948
tagged with: bufferedimage

http://stackoverflow.com/a/73377355
type: Answer
has comment: http://stackoverflow.com/comment/129584381
answers question: http://stackoverflow.com/q/20740444
score: 0
has body: const options = { method: 'GET', headers: {Accept: 'application/json', 'X-Api-Key': '[APIkey]'} }; fetch('https://api.epaytools.com/Tools/luhn?number=[CardNumber]&amp;metaData=true', options) .then(response =&gt; response.json()) .then(response =&gt; console.log(response)) .catch(err =&gt; console.error(err));

http://stackoverflow.com/a/20824027
score: 0
has comment: http://stackoverflow.com/comment/31228270
type: Answer
accepted answer of: http://stackoverflow.com/q/20823645
has body: "My problem lies at the flowPane() method, the border.setTop(flowPane1()); line. The border object is not an internal object in the method" I'm not familiar with JavaFX, but I think in all Java this should be the case. The BorderPane object is not within the scope of the flowpane() method, so just make it a class member with a global scope public class Main extends Application { BorderPane border = new BorderPane(); &lt;-- Now has a global scope public void start(Stage stage) { // BorderPane border = new BorderPane(); &lt;-- remove this
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20823645

http://stackoverflow.com/comment/31208493
comment on: http://stackoverflow.com/a/20813600
has text: Sorry it was a typo. You need to implement `MouseMotionListener`, not `MouseListener` I fixed it. Also, two `mouseMoved`s was a typo. You need both `mouseMoved` and `mouseDragged`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/30998697
type: QuestionComment
comment on: http://stackoverflow.com/q/20696099
score: 0
type: Comment
has text: in your code you use match_parent and for that layout Relative layout is parent, so it is matching with parent. but it seems that your requirement is different. So please elaborate it and if possible can you please add a screen shot as per your requirment.

http://stackoverflow.com/q/20771575
answer count: 1
accepted answer: http://stackoverflow.com/a/20771742
tagged with: enums
tagged with: java
upvote count: 4
tagged with: resourcebundle
has body: I have been tinkering with this idea for a few days, and I was wondering if anyone else has thought of doing this. I would like to try and create a ResourceBundle that I can access the values with by using an enum. The benefits of this approach would be that my keys would be well defined, and hopefully, my IDE can pick up on the types and auto-complete the variable names for me. In other words, I'm after a sort of refined ListResourceBundle. Essentially, this is what I'm after... I have an enum that consists of various bundles set up like so: interface Bundle { String getBundleName(); EnumResourceBundle&lt;??????&gt; getEnumResourceBundle(); } enum Bundles implements Bundle { BUNDLE1("com.example.Bundle1", Keys.class); private final String bundleName; private final EnumResouceBundle&lt;??????&gt; bundle; /** * I understand here I need to do some cast with ResourceBundle.getBundle(bundleName); * in order to have it back-track through parents properly. I'm fiddling with this * right now using either what I specified earlier (saving bundleName and then * retrieving the ResourceBundle as needed), and saving a reference to the * ResourceBundle. */ private &lt;E extends Enum&lt;E&gt; &amp; Key&gt; Bundles(String bundleName, Class&lt;E&gt; clazz) { this.bundleName = bundleName; this.bundle = new EnumResourceBundle&lt;??????&gt;(clazz); } @Override public String getBundleName() { return bundleName; } @Override public EnumResourceBundle&lt;??????&gt; getEnumResourceBundle() { return bundle; } } interface Key { String getValue(); } enum Keys implements Key { KEY1("This is a key"), KEY2("This is another key"); private final String value; private Keys(String value) { this.value = value; } @Override public String getKey() { return value; } } class EnumResourceBundle&lt;E extends Enum&lt;E&gt; &amp; Key&gt; extends ResourceBundle { // Can also store Object in case we need it private final EnumMap&lt;E, Object&gt; lookup; public EnumResourceBundle(Class&lt;E&gt; clazz) { lookup = …
downvote count: 0
type: AnsweredQuestion
favorite count: 0
score: 4
type: Question
has answer: http://stackoverflow.com/a/20771742
has title: Using an enum in Java to represent keys in a ResourceBundle

http://stackoverflow.com/q/20835812
accepted answer: http://stackoverflow.com/a/20836113
type: Question
possible better answer: http://stackoverflow.com/a/20836009
has answer: http://stackoverflow.com/a/20836009
has answer: http://stackoverflow.com/a/20836113
score: 0
answer count: 2
has title: Make the background behind a AlertDialog black or opaque without replacing with Dialog
tagged with: android
tagged with: android-alertdialog
has body: Is it possible to make the background behind an AlertDialog opaque or black without using a Dialog / CustomDialog, I currently have this, true in my style which I assign to the constructor of the AlertDialog. but it is not dark enough and users can still see information which I do not want them to yet. To be honest my reason for not wanting to use a Dialog is that I have already got everything working with the AlertDialog and thought it would be a good idea to check if anyone knew a quick way to do this.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/20812648
has comment: http://stackoverflow.com/comment/31206571
has comment: http://stackoverflow.com/comment/31223971
has comment: http://stackoverflow.com/comment/31215344
has comment: http://stackoverflow.com/comment/31208850
has body: The getChildCount() method won't work for all list items as view recycling is done. Astral is right as he writes in the comments. 1) Create a custom adapter.(See http://windrealm.org/tutorials/android/listview-with-checkboxes-without-listactivity.php) 2)Inside the onListItemClick listener's onItemClick() method, call your adapter's notifyDataSetChanged() method(whenever the user clicks a list item). I modified the project that I mentioned and posted it on my Dropbox.(Just import it in Eclipse and run). Check it out at https://www.dropbox.com/s/gchccjzpkxk8n2z/Planets_modified.zip
has comment: http://stackoverflow.com/comment/31229476
accepted answer of: http://stackoverflow.com/q/20812421
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31224574
has comment: http://stackoverflow.com/comment/31206501
answers question: http://stackoverflow.com/q/20812421
has comment: http://stackoverflow.com/comment/31206586
has comment: http://stackoverflow.com/comment/31207867
score: 0
has comment: http://stackoverflow.com/comment/31206698
type: Answer
has comment: http://stackoverflow.com/comment/31208389
has comment: http://stackoverflow.com/comment/31224028

http://stackoverflow.com/q/20741688
has answer: http://stackoverflow.com/a/20842213
tagged with: sql
has title: MSSQL execute doesn't throw an error in java
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to EXECUTE a String against a mssql database via java, it works fine if the sql-code is correct or if I'm not using EXECUTE. But if the sql-code in the EXECUTE-string is wrong it does not show any errors. Although both examples are working fine in the mssql management studio.(both are showing the expected error) A simple example would be: WORKING(shows the error): declare @testvar varchar(255); BEGIN create table dbo.test1 (testid numeric(10,2)); ALTER TABLE dbo.test1 ALTER COLUMN testid numeric(15,299); END NOT WORKING (does not show any errors): declare @testvar varchar(255); BEGIN create table dbo.test1 (testid numeric(10,2)); SELECT @testvar = 'ALTER TABLE dbo.test1 ALTER COLUMN testid numeric(15,299);' EXECUTE (@testvar); END Any ideas how to fix that? Edit 1: (simple java code example, but enough to show this behaviour) import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class QuickSqlExecuteExample { public static Connection getConnection(String dbcon) throws SQLException { Connection conn = null; conn = DriverManager.getConnection(dbcon); conn.setAutoCommit(true); return conn; } public static void main(String[] args) throws SQLException { String dbcon="jdbc:sqlserver://[HOST]:[PORT];databaseName=[DBNAME];user=[USER];password=[PASS];"; Connection con = getConnection(dbcon); String qryString = "declare @testvar varchar(255);" +"\nBEGIN" +"\n create table dbo.test1 (testid numeric(10,2));" +"\n ALTER TABLE dbo.test1 ALTER COLUMN testid numeric(15,299)" //+"\n SELECT @testvar = 'ALTER TABLE dbo.test1 ALTER COLUMN testid numeric(15,299);';" //+"\n EXECUTE (@testvar);" +"\nEND"; Statement select = con.createStatement(); select.execute(qryString); } } Tried drivers: Microsoft SQL Server JDBC Driver 2.0.1803.100 / 4.0.2206.100
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/86362336
type: Question
has comment: http://stackoverflow.com/comment/31079067
answer count: 1
downvote count: 0
tagged with: sql-server

http://stackoverflow.com/q/20694581
favorite count: 0
has comment: http://stackoverflow.com/comment/30994551
has comment: http://stackoverflow.com/comment/30994437
has comment: http://stackoverflow.com/comment/30994270
tagged with: sockets
accepted answer: http://stackoverflow.com/a/20694747
type: AnsweredQuestion
has title: What is the speed difference between downloading with URL and Sockets?
score: 1
has comment: http://stackoverflow.com/comment/30994320
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/30994374
has answer: http://stackoverflow.com/a/20694747
has comment: http://stackoverflow.com/comment/30994280
tagged with: performance
tagged with: java
has body: I'm looking to create a Java application which will download podcasts to someone's computer automatically. I'm wondering whether I should be making a Socket connection to my server or simply using the URL class. Does anyone know what the speed difference is between downloading through a URL vs a socket connection. I know the URL object is built in part on top of the Socket object, but I'm not sure what the difference in run time is.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/30994271

http://stackoverflow.com/comment/31184762
type: Comment
type: QuestionComment
has text: You need a List of Students, now you are just giving your one student s a new id and renaming him.
comment on: http://stackoverflow.com/q/20800962
score: 0

http://stackoverflow.com/comment/31268184
type: AnswerComment
type: Comment
has text: Can i execute this Method when a Button is Clicked through Onclick Listener
comment on: http://stackoverflow.com/a/20845578
score: 0

http://stackoverflow.com/comment/31233320
has text: 1) For better help sooner, post an [SSCCE](http://sscce.org/). 2) Please don't forget to add a '?' to questions! Some people do a search in the page for '?' and if none exists in the 'question' go directly to the next (actual) question in line.
comment on: http://stackoverflow.com/q/20827061
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20846891
has body: I'm not sure what the author means when he writes that a singleton static factory method can guarantee that no two equal instances exist. Well actually I do kind of understand that but I'm confused by the following text when he demonstrates the equals method vs the literal comparison operator: "a.equals(b) if and only if a==b." I understand that the equals() method actually compares the contents of an object while the literal == compares to see if they are the same object in memory. This is confusing because he goes on to say that the client can use the == instead of the .equals(object) method. How so? Why would the client use the == comparator if they're guaranteed to only one object? Could someone write me a short coded example to explain this more concretely? The authors text is below: The ability of static factory methods to return the same object from repeated invocations allows classes to maintain strict control over what instances exist at any time. Classes that do this are said to be instance-controlled. There are several reasons to write instance-controlled classes. Instance control allows a class to guarantee that it is a singleton (Item 3) or noninstantiable (Item 4). Also, it allows an immutable class (Item 15) to make the guarantee that no two equal instances exist: a.equals(b) if and only if a==b. If a class makes this guarantee, then its clients can use the == operator instead of the equals(Object) method, which may result in improved performance. Enum types (Item 30) provide this guarantee.
tagged with: factory
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31270518
tagged with: java
has comment: http://stackoverflow.com/comment/31270435
accepted answer: http://stackoverflow.com/a/20847152
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/31270691
has comment: http://stackoverflow.com/comment/31270558
tagged with: static
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31270337
has answer: http://stackoverflow.com/a/20847034
has title: Confusion about Effective Java text
linked to: http://stackoverflow.com/q/767372
has answer: http://stackoverflow.com/a/20847152
has answer: http://stackoverflow.com/a/20847037
possible better answer: http://stackoverflow.com/a/20847034

http://stackoverflow.com/a/20714579
answers question: http://stackoverflow.com/q/20712128
has body: Any help would be greatly appreciated Make your life easier and use a good date-time library to do the work. Avoid the bundled java.util.Date/Calendar classes. Use either: Joda-Time The new java.time.* (JSR 310) classes bundled in Java 8. Here's example code in Joda-Time 2.3. // © 2013 Basil Bourque. This source code may be used freely forever by anyone taking full responsibility for doing so. // import org.joda.time.*; // import org.joda.time.format.*; String timeString_24Hour = "14:35:22"; // From String to LocalTime object DateTimeFormatter formatter_24HourTime = DateTimeFormat.forPattern("HH:mm:ss"); LocalTime localTime = formatter_24HourTime.parseLocalTime( timeString_24Hour ); // From LocalTime object to String DateTimeFormatter formatter_12HourTime = DateTimeFormat.forPattern("h:mm:ss aa"); String timeString_12Hour = formatter_12HourTime.print( localTime ); Dump to console… System.out.println( "timeString_24Hour: " + timeString_24Hour ); System.out.println( "localTime: " + localTime.toString() ); System.out.println( "timeString_12Hour: " + timeString_12Hour ); When run… timeString_24Hour: 14:35:22 localTime: 14:35:22.000 timeString_12Hour: 2:35:22 PM
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/20934816
has body: If you are sure that PravinSB is going to be first item then all above answer is true. But in case even a single item is added say /a/PravinSB/servlet/com.gjgj.rmf.controllers.Hello then its going to be wrong solution. String path = "/PravinSB/servlet/com.gjgj.rmf.controllers.Hello"; int indexOfString = path.indexOf("PravinSB"); int indexOfNextSlash = path.indexOf("/", indexOfString); String name=path.substring(indexOfString,indexOfNextSlash); this will work even if the string is String path = "/a/PravinSB/servlet/com.gjgj.rmf.controllers.Hello";
answers question: http://stackoverflow.com/q/20771245
score: 0
type: Answer

http://stackoverflow.com/comment/31356816
type: Comment
score: 0
type: AnswerComment
has text: @Jay JIC you find it useful, an example of Groovy DSL: [Log4j DSL](http://stackoverflow.com/questions/1157159/log4j-in-grails-how-to-log-into-file). Martin Fowler is an advocate of the DSL and [fluent interfaces](http://martinfowler.com/bliki/FluentInterface.html), he even had written a book on them.
comment on: http://stackoverflow.com/a/20763359

http://stackoverflow.com/a/20817143
score: 0
has body: You can register a broadcast receiver from the location manager to send you a broad cast if the location has actually changed. While I was working on something similar myself I found this blog post to be very helpful http://android-developers.blogspot.nl/2011/06/deep-dive-into-location.html
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20774681
answers question: http://stackoverflow.com/q/20774681

http://stackoverflow.com/comment/31161590
comment on: http://stackoverflow.com/q/20787976
has text: What do you mean by unreal?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20814209
tagged with: inheritance
upvote count: 3
has answer: http://stackoverflow.com/a/20814243
possible better answer: http://stackoverflow.com/a/20814231
favorite count: 0
type: AnsweredQuestion
has body: Hi. I am trying to call a method from a superclass via a subclass but keep getting an error. The method I am trying to call is setDestination() however the compiler keeps giving me the error "cannot find symbol - method setDestination(java.lang.string)" my lecturer says that this is a simple miss match of the parameters of the method call and the method, but I have both method parameters as of type String so I am a little confused. My code is: Superclass Vehicle: public class Vehicle { // A unique ID for this vehicle private String id; // The next destination of this Vehicle. private String destination; /** * Constructor for objects of class Vehicle */ public Vehicle(String id) { destination = null; } /** * Return the ID of the Vehicle. * @return The ID of the Vehicle. */ public String getID() { return id; } /** * Return the destination of the Vehicle. * @return The destination of the Vehicle. */ public String getDestination() { return destination; } /** * Set the intented destination of the Vehicle. * @param destination The intended destination. */ private void setDestination(String destination) { this.destination = destination; } } subclass Taxi: public class Taxi extends Vehicle { // The location of this taxi. private String location; // Whether it is free or not. private boolean free; /** * Constructor for objects of class Taxi. * @param base The name of the company's base. * @param id This taxi's unique id. */ public Taxi(String base, String id) { super(id); location = base; free = true; } /** * Book this taxi to the given destination. * The status of the taxi will no longer be free. * @param destination The taxi's destination. */ public void book(String destination) { setDestination(destination); free = false; } /** * Return the status of this taxi. * @return The status. */ public String getStatus() { return getID() + " at " + location + " headed for " + destination; } /** * Return the location of the taxi. * @return The location of the taxi. */ public String …
downvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/20814233
accepted answer: http://stackoverflow.com/a/20814233
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/20814231
has answer: http://stackoverflow.com/a/20814370
has answer: http://stackoverflow.com/a/75791029
has title: Calling a method from a superclass

http://stackoverflow.com/comment/30985840
type: QuestionComment
comment on: http://stackoverflow.com/q/20690047
type: Comment
has text: are you sure that you are actually executing EditTask?
score: 0

http://stackoverflow.com/comment/31074257
has text: how can i expand and collapse the actionbar not to create an actionbar ?
comment on: http://stackoverflow.com/a/20738299
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20684304
upvote count: 1
has body: After several tries to get a custom adapter working I am almost there. Now I have one problem left: get data in the adapter. This is what I do. I have a CustomListAdapter class for the adapter, a sqLiteHelper class to CRUD data and a mainActivity class. In the mainActivity i load the customlist like this: ListView list; CustomListAdapter adapter; public MainActivity CustomListView = null; public ArrayList&lt;Players&gt; CustomListViewValuesArr = new ArrayList&lt;Players&gt;(); //button handlers newmatch_players_home public void addSpelerNu(View button) { Log.d("WedstrijdID buiten de create", ""+wedstrijdId); Log.d("id return team thuis", ""+thuisTeamId); //thuisteam final EditText shirtNummer = (EditText) findViewById(R.id.shirtThuis); String nummerShirt = shirtNummer.getText().toString(); int shirtSpeler = Integer.parseInt(nummerShirt); final EditText spelerNaam = (EditText) findViewById(R.id.naamThuis); String naamSpeler = spelerNaam.getText().toString(); Integer wedstrijdSpelerId = (int) (long) wedstrijdId; SqLiteHelper db = new SqLiteHelper(this); db.addSpeler(new Players(shirtSpeler, naamSpeler, thuisTeamId, wedstrijdSpelerId)); Log.d("Toevoegen speler THUIS", "&gt;&gt; BEGIN"); Log.d("Toevoegen speler", "Shirt = "+nummerShirt+" Naam = "+naamSpeler +" Team ="+thuisTeamId+" Wedstrijd ="+wedstrijdSpelerId); Log.d("Toevoegen speler", "&gt;&gt; EIND"); shirtNummer.setText(null); spelerNaam.setText(null); CustomListView = this; /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/ ArrayList &lt;Players&gt; CustomListViewValuesArr = new ArrayList&lt;Players&gt;(); Resources res =getResources(); list= ( ListView )findViewById( R.id.listHome ); /**************** Create Custom Adapter *********/ adapter=new CustomListAdapter( CustomListView, CustomListViewValuesArr); list.setAdapter( adapter ); } This works except for the data. The data I want to use is in my sqlitehelper public ArrayList&lt;Players&gt; getPlayersForTeam(int teamNumber,int match…
downvote count: 1
has comment: http://stackoverflow.com/comment/30976758
tagged with: java
has answer: http://stackoverflow.com/a/20684835
type: Question
has comment: http://stackoverflow.com/comment/30975313
has answer: http://stackoverflow.com/a/20684628
score: 0
has title: How do i send data to my custom adapter
answer count: 3
has comment: http://stackoverflow.com/comment/30974898
tagged with: android
has answer: http://stackoverflow.com/a/20684634
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30975216

http://stackoverflow.com/comment/31024590
score: 0
has text: @peter.petrov needs to be `(.*?)` not `(.*)?`. My using (.*)? you're not actually even using a reluctant quantifier, you're using a greedy one, but just saying that "it's okay if it didn't match anything". It matches the last 0 under `\\d+` because after it hits the end it backtracks to try to satisfy the other groups.
type: Comment
comment on: http://stackoverflow.com/a/20711458
type: AnswerComment

http://stackoverflow.com/q/20826688
tagged with: derby
has comment: http://stackoverflow.com/comment/31242982
score: 0
answer count: 1
favorite count: 0
has body: I am using the Apache Derby in a java application. On the first launch, I want to create a database and set username and password. CONNECTION = DriverManager.getConnection("jdbc:derby://localhost:1527/DB;create=true", "database", "password"); I am not sure that the password is set when the database is created, how can I programmatically set the password after creating the database? After creating the database, I tried with a wrong password and i was still able to connect and execute queries.
has comment: http://stackoverflow.com/comment/31232563
tagged with: javadb
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20827187
tagged with: java
upvote count: 1
has title: Create a database with Apache Derby
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31232562
has comment: http://stackoverflow.com/comment/31232596
has comment: http://stackoverflow.com/comment/31232535

http://stackoverflow.com/comment/31076678
type: AnswerComment
comment on: http://stackoverflow.com/a/20740216
has text: Thanks @PeterMmm I was thinking that it would be the same than Scanner.
type: Comment
score: 0

http://stackoverflow.com/comment/31060794
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20731401
score: 3
has text: Java does not (and cannot) evaluate variable names dynamically. Use an array, map, or list.

http://stackoverflow.com/comment/31344054
comment on: http://stackoverflow.com/a/20848025
type: Comment
score: 0
type: AnswerComment
has text: Fixed the type casting issue for Arraylist using the below link http://stackoverflow.com/questions/14673694/deserialize-json-string-with-gson

http://stackoverflow.com/comment/31145841
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20778497
score: 0
has text: @SotiriosDelimanolis The json is generated by Gson in the first piece of code I presented. It is supposed to be one line and the looking in Notepad++ confirms. (However nopepad wraps the line, but there is no 'enter' within the line

http://stackoverflow.com/comment/31233938
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20827297
type: QuestionComment
has text: Alright, I changed the background color to black - is it more apparent now? The first one is centered while the third is left-justified.

http://stackoverflow.com/comment/31027299
score: 0
has text: That doesn't really answer the question. You don't explain why setScale() has no effect. See my answer.
type: Comment
comment on: http://stackoverflow.com/a/20712853
type: AnswerComment

http://stackoverflow.com/q/20775968
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/20768766
has comment: http://stackoverflow.com/comment/31140598
has comment: http://stackoverflow.com/comment/31140559
has body: I'm getting a Force Close when I launch the Gallery Fragment. It's not the code from the Gallery since Ranghunandan showed me what was wrong there. I think (but I'm not sure) it's within the ImageAdapter. I'll also post the LogCat Here's the Java Code import java.lang.ref.WeakReference; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.support.v4.util.LruCache; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; public class ImageAdapter extends BaseAdapter { private static final String TAG = "ImageAdapter"; private Context mContext; public static final Integer[] TATTOOS = { R.drawable.tattoo1, R.drawable.tattoo2, R.drawable.tattoo3, R.drawable.tattoo4, R.drawable.tattoo5, R.drawable.tattoo6, R.drawable.tattoo7, R.drawable.tattoo8, R.drawable.tattoo9, R.drawable.tattoo10, /* R.drawable.tattoo11, R.drawable.tattoo12, R.drawable.tattoo13, R.drawable.tattoo14, R.drawable.tattoo15, R.drawable.tattoo16, R.drawable.tattoo17, R.drawable.tattoo18, R.drawable.tattoo19, R.drawable.tattoo20, R.drawable.tattoo21, R.drawable.tattoo22, R.drawable.tattoo23, R.drawable.tattoo24, R.drawable.tattoo25, R.drawable.tattoo26, R.drawable.tattoo27, R.drawable.tattoo28, R.drawable.tattoo29, R.drawable.tattoo30, R.drawable.tattoo31, R.drawable.tattoo32, R.drawable.tattoo33, R.drawable.tattoo34, R.drawable.tattoo35, R.drawable.tattoo36, R.drawable.tattoo37, R.drawable.tattoo38, R.drawable.tattoo39, R.drawable.tattoo40, R.drawable.tattoo41, R.drawable.tattoo42, R.drawable.tattoo43, R.drawable.tattoo44, R.drawable.tattoo45, R.drawable.tattoo46, R.drawable.tattoo47, R.drawable.tattoo48, R.drawable.tattoo49, R.drawable.tattoo50, R.drawable.tattoo51, R.drawable.tattoo52, R.drawable.tattoo53, R.drawable.tattoo…
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20776039
accepted answer: http://stackoverflow.com/a/20776039
has title: Gallery Force Close using Fragment
answer count: 1
tagged with: adapter

http://stackoverflow.com/a/20764667
type: Answer
has body: In GridView getView Method Check the position is grater than 4 and also put other Cell value according to postion value that you want. public View getView(int position, View convertView, ViewGroup arg2) { if(position&gt;3) { productPriceTextView.setText("1-4") }else if(position==a) Display your value }else if(position==b) Display your value } Thanks
has comment: http://stackoverflow.com/comment/31120587
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31120627
has comment: http://stackoverflow.com/comment/31120743
accepted answer of: http://stackoverflow.com/q/20764646
has comment: http://stackoverflow.com/comment/31121523
has comment: http://stackoverflow.com/comment/31121099
answers question: http://stackoverflow.com/q/20764646
has comment: http://stackoverflow.com/comment/31120869
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31120940
has comment: http://stackoverflow.com/comment/31120841
has comment: http://stackoverflow.com/comment/31120760
has comment: http://stackoverflow.com/comment/31120889

http://stackoverflow.com/q/20784371
tagged with: swt
downvote count: 1
tagged with: java
has body: In my project i have a shell, in the shell there are 3 buttons, i want that a click on each button will open a shell ,but i want that if a shell is already open due to a click on a button then that shell will be closed and a new shell will be opened. (I dont want 2 shell from clicking buttons to be open at the same time) But i have no idea how to do this. In this class the opening of the shells should be. public class ClickLabel implements MouseListener { Shell shell; int p; public ClickLabel(int p) { shell = new Shell(); this.p = p; } @Override public void mouseDoubleClick(MouseEvent e) {} @Override public void mouseDown(MouseEvent e) {} @Override public void mouseUp(MouseEvent e) { shell.open(); } } Can anyone help me?
score: -1
has title: Opening one shell each time
has comment: http://stackoverflow.com/comment/31155181
type: Question
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31155064
tagged with: shell
has answer: http://stackoverflow.com/a/20784723
type: UnansweredQuestion

http://stackoverflow.com/a/20790430
type: Answer
has body: So that you can write code that deals with Cars without knowing what kind of car it is: public void PrintTopSpeed(Car car) { System.out.println("This car's top speed is " + car.topSpeed()); } If the Car class didn't define topSpeed(), this code wouldn't compile. You'd have to have a different version of this print function for each of your BMW, Volkswagen, Audi, etc. derived classes. This is perhaps the most basic concept in object-oriented programming, so you really need to master it. Base classes allow objects to share common behavior, and allow code to be written to use that behavior without any knowledge of what specific type of object it's dealing with.
score: 0
answers question: http://stackoverflow.com/q/20790360

http://stackoverflow.com/q/20735298
score: 0
answer count: 1
has title: JComponent Titled Border
has answer: http://stackoverflow.com/a/20735427
has body: I am making a simple swing application and I want to add some titled borders to my components. The border on both of my JScrollPanes work fine, but the JTextField and the JButtons don't. Allow me to share some screen shots. I just have simple code for this. i.e TitledBorder border = new TitledBorder("Border"); convert.setBorder(border); //convert is the JButton I don't see why it would not work for one thing, and work for the other. Can anyone help me out?
has comment: http://stackoverflow.com/comment/31068377
has comment: http://stackoverflow.com/comment/31068478
type: UnansweredQuestion
tagged with: swing
tagged with: components
tagged with: java
type: Question

http://stackoverflow.com/q/20807009
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20807046
has title: How was the Swing GUI toolkit created?
has body: I'm asking this question out of curiosity, and also it seems like the knowledge I will gain from it will be beneficial. How was the javax.swing.* import created? Wikipedia tells me They are written entirely in Java So I'd be very interested to actually see the code that was used to create the tools.
has comment: http://stackoverflow.com/comment/31195961
tagged with: swing
type: Question
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20807125
accepted answer: http://stackoverflow.com/a/20807125
has comment: http://stackoverflow.com/comment/31195773
has answer: http://stackoverflow.com/a/20807046
has comment: http://stackoverflow.com/comment/31195793

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/20706783
tags question: http://stackoverflow.com/q/20751964
tags question: http://stackoverflow.com/q/20839046
tags question: http://stackoverflow.com/q/20704767
tags question: http://stackoverflow.com/q/20817250
tags question: http://stackoverflow.com/q/20743990
tags question: http://stackoverflow.com/q/20684338
tags question: http://stackoverflow.com/q/20715517
tags question: http://stackoverflow.com/q/20806254
tags question: http://stackoverflow.com/q/20847332
tags question: http://stackoverflow.com/q/20847997
tags question: http://stackoverflow.com/q/20696917
tags question: http://stackoverflow.com/q/20828834
tags question: http://stackoverflow.com/q/20817308
tags question: http://stackoverflow.com/q/20747663
tags question: http://stackoverflow.com/q/20811948
tags question: http://stackoverflow.com/q/20813517
tags question: http://stackoverflow.com/q/20811214
tags question: http://stackoverflow.com/q/20811236
tags question: http://stackoverflow.com/q/20762894
tags question: http://stackoverflow.com/q/20718555
tags question: http://stackoverflow.com/q/20838285
tags question: http://stackoverflow.com/q/20819993
tags question: http://stackoverflow.com/q/20790634
tags question: http://stackoverflow.com/q/20762109
tags question: http://stackoverflow.com/q/20768086
tags question: http://stackoverflow.com/q/20806122
tags question: http://stackoverflow.com/q/20763515
tags question: http://stackoverflow.com/q/20793590
tags question: http://stackoverflow.com/q/20808901
tags question: http://stackoverflow.com/q/20692656
tags question: http://stackoverflow.com/q/20698440
tags question: http://stackoverflow.com/q/20696404
tags question: http://stackoverflow.com/q/20839242
tags question: http://stackoverflow.com/q/20781351
tags question: http://stackoverflow.com/q/20791356
tags question: http://stackoverflow.com/q/20685087
type: Tag
tags question: http://stackoverflow.com/q/20742213
tags question: http://stackoverflow.com/q/20742492
tags question: http://stackoverflow.com/q/20816451
tags question: http://stackoverflow.com/q/20741166
tags question: http://stackoverflow.com/q/20813880
tags question: http://stackoverflow.com/q/20757135
tags question: http://stackoverflow.com/q/20826342
tags question: http://stackoverflow.com/q/20801248
tags question: http://stackoverflow.com/q/20755523
tags question: http://stackoverflow.com/q/20746464
tags question: http://stackoverflow.com/q/20680356
tags question: http://stackoverflow.com/q/20837705
tags question: http://stackoverflow.com/q/20787880
tags question: http://stackoverflow.com/q/20778623
tags question: http://stackoverflow.com/q/20740349
tags question: http://stackoverflow.com/q/20785205
tags question: http://stackoverflow.com/q/20832804
tags question: http://stackoverflow.com/q/20819576
tags question: http://stackoverflow.com/q/20774321
tags question: http://stackoverflow.com/q/20795488
tag name: json
tags question: http://stackoverflow.com/q/20753095
tags question: http://stackoverflow.com/q/20764956
tags question: http://stackoverflow.com/q/20772023
tags question: http://stackoverflow.com/q/20778497
tags question: http://stackoverflow.com/q/20813063
tags question: http://stackoverflow.com/q/20803915
tags question: http://stackoverflow.com/q/20737738
tags question: http://stackoverflow.com/q/20793795
tags question: http://stackoverflow.com/q/20834393
tags question: http://stackoverflow.com/q/20836133
tags question: http://stackoverflow.com/q/20742558
tags question: http://stackoverflow.com/q/20796774
tags question: http://stackoverflow.com/q/20802032
tags question: http://stackoverflow.com/q/20700560
tags question: http://stackoverflow.com/q/20810101
tags question: http://stackoverflow.com/q/20772783
tags question: http://stackoverflow.com/q/20762394
tags question: http://stackoverflow.com/q/20683260
tags question: http://stackoverflow.com/q/20755124
tags question: http://stackoverflow.com/q/20778968
tags question: http://stackoverflow.com/q/20711097

http://stackoverflow.com/a/20698536
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20696227
has body: Seemed like password was about to expire and it was complaining about that via returning the result code of '3'. Changing the password made the issue go away. [exec] IMP-00058: ORACLE error 28002 encountered [exec] ORA-28002: the password will expire within 5 days
accepted answer of: http://stackoverflow.com/q/20696227
type: AcceptedAnswer

http://stackoverflow.com/q/20832793
tagged with: java
has answer: http://stackoverflow.com/a/23720193
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/20833617
has answer: http://stackoverflow.com/a/54563062
has answer: http://stackoverflow.com/a/40692594
has title: Java : Get heap dump without jmap or without hanging the application
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/28984434
tagged with: heap-memory
answer count: 5
type: UnansweredQuestion
score: 11
has body: In few circumstance, our application is using around 12 GB of memory. We tried to get the heap dump using jmap utility. Since the application is using some GB of memory it causes the application to stop responding and causes problem in production. In our case the heap usage suddenly increases from 2-3 GB to 12GB in 6 hours. In an attempt to find teh memory usage trend we tried to collect the heap dump every one hour after restarting the application. But as said since using the jmap causes the application to hang we need to restart it and we are not able to get the trend of memory usage. Is there a way to get the heap dump without hanging the application or is there a utility other than jmap to collect heap dump. Thoughts on this highly appreciated, since without getting the trend of memory usage it is highly difficult to fix the issue. Note: Our application runs in CentOS. Thanks, Arun
tagged with: jmap
upvote count: 11

http://stackoverflow.com/comment/30972125
type: Comment
has text: @Tudor since you only access the condition variable inside a synchronized block you don't have to make it volatile.
comment on: http://stackoverflow.com/a/20681102
type: AnswerComment
score: 0

http://stackoverflow.com/q/20833800
score: 0
has comment: http://stackoverflow.com/comment/31246401
has comment: http://stackoverflow.com/comment/31246794
answer count: 1
tagged with: web
has answer: http://stackoverflow.com/a/20834090
has comment: http://stackoverflow.com/comment/31247733
has comment: http://stackoverflow.com/comment/31246525
linked to: http://stackoverflow.com/q/5935892
has comment: http://stackoverflow.com/comment/31246625
type: UnansweredQuestion
has body: &lt;title&gt;Reprint&lt;/title&gt; &lt;style type="text/css"&gt; .btn_hover:hover{ color: darkblue ; } &lt;/style&gt; &lt;% if (session.getAttribute("user") == null) { response.sendRedirect("login.jsp?ms=Please Login"); } %&gt; &lt;/head&gt; &lt;body onload="addDate(); addDate1(); addDate3();" style="background-color: aliceblue;" &gt; &lt;form action="search" method="Post" name="search"&gt; &lt;table align="" border="1"&gt; &lt;tr align=""&gt; &lt;td &gt; &lt;h3 align="center" &gt;Reprint Request Form &lt;img src="sarasavi.png" /&gt; &lt;/h3&gt; &lt;% Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat(" yyyy.MM.dd"); out.print("&lt;h4 align=\"center\"&gt;" + ft.format(dNow) + "&lt;/h4&gt;"); %&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;h6 &gt; Enter ISBN or Scan the Barcode &lt;i style="color: #545454" class=" icon-barcode"&gt;&lt;/i&gt; &lt;/h6&gt; &lt;input type="text" placeholder="ISBN " name="isbn"/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input type="submit" value="SEARCH" class="btn_hover" style=" border-radius: 30px;" /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;!--&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;--&gt; &lt;l style="font-size: 18px; font-weight: bold;"&gt;logged in as &lt;/l&gt;&lt;% ResultSet rs = (ResultSet) session.getAttribute("user"); if (rs != null &amp;&amp; rs.first()) { ResultSet r4 = DB.search("Select * from User where uid='" + rs.getString("User_uid") + "'"); if (r4.next()) { %&gt; &lt;%=r4.getString("uName")%&gt; &lt;% } } %&gt; &lt;a href="Logout" style="font-weight: bold;"&gt;Log out&lt;/a&gt; &lt;/td&gt; &…
tagged with: java
has title: JSP user Authentication in a web base application
has comment: http://stackoverflow.com/comment/31246289
type: Question
tagged with: jsp
has comment: http://stackoverflow.com/comment/31246683

http://stackoverflow.com/comment/31263854
has text: Further to @OliCharlesworth, [getStackTrace()](http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html#getStackTrace())
comment on: http://stackoverflow.com/q/20843619
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20690582
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20690654
has comment: http://stackoverflow.com/comment/30986853
has body: I'm not sure where's my mistake here. public class TestFinalClass { public static void main(String[] args) throws IoException { java.io.File file = new java.io.File("Rockstar.txt"); if (file.exists()) { System.out.println("file already exists"); System.exit(1); } java.io.PrintWriter output = new java.io.PrintWriter(file); output.print("Bob"); output.println("100"); output.print("Bibelo"); output.println("33"); output.close(); } } It's simply to write some data into a file and I get that error message from eclipse when I do: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Unhandled exception type FileNotFoundException at TestFinalClass.main(TestFinalClass.java:9)
has comment: http://stackoverflow.com/comment/30987088
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/30986963
has answer: http://stackoverflow.com/a/20690890
accepted answer: http://stackoverflow.com/a/20690890
has title: IoException and write in file
tagged with: java
possible better answer: http://stackoverflow.com/a/20690654
type: Question
has answer: http://stackoverflow.com/a/20691557
has comment: http://stackoverflow.com/comment/30986972

http://stackoverflow.com/comment/31074639
score: 1
has text: He can't remove the final if he wants to use it in the click listener
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20739037

http://stackoverflow.com/q/20792940
accepted answer: http://stackoverflow.com/a/20793044
has title: Java inputstream casting/signing issue
has answer: http://stackoverflow.com/a/20793028
has answer: http://stackoverflow.com/a/50737344
answer count: 4
has body: This is my first post on here, so apologies for the problems it likely has. I've been working with a custom input stream recently, that uses a byte array to store data in (similar to a ByteArrayInputStream) but with more control over the pointer. The problem is for some reason my implementation of read() starts returning negative numbers after the values get past 127, which causes DataInputStream to assume it's the EOF. I've condensed things into a small program to demonstrate the problem: (broken up into pieces, because I can't seem to figure out how to fit it all into a single code block) The custom input stream class: class TestByteArrayInputStream extends InputStream { byte[] data; { // fill with some data ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(out); try { for (int i = 0; i &lt; 256; i++) { // fill array with shorts valued 0-255 dout.writeShort(i); } } catch (Throwable t) { t.printStackTrace(); } data = out.toByteArray(); } int pointer = 0; @Override public int read() throws IOException { if (pointer &gt;= data.length) { pointer = 0; } return data[pointer++]; // I've tried casting this to a char to remove signing, and using Integer.valueOf, but neither solve the problem. } } And here's the main method: public class Bugdemo { public static void main(String[] args) { TestByteArrayInputStream tin = new TestByteArrayInputStream(); DataInputStream din = new DataInputStream(tin); try { // read through normally for (int i = 0; i &lt; 256; i++) { System.out.println(din.readShort()); } } catch (Throwable t) { System.out.println(t.toString()); // avoid logging issues } tin.pointer = 0; // reset to beginning of data try { for (int i = 0; i &lt; 256; i++) { // readShort code with added debugging int ch1 = tin.read(); int ch2 = tin.read(); if ((ch1 | ch2) &lt; 0) { System.out.print("readshort \"eof\": "); System.out.printf("data in array is %02X ", tin.data[tin.pointer - 2]); System.out.printf("%02X ", tin.data[t…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20793044
score: 0
tagged with: datainputstream
tagged with: java
has answer: http://stackoverflow.com/a/20792998
tagged with: stream
tagged with: signing
type: Question
possible better answer: http://stackoverflow.com/a/20792998
tagged with: casting

http://stackoverflow.com/q/20686527
score: 1
has title: No preprocessor in Java - If I would conditionally like verbose output for debug, what's the best way?
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/20686656
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20686666
tagged with: compilation
has body: So, in languages like C and C++ I could define a preprocessor directive and do conditional compilation like so: #define DEBUG 1 #ifdef DEBUG cout &lt;&lt; "Some Stuff, blah blah blah" &lt;&lt; endl; #endif My goal is to do something similar, or roughly similar in Java that way I can do some debugging and just switch DEBUG on or off real quick for debug or release compilation. Is there anything anywhere close to this in java?? Maybe a public static final String DEBUG = "YES" I don't know....Is there anything anywhere close to this, what's my best strategy. Recommendations? EDIT: I am hoping to avoid any custom libraries, because I am OCD.....lol
has answer: http://stackoverflow.com/a/20686656
has answer: http://stackoverflow.com/a/20686878
accepted answer: http://stackoverflow.com/a/20686878
has answer: http://stackoverflow.com/a/20686673
upvote count: 1
has comment: http://stackoverflow.com/comment/30978984
tagged with: preprocessor
favorite count: 0
answer count: 4
downvote count: 0

http://stackoverflow.com/comment/31074246
has text: I think Java need direct cast to <T> and it didn't take a look to class of result.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20738599
score: 0

http://stackoverflow.com/a/20761874
score: 0
answers question: http://stackoverflow.com/q/20761697
type: Answer
has comment: http://stackoverflow.com/comment/31115814
has body: if you are looking to perform calculations on the string having multiple operators and operands like "2+3-5*4+2*sin(45)" then you need to study about parsing an infix to RPN(reverse polish notation) Shunting yard algorithm is one such way to accomplish complex calculations through efficient parsing. I cant find very much java related material for the same as I am a c# developer. But, i have implemented the same in one of my windows phone projects and it works. Few links which I could provide you at this point of time. Java Expression Parser &amp; Calculator Shunting Yard Algorithm http://en.wikipedia.org/wiki/Shunting-yard_algorithm http://andreinc.net/2010/10/05/converting-infix-to-rpn-shunting-yard-algorithm/ With this I am attaching some operator and their precedence rules in c# See the stack overflow link i have mentioned above and then study what I wrote below. OPERATORS.Add("+", new int[] { 0, LEFT_ASSOC }); OPERATORS.Add("-", new int[] { 0, LEFT_ASSOC }); OPERATORS.Add("*", new int[] { 5, LEFT_ASSOC }); OPERATORS.Add("/", new int[] { 5, LEFT_ASSOC }); OPERATORS.Add("%", new int[] { 5, LEFT_ASSOC }); OPERATORS.Add("^", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Sin", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Cosh", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Sinh", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Tanh", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Cos", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Tan", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Log", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("ln", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Sqrt", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Floor", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Ceil", new int[] { 10, RIGHT_ASSOC }); OPERATORS.Add("Square", new int[] { 10, RIGHT_ASSOC });
has comment: http://stackoverflow.com/comment/31115559
has comment: http://stackoverflow.com/comment/31115335

http://stackoverflow.com/q/20708484
accepted answer: http://stackoverflow.com/a/20708714
tagged with: nginx
has comment: http://stackoverflow.com/comment/31018959
downvote count: 0
has comment: http://stackoverflow.com/comment/31018588
answer count: 1
has body: I uploaded Jetty with sudo apt-get install jetty but I am not sure where it is installed. I searched for it with find and it found it here: /.m2/repository/org/eclipse/jetty. Is it where it is supposed to be? I am trying to find out how I can copy my .war file from the development machine to the server. I am looking at this tutorial where it says to change .bash_profile with JETTY_HOME=/user/java/jetty-7.6.8/ but I don't see the directory /user/java/ in my machine. What is the correct place to have Jetty server?
favorite count: 0
has title: Which directory Jetty is supposed to be in?
tagged with: jetty
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/20708714
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/20710581
score: 0
has body: So, I think I want to start by questioning your assumption of the bulk api. The bulk api may be more trouble than it's worth here. You could use the rest api, and some clever looping to pull your records. How many records are we talking about here? Additionally, you might consider a flat-file (csv) export and load, or even a jitterbit/dataloader situation and have your system load from the .csv produced by that. Despite Camel's association with the Apache foundation I had to go lookup what it was / did. I like to think of myself as fairly typical, so that may, unfortunately, mean you'll have a hard time finding camel expertise here.
type: Answer
answers question: http://stackoverflow.com/q/20710422
has comment: http://stackoverflow.com/comment/31023186
has comment: http://stackoverflow.com/comment/31024776
has comment: http://stackoverflow.com/comment/31022531
has comment: http://stackoverflow.com/comment/31024807

http://stackoverflow.com/comment/31031995
has text: I am very confused what your question is... what is the input / output
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/20715451

http://stackoverflow.com/q/20707461
has body: I am able to create a connection with 64 bit office but I want to connect with 32 bit office. Still after reading so many articles regarding this, I still am unable to create a DB connection with MS Access using Java I have: 64 Bit JDK 64 Bit Windows 32 Bit Ms Office Now I have created a DSN using odbcad32 in SysWow folder because I have 32 bit MS Access. Here is my Java code: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.accdb,*.mdb)};DBQ=C:/Users/Rahul/Documents/test.accdb;"; //Connection conn = DriverManager.getConnection(database, "", ""); Connection conn = DriverManager.getConnection("jdbc:odbc:hello"); Statement s = conn.createStatement(); ResultSet rs = s.executeQuery("Select * from user"); while((rs!=null) &amp;&amp; (rs.next())) { System.out.println(rs.getString("fullname")); } Still getting this error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application and if I change the Connection code above which is commented. I get this error :- java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified I have installed AccessDatabaseEngine 32 bit, but still I am unable to create a connection. If I try to create DSN using odbcad in System32 folder (for64 bit office), I get this error: the setup routines for the microsoft access dbase driver odbc driver could not be found What am I missing here as I have tried everything.
has title: Not able to create MS Access DB Connection with Java Code?
has comment: http://stackoverflow.com/comment/31017513
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/31016669
has comment: http://stackoverflow.com/comment/31017140
has comment: http://stackoverflow.com/comment/31023543
has comment: http://stackoverflow.com/comment/31017352
has comment: http://stackoverflow.com/comment/31016799
tagged with: java
type: Question
tagged with: jdbc-odbc

http://stackoverflow.com/comment/31205976
type: AnswerComment
score: 0
has text: Thank u. This is what i asked. I have been using MySQL 5.0, and i use MySQLQueryBrowser(in MySQL Tools) to view tables and edit its content. Since workbench's UI is different than MySQLQueryBrowser's UI, I didn't knew how to use it. **Thanks a lot for your help**.
type: Comment
comment on: http://stackoverflow.com/a/20782356

http://stackoverflow.com/comment/103923560
type: Comment
comment on: http://stackoverflow.com/a/20697237
score: 1
has text: The described solution doesn't work for me with plugin v2.4 nor v2.2.2, for example. Tested with Maven 3.3.9. Moreover, it seems like the possibility of setting name of the resultant assembly artifact was removed in 3.x altogether - see [How to set final jar name with maven-assembly-plugin version 3](https://stackoverflow.com/questions/45101044/how-to-set-final-jar-name-with-maven-assembly-plugin-version-3). Altogether, this maven plugin is very confusing.
type: AnswerComment

http://stackoverflow.com/q/20738888
score: -1
tagged with: image
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/31075284
has answer: http://stackoverflow.com/a/20739391
has body: I have two classes. Class GUI extends JFrame and is supposed to display on the screen a JPanel, which is class Surface that extends JPanel. Class Surface has a paintComponent method which should display an image, but for some reason it won't display it. Here's the code: import javax.swing.*; public class GUI extends JFrame { GUI(){ initUI(); } public void initUI(){ Surface s = new Surface(); add(s); pack(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[]args){ GUI gui = new GUI(); gui.setVisible(true); } } import java.awt.*; import javax.swing.*; public class Surface extends JPanel { Image image; ImageIcon ii; public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; ii = new ImageIcon("redsquare.png"); image = ii.getImage(); Dimension d = new Dimension(); d.width = image.getWidth(null); d.height = image.getHeight(null); this.setPreferredSize(d); g2d.drawImage(image,50,50,null); } }
has answer: http://stackoverflow.com/a/20739461
favorite count: 0
tagged with: imageicon
has comment: http://stackoverflow.com/comment/31074605
downvote count: 1
has comment: http://stackoverflow.com/comment/31074540
upvote count: 0
type: UnansweredQuestion
tagged with: embedded-resource
tagged with: swing
has answer: http://stackoverflow.com/a/20739033
has title: Trying to display image on screen in Java, doesn't work
tagged with: java

http://stackoverflow.com/a/37651109
upvote count: 63
downvote count: 0
has comment: http://stackoverflow.com/comment/116338723
has body: Run the following command to search for the process that is using the port lsof -i :&lt;portNumber&gt; | grep LISTEN in your case this will be --> lsof -i :8080 | grep LISTEN java 78960 xyxss 119u IPv6 0x6c20d372bc88c27d 0t0 TCP *:8092 (LISTEN) The 78960 is the process id, use the following command to kill the process kill -9 78960 Launch the application again.
type: Answer
answers question: http://stackoverflow.com/q/20735205
score: 63
has comment: http://stackoverflow.com/comment/64753775
has comment: http://stackoverflow.com/comment/87081310

http://stackoverflow.com/comment/31334227
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20844798
score: 0
has text: @JonSkeet, the Client is downloading, i just read his header request before.

http://stackoverflow.com/comment/31171790
comment on: http://stackoverflow.com/q/20793412
score: 1
type: Comment
type: QuestionComment
has text: If you throw a RuntimeException, you will need to *catch* a RuntimeException which means you could be catching *many* things that you really shouldn't be (and for very good reason). What are you *really* trying to solve as a problem?

http://stackoverflow.com/a/20748646
type: Answer
answers question: http://stackoverflow.com/q/20748536
has body: You can use Activity as a proxy between fragments this is how you can inform Activity about event in fragment: public class FragmentA extends Fragment { OnSomethingDoneInFragmentListener mListener; //this inteface must implement Activity that use the fragment public interface OnSomethingDoneInFragmentListener { public void onSomethingDone(Object someObject); } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnSomethingDoneInFragmentListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnSomethingDoneInFragmentListener"); } } }
score: 0

http://stackoverflow.com/comment/31182487
comment on: http://stackoverflow.com/q/20799629
has text: I would focus on making your code more *readable* (and following Java naming conventions) before you worry about performance - and please put more effort into formatting questions in future. (I'd also use a separate class for the key, rather than just using string concatenation.)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20688802
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/30983600
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20688819
has body: My application is running in tomcat, every time I stop tomcat it warns me there are lots of threads fail to shutdown. These threads are created by libraries my application use, I have no idea how to kill them. This issue leads tomcat process still live after I call bin/shutdown.sh shipped with tomcat. can anybody help? thanks
downvote count: 0
has title: How to kill non-daemon threads created by library when quitting?
tagged with: tomcat
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/20693014
accepted answer: http://stackoverflow.com/a/20688819
has answer: http://stackoverflow.com/a/20693014
favorite count: 0

http://stackoverflow.com/a/20692825
accepted answer of: http://stackoverflow.com/q/20692500
answers question: http://stackoverflow.com/q/20692500
has body: Your whole program structure is broken from your over-use of static fields to your mis-use of inheritance, to your combining the concepts of a Book and a Book collection all in one class. Suggestions: Don't mix your Book class with your Book collection. This looks to be the primary problem with your code. Start with just a Book class. It should contain no lists at all. You can have FictionBook and NonFictionBook extend Book if so desired. Or you could simply give Book a boolean field, fiction, and set it to true or false depending on the needs. Create a LoanBook class that holds List of Books. Don't use inheritance unless a true "is-a" relationship exists. Your code does not satisfy this mainly due to your first problem, your mixing your Book class together with your Book Library code, which forces your Fiction book and your non-Fiction book to inherit library code which is not only not needed, but really detrimental. Avoid use of static anythings, unless they are there for a specific static purpose. You will likely be best served by trashing your current code and re-starting over.
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/q/20680457
type: Question
has answer: http://stackoverflow.com/a/20680662
tagged with: servlets
accepted answer: http://stackoverflow.com/a/20680662
score: 0
answer count: 1
has title: Tracking payment is done within 10 minutes
type: AnsweredQuestion
has body: i want to do develop a appointment payment system. After booking appointment If payment is not made before 10 minutes means i have cancel that appointment. I am using ebs payment system. After appointment booking it will go ebs website. How can i track payment can be done with in 10 minutes. Shall i need to create thread for this, if required result not came means i have to cancel that appointment? How can i do this?
tagged with: java
tagged with: paypal

http://stackoverflow.com/comment/30977262
type: AnswerComment
type: Comment
has text: Made some changes. Got rid of that and called the button listener lower in the class. Still have issues with the insides of the GUI disappeared when i try to calculate. hmmm.
comment on: http://stackoverflow.com/a/20685397
score: 0

http://stackoverflow.com/a/20692967
answers question: http://stackoverflow.com/q/20692921
accepted answer of: http://stackoverflow.com/q/20692921
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30991301
score: 0
has body: Yes; AND is processed before OR, so you're essentially querying for all projects where year = 11 and orderDate LIKE ? or if any of the other conditions are met. You need to use parentheses in order to make clear which conditions apply to the AND and which should be ORed. I would assume that you want it to look something like this: SELECT * FROM project WHERE year = 11 AND (orderDate LIKE ? OR orderNo LIKE ? OR prodNo LIKE ? OR prodName LIKE ? OR inquiryDate LIKE ? OR confirmDate LIKE ? OR deliveryLT LIKE ? OR deliveryRiis LIKE ? OR signsPrice LIKE ? OR vrPrice LIKE ? OR deliveryPrice LIKE ? OR unexpectPrice LIKE ? OR riisBonus LIKE ? OR kennBonus LIKE ? OR profit LIKE ? OR profitPercent LIKE ? OR quantity LIKE ?)
type: Answer

http://stackoverflow.com/comment/31261441
comment on: http://stackoverflow.com/q/20842070
score: 0
type: QuestionComment
type: Comment
has text: @PavelHoral That was from before I started trying to use views, removed it now.

http://stackoverflow.com/q/20737980
score: 0
has answer: http://stackoverflow.com/a/20738118
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31073137
tagged with: list
tagged with: algorithm
tagged with: java
has body: I have a plain class named MenuModel in Java (it's for nested menu as the name suggests) like this: public class MenuModel { public String id; public String parentId = null; public String title; public MenuModel parent = null; public List&lt;MenuModel&gt; children = new ArrayList&lt;MenuModel&gt;(); } My code fetch data from web API and generate a flat list of MenuModel with only id, parentId, and title fields filled with data. However, I need each MenuModel to have references to its parent and (optionally) children for further uses. I have thought of a method which make a nested loop to pair the models each other and check if they are parent and child. But I think that costs too much (n^2 or n^3 complexity, the itemset is large) and can only fill the parent field. What is the best way to achieve this in Java? To summarize: Input: ArrayList&lt;MenuModel&gt; source Output: ArrayList&lt;MenuModel&gt; result containing all MenuModel from source which has parentId = null (that means, it's top level menu), with each MenuModel has children fields filled with reference to their respective children MenuModel. Additionally, each children have reference to their parents. Thanks in advance
has title: Generate Nested List (Tree) from Flat List
accepted answer: http://stackoverflow.com/a/20738118
answer count: 1
tagged with: data-structures
has comment: http://stackoverflow.com/comment/31073178

http://stackoverflow.com/a/20743195
has comment: http://stackoverflow.com/comment/31220306
score: 16
upvote count: 16
answers question: http://stackoverflow.com/q/20738059
has body: You can use android studio 0.4.0. Gradle version 1.9 isn't compatible with Studio 0.3.2. issue link
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31224857
comment on: http://stackoverflow.com/q/20822502
type: Comment
has text: earlier i run the same code it works. but now its thorows the above exception. is there anything i want to make change.
score: 0
type: QuestionComment

http://stackoverflow.com/q/20705462
tagged with: pythagorean
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20705488
has answer: http://stackoverflow.com/a/20705703
has comment: http://stackoverflow.com/comment/31013089
has title: Special Pythagorean Triplet
has comment: http://stackoverflow.com/comment/31014379
type: UnansweredQuestion
type: Question
tagged with: java
has body: What's wrong with my code? It prints 2,2 when the correct answer is clearly 6,8 public static void main(String[] args) { int a = 1; int b = 1; int answer = 0; int j = 4; while (j == 4) { for (a = 1; a &lt;= 10; a++) { for (b = 1; b &lt;= 10; b++) { answer = a * a + b * b; if (answer == 100) { j = 10; } } } } System.out.println(a + " " + b); }

http://stackoverflow.com/comment/31176984
type: AnswerComment
score: 0
type: Comment
has text: @user3117915 More likely `IV` is missing.
comment on: http://stackoverflow.com/a/20796213

http://stackoverflow.com/comment/31066352
score: 0
has text: Try adding `assert t != this.table;` as they must be different objects.
comment on: http://stackoverflow.com/q/20734220
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20793590
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/20793662
has answer: http://stackoverflow.com/a/20793926
answer count: 2
has answer: http://stackoverflow.com/a/20793662
tagged with: jackson
score: 0
has comment: http://stackoverflow.com/comment/31172610
has body: Given I have the following json: { "Company": { "name": "cookieltd", "type": "food", "franchise_location": [ { "location_type": "town", "address_1": "5street" }, { "location_type": "village", "address_1": "2road" } ] } } How can it be binded to the following object classes using Jackson?: 1) Company class public class Company { String name, type; List&lt;Location&gt; franchise_location = new ArrayList&lt;Location&gt;(); [getters and setters] } 2) Location class public class Location { String location_type, address_1; [getters and setters] } I have done: String content = [json above]; ObjectReader reader = mapper.reader(Company.class).withRootName("Company"); //read after the root name Company company = reader.readValue(content); but I am getting: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "franchise_location"
possible better answer: http://stackoverflow.com/a/20793926
tagged with: data-binding
has title: Binding json, that has a list, with an object using Jackson
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/31177762
score: 0
has text: Why not you use expression libraries?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20797012

http://stackoverflow.com/a/20835668
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/20835502
has body: Create a folder, unpack mysql-connector-java-5.0.8-bin.jar in it, add deduction.java and run jar cvf deduction.jar * inside this folder. Or copy mysql-connector-java-5.0.8-bin.jar as deduction.jar then add deduction.java to it jar uvf deduction.jar deduction.java
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20835502

http://stackoverflow.com/comment/30972134
type: Comment
comment on: http://stackoverflow.com/a/20682777
type: AnswerComment
score: 0
has text: safe could be with add/remove (delegate events from_to only one MouseListener can be added on runtime) MouseListener from JFrame to JPanel and vice versa, a few code lines more over

http://stackoverflow.com/comment/31314992
has text: @Radiodef As I said, I didn't want to make any assumptions. If there were any other methods that accessed those variables, it'd be safer to have them marked as volatile.
comment on: http://stackoverflow.com/a/20848958
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31070174
type: Comment
type: QuestionComment
has text: @PM77-1 How do I make it so it matches instead of returning a "No matches." method?
comment on: http://stackoverflow.com/q/20736288
score: 0

http://stackoverflow.com/comment/31263220
score: 1
comment on: http://stackoverflow.com/q/20843263
type: Comment
has text: I would highly recommend against using pre-release / beta software in a production environment ... but that's just me.
type: QuestionComment

http://stackoverflow.com/q/20785205
tagged with: rest
tagged with: android
favorite count: 0
type: UnansweredQuestion
upvote count: 4
has answer: http://stackoverflow.com/a/20785431
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20785787
type: Question
has body: I'm a little bit to stupid - sry for that. I wrote an API which gives some JSON back. My goal is to use this API from an Android App. I've tried it with AsyncTask but failed hard. I imagine to use it like this: Calling the class, telling the URL and the type of the result. (which json, like the account information or some data) When the loading is finished, calling the right class of the result, with the result as argument. Here's the link to the API: Link What do I have to do? EDIT: Here's my code now. He doesn't like the GetRequest variable type, also getHttpClientInstance is not possible. He also cannot resolve the method execute on MyAsyncTask. @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.action_settings) startActivity(new Intent(this, editPreference.class)); if (item.getItemId() == R.id.action_kurse) startActivity(new Intent(this, Login.class)); if (item.getItemId() == R.id.action_refresh) { String url = "http://vplan.florian-schmidt.org/api/get_klassen.php"; new MyAsyncTask().execute(url); }; return super.onOptionsItemSelected(item); } class MyAsyncTask extends AsyncTask &lt;GetRequest,String,JSONObject&gt; { @Override protected JSONObject doInBackground(GetRequest... params) { JSONObject data = null; GetRequest eventRequest = params[0]; if (eventRequest instanceof GetRequest) { DefaultHttpClient httpClient = HttpClient.getHttpClientInstance(); try { HttpGet httpGet = HttpClient.getHttpGetInstance(); httpGet.setURI(eventRequest.getUriString()); httpGet.setHeader("Content-type", "application/json"); HttpResponse httpResponse = httpClient.execute(httpGet); //Check is authentication to the server passed if (httpResponse.getStatusLine().getStatusCode() == 401) { // do some actions to clear userID, token etc ... // finish finish(); } HttpEntity responseEntity = httpResponse.getEntity(); if (responseEntity instanceof HttpEntity) data = new JSONObject(EntityUtils.toString(responseEntity)); responseEntity.consumeContent(…
answer count: 2
tagged with: api
has title: Android REST API connection
linked to: http://stackoverflow.com/q/20629227
score: 4

http://stackoverflow.com/comment/31242615
score: 1
has text: maybe http://stackoverflow.com/questions/11437402/setdragimage-not-working-java-7 ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20831411

http://stackoverflow.com/comment/31049509
comment on: http://stackoverflow.com/q/20724774
has text: Use asynchronous processing. Sleeping a worker thread is the worst thing you could do.
score: 2
type: Comment
type: QuestionComment

lwuit-command
tags question: http://stackoverflow.com/q/20771785
type: Tag
tag name: lwuit-command

http://stackoverflow.com/q/20816568
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31213781
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/31213946
tagged with: wubi
upvote count: 1
answer count: 1
favorite count: 0
has body: I have Ubuntu installed through Wubi. When I try to start Android Studio it throws me this exception: Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit at java.awt.Component.&lt;clinit&gt;(Component.java:595) at com.intellij.idea.Main.showMessage(Main.java:190) at com.intellij.idea.Main.showMessage(Main.java:177) at com.intellij.idea.Main.main(Main.java:80) I've read that it could be problem with libxtst6:i386 in 64-bit systems, but I've installed it and it's not work for me. Any ideas what's wrong?
type: UnansweredQuestion
has title: Android studio not start in Ubuntu 12.04 with NoClassDefFoundException
has comment: http://stackoverflow.com/comment/31214449
tagged with: android-studio
has answer: http://stackoverflow.com/a/23373662

http://stackoverflow.com/comment/31048662
score: 0
type: Comment
type: QuestionComment
has text: Are you sure that these are correct: `j*20, i*20` in your `g.drawImage(...)` method call? A pixel off one way or another will make a huge difference. Also as an aside, `getGroundImage(gt)` doesn't read in a file or resource does it? This only gets an image that you've saved in memory in your program, right?
comment on: http://stackoverflow.com/q/20724604

http://stackoverflow.com/comment/31128072
type: QuestionComment
comment on: http://stackoverflow.com/q/20763675
has text: I had worked only with the case of remote mailing servers not responding to the local mail triggering scripts but not the reverse way
score: 0
type: Comment

http://stackoverflow.com/comment/31135114
comment on: http://stackoverflow.com/q/20772811
has text: **@AndrewThompson**, forgive, it takes time.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/20821076
answers question: http://stackoverflow.com/q/20821057
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31222205
upvote count: 1
has comment: http://stackoverflow.com/comment/31222277
has body: You should write a Comparator to compare the Strings the way you want to. Then sort your ArrayList using the implemented comparator. See: http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html
has comment: http://stackoverflow.com/comment/31222230
type: Answer

http://stackoverflow.com/a/20808380
has body: it is obivious, your browser will wait until the other thread completes. The following steps involved Client Sent Request to Server Server allocates Thread (Servlet Container) from ThreadPool Servlet container creates Servlet instance / reuse existisng Servlet instance and invoke Servcie method in (Servlet Thread) With in Service method by calling startAsync() will start new thread and pass the request,response instances to the new Thread to process the request note** New Thread is not blocking the http connection , it is just a thread in the jvm which is not bliocking any IO at this moment Servlet Thread exists service method and returned to thread pool Note** here Response not yet sent to Client / Browser Once the Process started in step 4 completed that thread will request Servlet Container to allocate to new Servlet thread to send the respond back to Client. Only the at Step 6 the response will return back to Client. So there is no difference between the normal request and with "asyncSupported = true" from client point of view. Servlet 3.0 supports Threads per request by using "asyncSupported = true" instead of Thread per connection. Thread per connection will cause Thread Starvation. @WebServlet(name = "VideoUploader", urlPatterns = { "/VideoUploader" }, asyncSupported = true) @MultipartConfig public class VideoUploader extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { final AsyncContext ac = request.startAsync(); ac.setTimeout(80000); ac.addListener(new AsyncListener() { public void onComplete(AsyncEvent event) throws IOException { System.out.println("On complete"); } public void onTimeout(AsyncEvent event) throws IOException { System.out.println("On timeout"); } public void onError(AsyncEvent event) throws…
has comment: http://stackoverflow.com/comment/31354270
answers question: http://stackoverflow.com/q/20801529
upvote count: 2
has comment: http://stackoverflow.com/comment/31353106
has comment: http://stackoverflow.com/comment/31348103
has comment: http://stackoverflow.com/comment/31342375
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31286059
has comment: http://stackoverflow.com/comment/31354391
downvote count: 0
has comment: http://stackoverflow.com/comment/31353315

http://stackoverflow.com/comment/31277989
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20842422
score: 0
has text: Can you post your whole SQL query please? At the moment it looks like your summing every value for every user, which is probably not what you want.

http://stackoverflow.com/comment/31004554
type: Comment
comment on: http://stackoverflow.com/q/20700800
score: 0
type: QuestionComment
has text: @peeskillet: Creating iterator for the first String.. :) should I paste that ? This is not a homework question...

http://stackoverflow.com/comment/31201819
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20810112
has text: To be honest your question is worded pretty difficult. If this isn't what you were looking for, let me know and add some clarification to your exact situation. I'm not 100% sure if I got the idea behind the question.
type: AnswerComment

http://stackoverflow.com/comment/31017848
score: 0
has text: @Gray How should I start the thread than?
type: Comment
comment on: http://stackoverflow.com/q/20708071
type: QuestionComment

http://stackoverflow.com/a/20803899
answers question: http://stackoverflow.com/q/20803756
type: AcceptedAnswer
downvote count: 0
has body: In Oracle a schema is basically the same as a user. So the user CAMPAIGN needs to have the necessary privileges to select and reference the tables from the LIVE user. While logged in as the LIVE user, you need to do something like this: grant select, reference on brands to campaign; If the CAMPAIGN user also needs to change the live table, you also need to grant update, insert and delete privilege. You need to do that for each table the CAMPAIGN user wants to access.
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/20803756
upvote count: 3

http://stackoverflow.com/a/20769737
has body: Make sure that your "ProjNew" persistance unit configuration in persistence.xml is right. Proceeding from your stack trace ProjNew configured like application managed, but you use it as container managed. P.s. Can you show your persistence.xml for more information?
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20767164

http://stackoverflow.com/comment/31106943
comment on: http://stackoverflow.com/a/20756630
type: AnswerComment
score: 0
type: Comment
has text: I did it.I passed the date along with the time in the d1 variable..thnx for the help

http://stackoverflow.com/a/20789718
has comment: http://stackoverflow.com/comment/31165146
has comment: http://stackoverflow.com/comment/31164873
has comment: http://stackoverflow.com/comment/31165201
has comment: http://stackoverflow.com/comment/31164820
answers question: http://stackoverflow.com/q/20789577
score: 0
has comment: http://stackoverflow.com/comment/31165075
has comment: http://stackoverflow.com/comment/31165417
has body: this is depend on you skill or understability if you have good configuration knowledge then i suggest to you got through java j2ee. php is more easy to java
type: Answer

struts2
tags question: http://stackoverflow.com/q/20834841
tags question: http://stackoverflow.com/q/20817250
tags question: http://stackoverflow.com/q/20701821
tags question: http://stackoverflow.com/q/20843273
tags question: http://stackoverflow.com/q/20813496
tags question: http://stackoverflow.com/q/20756031
tags question: http://stackoverflow.com/q/20799801
tags question: http://stackoverflow.com/q/20774716
tags question: http://stackoverflow.com/q/20832165
tags question: http://stackoverflow.com/q/20780945
tags question: http://stackoverflow.com/q/20730967
tags question: http://stackoverflow.com/q/20761864
tags question: http://stackoverflow.com/q/20730971
tags question: http://stackoverflow.com/q/20799762
tags question: http://stackoverflow.com/q/20689800
tags question: http://stackoverflow.com/q/20834999
tags question: http://stackoverflow.com/q/20817709
tags question: http://stackoverflow.com/q/20798570
tags question: http://stackoverflow.com/q/20727181
tags question: http://stackoverflow.com/q/20737623
tags question: http://stackoverflow.com/q/20779947
tags question: http://stackoverflow.com/q/20812145
tags question: http://stackoverflow.com/q/20709625
tag name: struts2
tags question: http://stackoverflow.com/q/20782928
tags question: http://stackoverflow.com/q/20733554
tags question: http://stackoverflow.com/q/20748684
tags question: http://stackoverflow.com/q/20794864
tags question: http://stackoverflow.com/q/20726425
tags question: http://stackoverflow.com/q/20761757
tags question: http://stackoverflow.com/q/20814487
tags question: http://stackoverflow.com/q/20696934
tags question: http://stackoverflow.com/q/20796870
tags question: http://stackoverflow.com/q/20788396
tags question: http://stackoverflow.com/q/20835110
tags question: http://stackoverflow.com/q/20795421
tags question: http://stackoverflow.com/q/20838121
tags question: http://stackoverflow.com/q/20839044
tags question: http://stackoverflow.com/q/20772405
tags question: http://stackoverflow.com/q/20811494
tags question: http://stackoverflow.com/q/20681530
tags question: http://stackoverflow.com/q/20838555
tags question: http://stackoverflow.com/q/20837177
tags question: http://stackoverflow.com/q/20703822
tags question: http://stackoverflow.com/q/20695817
type: Tag
tags question: http://stackoverflow.com/q/20739150

http://stackoverflow.com/comment/31054725
has text: Why are you implementing it in so many different ways?!
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20727724

http://stackoverflow.com/q/20770929
has title: Adding OnClick(View v) in a textview
has comment: http://stackoverflow.com/comment/31131879
has comment: http://stackoverflow.com/comment/31131906
type: Question
has body: i have added onClick in my mainactivity for my textview and i had no errors but when i run the app it crashes saying app has stopped working even though i have no errors in my codes i dont know what's the problem i hope you can help me and thanks in advance this is my logcat 12-25 03:32:44.694: I/Ads(1433): AdLoader timed out after 60000ms while getting the URL. 12-25 03:33:00.234: I/Process(1433): Sending signal. PID: 1433 SIG: 9 12-25 03:33:38.454: D/dalvikvm(1559): GC_FOR_ALLOC freed 40K, 4% free 3135K/3248K, paused 283ms, total 286ms 12-25 03:33:38.504: I/dalvikvm-heap(1559): Grow heap (frag case) to 4.200MB for 1127536-byte allocation 12-25 03:33:38.654: D/dalvikvm(1559): GC_FOR_ALLOC freed 2K, 3% free 4233K/4352K, paused 146ms, total 146ms 12-25 03:33:39.144: D/dalvikvm(1559): GC_FOR_ALLOC freed <1K, 3% free 4238K/4352K, paused 46ms, total 47ms 12-25 03:33:39.304: I/dalvikvm-heap(1559): Grow heap (frag case) to 9.535MB for 5591056-byte allocation 12-25 03:33:39.394: D/dalvikvm(1559): GC_FOR_ALLOC freed <1K, 2% free 9698K/9816K, paused 84ms, total 84ms 12-25 03:33:40.284: V/WebViewChromium(1559): Binding Chromium to the background looper Looper (main, tid 1) {b1d56e50} 12-25 03:33:40.304: I/chromium(1559): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0 12-25 03:33:40.334: I/BrowserProcessMain(1559): Initializing chromium process, renderers=0 12-25 03:33:40.514: D/(1559): HostConnection::get() New Host Connection established 0xb7a714f8, tid 1559 12-25 03:33:40.594: W/chromium(1559): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation 12-25 03:33:41.664: E/ActivityThread(1559): Failed to find provider info for com.google.plus.platform 12-25 03:33:41.774: I/Ads(1559): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR); 12-25 03:33:42.194: D/AndroidRuntime(1559): Shutting down VM 12-25 03:33:42.194: W/dalvikvm(1559): threadid=1: thread exiti…
score: 0
tagged with: java
answer count: 4
has comment: http://stackoverflow.com/comment/31131822
has answer: http://stackoverflow.com/a/20770964
has answer: http://stackoverflow.com/a/20770970
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20770949
has answer: http://stackoverflow.com/a/20770960
has comment: http://stackoverflow.com/comment/31131855
tagged with: android
has comment: http://stackoverflow.com/comment/31131910

http://stackoverflow.com/comment/31067778
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/20734631
type: Comment
has text: The package `java.util` is protected by the JVM, you cannot do anything to it.

http://stackoverflow.com/a/20808893
has comment: http://stackoverflow.com/comment/31199591
type: Answer
has comment: http://stackoverflow.com/comment/93835108
answers question: http://stackoverflow.com/q/20808664
downvote count: 0
score: 5
has body: Multiplying a big number by 31 leads to integer overflow, which cannot be reversed using division by 31. But hold on though: arithmetic using int in Java is equivalent to arithmetic modulo 232. Since 31 is odd it has a multiplicative inverse modulo 232. Therefore multiplication by 31 can be reversed with multiplication by the said "inverse." That is: int inverse = -1108378657; // This will print the hashCode of mlkjihgfedcb System.out.println(("mlkjihgfedcba".hashCode() - (int) 'a') * inverse);
has comment: http://stackoverflow.com/comment/31199364
upvote count: 5

http://stackoverflow.com/comment/31000157
score: 0
type: AnswerComment
has text: Thanks, but do you think the use of JNI would result in this decompiler behavior or should I expect to see something more?
type: Comment
comment on: http://stackoverflow.com/a/20698000

http://stackoverflow.com/a/20686209
has comment: http://stackoverflow.com/comment/30979804
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/30979155
accepted answer of: http://stackoverflow.com/q/20685504
answers question: http://stackoverflow.com/q/20685504
type: AcceptedAnswer
has body: Have you tried to implement the OnClickListener inline in getView? button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View button) { button.setTextColor(Color.BLACK); button.setBackgroundColor(Color.GREEN); } } I don't know exactly why, but I had similar Issues where this helped.

http://stackoverflow.com/q/20827504
has body: I'm trying to get a request's http-accept header and I get different values when I get the header from Java - req.getHeader("Accept") + req.getHeader("Accept-Encoding") + req.getHeader("accept-language") PHP - '&lt;?php echo $_SERVER['HTTP_ACCEPT'].$_SERVER['HTTP_ACCEPT_ENCODING'].$_SERVER['HTTP_ACCEPT_LANGUAGE']; ?&gt; The results are : */*gzip,deflate,sdchen-US,en;q=0.8 text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8gzip,deflate,sdchen-US,en;q=0.8 How come they are different? Am I getting them wrong?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: php
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/31234314
tagged with: java
tagged with: httprequest
upvote count: 1
answer count: 1
tagged with: header
has answer: http://stackoverflow.com/a/20827549
favorite count: 0
has title: HTTP-Accept header is different on several methods
has comment: http://stackoverflow.com/comment/31234113

http://stackoverflow.com/q/20747283
favorite count: 0
upvote count: 8
tagged with: spring
score: 8
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-4
tagged with: java
linked to: http://stackoverflow.com/q/40380069
type: Question
has body: I managed to create simple Websocket application with Spring 4 and Stomp. See my last question here Then I tried to use remote message broker(ActiveMQ). I just started the broker and changed registry.enableSimpleBroker("/topic"); to registry.enableStompBrokerRelay("/topic"); and it worked. The question is how the broker is configured? I understand that in this case the application automagicaly finds the broker on localhost:defaultport, bu what if I need to point the app to some other broker on other machine?
has answer: http://stackoverflow.com/a/20799018
has comment: http://stackoverflow.com/comment/86395390
linked to: http://stackoverflow.com/q/20740956
answer count: 1
downvote count: 0
has title: Spring 4 WebSocket Remote Broker configuration
tagged with: websocket
accepted answer: http://stackoverflow.com/a/20799018

http://stackoverflow.com/a/20737955
answers question: http://stackoverflow.com/q/20737873
has body: You need to include the Sherlock library. You can find it Here: http://actionbarsherlock.com/
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20737873

http://stackoverflow.com/comment/31045096
type: AnswerComment
has text: There isn't much you can do then, those two libraries aren't compatible with each other :(. Try and find an updated version of B that is compatible with the new version or an old version of A that is compatible with the old one.
score: 0
comment on: http://stackoverflow.com/a/20722458
type: Comment

http://stackoverflow.com/comment/31059649
has text: try again, it creates a string with whitespaces, it will work on cli or gui
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20730690

http://stackoverflow.com/q/20714058
has answer: http://stackoverflow.com/a/66496896
downvote count: 0
has comment: http://stackoverflow.com/comment/31029552
has body: The documentation for File.listFiles() suggests that null will ONLY be returned in the case that the file calling it is not a directory. I have the following: String dir = "/storage/emulated/0"; File f = new File(dir); Log.v("Files",f.exists()+""); Log.v("Files",f.isDirectory()+""); Log.v("Files",f.listFiles()+""); The log reads: true true null For some reason, listFiles() is returning null even though the File is recognized as a valid directory. I'm not super familiar with Android file hierarchy behavior, so I would guess the problem lies in there. For reference, I'm debugging on my Moto X, and results are the same whether the phone is plugged in to my computer or not - so I don't think it has to do with mounting when plugged in.
has answer: http://stackoverflow.com/a/45953737
accepted answer: http://stackoverflow.com/a/22213615
has comment: http://stackoverflow.com/comment/31029368
tagged with: android
tagged with: io
tagged with: file-permissions
has answer: http://stackoverflow.com/a/22965790
has comment: http://stackoverflow.com/comment/32095706
has answer: http://stackoverflow.com/a/61093325
favorite count: 0
has answer: http://stackoverflow.com/a/25140490
answer count: 12
has answer: http://stackoverflow.com/a/40315915
has title: File exists and IS directory, but listFiles() returns null
has answer: http://stackoverflow.com/a/40561698
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/58050201
has comment: http://stackoverflow.com/comment/31029539
has comment: http://stackoverflow.com/comment/31030588
upvote count: 92
tagged with: java
has answer: http://stackoverflow.com/a/66841695
has comment: http://stackoverflow.com/comment/31029439
tagged with: file
has answer: http://stackoverflow.com/a/22213615
has answer: http://stackoverflow.com/a/42156914
possible better answer: http://stackoverflow.com/a/58050201
type: Question
score: 92
has answer: http://stackoverflow.com/a/20714203

http://stackoverflow.com/q/20795373
tagged with: slf4j
upvote count: 42
type: AnsweredQuestion
downvote count: 0
has title: How to map levels of java.util.logging and SLF4J logger?
favorite count: 0
type: Question
score: 42
tagged with: java
answer count: 1
tagged with: logging
tagged with: java.util.logging
has body: How do logging levels from java.util.logging map to SLF4J? SLF4J trace debug info warn error fatal java.util.logging finest finer fine config info warning severe
has answer: http://stackoverflow.com/a/20807571
accepted answer: http://stackoverflow.com/a/20807571

http://stackoverflow.com/q/20769881
accepted answer: http://stackoverflow.com/a/20776654
has answer: http://stackoverflow.com/a/38334734
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31152751
favorite count: 0
has answer: http://stackoverflow.com/a/20776654
has title: iText- ColumnText set text fit size in Rectangle
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31141940
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/20769994
has body: I want to add text into a rectangle(x,y,w,h). Text should be fitted size of rectangle (mean it has a maximum size but it still contains in rectangle). I tried to measure the text size base on BaseFont.getWidthPoint() The problem is the final text size can't fit the rect. It looks like this: Here is my try: PdfContentByte cb = writer.getDirectContent(); cb.saveState(); ColumnText ct = new ColumnText(writer.getDirectContent()); Font font = new Font(BaseFont.createFont()); int rectWidth = 80; float maxFontSize = getMaxFontSize(BaseFont.createFont(), "text", rectWidth ); font.setSize(maxFontSize); ct.setText(new Phrase("test", font)); ct.setSimpleColumn(10, 10, rectWidth , 70); ct.go(); // draw the rect cb.setColorStroke(BaseColor.BLUE); cb.rectangle(10, 10, rectWidth , 70); cb.stroke(); cb.restoreState(); // get max font size base on rect width private static float getMaxFontSize(BaseFont bf, String text, int width){ float measureWidth = 1; float fontSize = 0.1f; float oldSize = 0.1f; while(measureWidth &lt; width){ measureWidth = bf.getWidthPoint(text, fontSize); oldSize = fontSize; fontSize += 0.1f; } return oldSize; } Could you please tell me where I am wrong? Another problem, I want to measure for both width and height, which text completely contains in rectangle and has the maximum font size. Is there any way to do this? Update: here is the complete source code that worked for me: private static float getMaxFontSize(BaseFont bf, String text, int width, int height){ // avoid infinite loop when text is empty if(TextUtils.isEmpty(text)){ return 0.0f; } float fontSize = 0.1f; while(bf.getWidthPoint(text, fontSize) &lt; width){ fontSize += 0.1f; } float maxHeight = measureHeight(bf, text, fontSize); while(maxHeight &gt; height){ fontSize -= 0.1f; maxHeight = measureHeight(bf, text, fontSize); }; return fontSize; } public static float measureHeight(BaseFont baseFont, String text, float fontSize) { float ascend = baseFont.getAscentPoint(text, fontSize); float descend = b…
tagged with: itext
has answer: http://stackoverflow.com/a/20769994
upvote count: 7
has comment: http://stackoverflow.com/comment/31145465
type: Question

http://stackoverflow.com/q/20813541
has comment: http://stackoverflow.com/comment/31211969
tagged with: stanford-nlp
upvote count: 1
answer count: 1
has body: Is it possible to parse a sentence using the Stanford Parser by passing a string and not an array of strings. This is the example they gave in their short tutorial (See Docs) : Here's example: import java.util.*; import edu.stanford.nlp.ling.*; import edu.stanford.nlp.trees.*; import edu.stanford.nlp.parser.lexparser.LexicalizedParser; class ParserDemo { public static void main(String[] args) { LexicalizedParser lp = LexicalizedParser.loadModel("edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz"); lp.setOptionFlags(new String[]{"-maxLength", "80", "-retainTmpSubcategories"}); String[] sent = { "This", "is", "an", "easy", "sentence", "." }; // This is the sentence to be parsed List&lt;CoreLabel&gt; rawWords = Sentence.toCoreLabelList(sent); Tree parse = lp.apply(rawWords); parse.pennPrint(); System.out.println(); TreebankLanguagePack tlp = new PennTreebankLanguagePack(); GrammaticalStructureFactory gsf = tlp.grammaticalStructureFactory(); GrammaticalStructure gs = gsf.newGrammaticalStructure(parse); List&lt;TypedDependency&gt; tdl = gs.typedDependenciesCCprocessed(); System.out.println(tdl); System.out.println(); } } I am trying to see if I can do this because I need to get sentences from a MySQL database and parse them directly as strings. I could tokezine the sentences and add the words, commas, and period to a String Array, However, to tokenize these sentences, I would have to use the Stanford Tokenizer , PTBTokenizer. The constructor of this tokenizer as listed here (See Docs) requires a "java.io.FileReader" Object, but I am not reading a file from directory. So I am wondering if there is a way to either Parse the sentence directly by passing a string, or if I can solve my problem by tokenizing the sentence without requiring a "java.io.FileReader" Object.
tagged with: nlp
favorite count: 0
has title: Parse sentence Stanford Parser by passing String not an array of strings
accepted answer: http://stackoverflow.com/a/20821087
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31208211
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/20821087
tagged with: java
type: Question

http://stackoverflow.com/comment/31012952
type: AnswerComment
has text: Ah I see, I will have to look into the differences between the two. Thanks for your help :-)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20705483

http://stackoverflow.com/q/20804522
has comment: http://stackoverflow.com/comment/31194616
accepted answer: http://stackoverflow.com/a/20843701
has body: I am learning the Jersey web services, now I understood how GET and POST work : @GET @Produces("text/html") public String getHandler() { return "&lt;h1&gt;Get some REST!&lt;h1&gt;"; } @POST @Consumes("application/x-www-form-urlencoded") @Produces("text/plain") public String postHandler(String content) { return content; } in Jersey Documentation for featching images it said : @GET @Path("/images/{image}") @Produces("image/*") public Response getImage(@PathParam("image") String image) { if (!isSafeToOpenFile(image)) { throw new IllegalArgumentException("Cannot open the image file."); } File f = new File(image); if (!f.exists()) { throw new WebApplicationException(404); } String mt = new MimetypesFileTypeMap().getContentType(f); return Response.ok(f, mt).build(); } I would appreciated if you can show me an example using the above code to fetch images from a folder in the server and post them in a html. Thanks lot.
answer count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31193755
tagged with: web
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20806257
tagged with: web-services
has comment: http://stackoverflow.com/comment/31194350
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20806257
has answer: http://stackoverflow.com/a/20843701
tagged with: java
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/31193966
linked to: http://stackoverflow.com/q/11300847
has title: How to get images from a folder in the server using Jersey WS?

http://stackoverflow.com/a/46372147
downvote count: 0
has comment: http://stackoverflow.com/comment/79706239
has body: Binding refers to the link between method call and method definition. This picture clearly shows what is binding. In this picture, “a1.methodOne()” call is binding to corresponding methodOne() definition and “a1.methodTwo()” call is binding to corresponding methodTwo() definition. For every method call there should be proper method definition. This is a rule in java. If compiler does not see the proper method definition for every method call, it throws error. Now, come to static binding and dynamic binding in java. Static Binding In Java : Static binding is a binding which happens during compilation. It is also called early binding because binding happens before a program actually runs . Static binding can be demonstrated like in the below picture. In this picture, ‘a1’ is a reference variable of type Class A pointing to object of class A. ‘a2’ is also reference variable of type class A but pointing to object of Class B. During compilation, while binding, compiler does not check the type of object to which a particular reference variable is pointing. It just checks the type of reference variable through which a method is called and checks whether there exist a method definition for it in that type. For example, for “a1.method()” method call in the above picture, compiler checks whether there exist method definition for method() in Class A. Because ‘a1′ is Class A type. Similarly, for “a2.method()” method call, it checks whether there exist method definition for method() in Class A. Because ‘a2′ is also Class A type. It does not check to which object, ‘a1’ and ‘a2’ are pointing. This type of binding is called static binding. Dynamic Binding In Java : Dynamic binding is a binding which happens during run time. It is also called late binding because binding happens when program actually is running. During run time actual objects are used for binding. For example, for “a1.method()” call in the above picture, method() of actual object to which ‘a1’ is pointing will be ca…
score: 18
upvote count: 18
type: Answer
answers question: http://stackoverflow.com/q/20783266

http://stackoverflow.com/comment/31120186
has text: You probably want to take a look at [SimpleDateFormat](http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html) instead.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20764560

http://stackoverflow.com/a/20788596
has body: The array cannot be with negative index. In some cases like C++ GLUT, It does not mind the 'minus', so you can write array[0][-1] and it ignores negative number and takes it like array[0][1]. (I faced with it while i was programming in c++ with glut). So, java is sensitive, you need to check your index before you can make an operation. Also as I can see, this is bubble sorting. Maybe check Arrays.sort() function instead of this mess.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20788491

http://stackoverflow.com/a/20766108
answers question: http://stackoverflow.com/q/20766045
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20766045
upvote count: 6
type: AcceptedAnswer
type: Answer
score: 6
has body: system default input stream has no eof ... rather you can implement: it should not be in.nextInt()!=null but rather in.hasNextInt() or you may get a line in.nextLine(); and then extract each number separately by your own method.

http://stackoverflow.com/q/20685489
tagged with: class
answer count: 2
downvote count: 0
favorite count: 0
tagged with: private
accepted answer: http://stackoverflow.com/a/20685594
possible better answer: http://stackoverflow.com/a/20685531
has answer: http://stackoverflow.com/a/20685531
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/30977003
has body: I am trying to solve this problem: A Book, which as a title, author, and year of publication. Include methods to get and set the private instance variables and a toString method to display the object. Also create a method moreRecent which takes two books as input parameters and returns the one that was published more recently. Create 3 JUnit tests for moreRecent. However, I don't know how to access the other private instance variables author and yearofPub. I can only do one constructor per class right? So how do I get the other 2 variables? This is my code so far: Thanks! class Book { private String title; private String author; private String yearofPub; Book(String input) { title = input; } String moreRecent(int Book1, int Book2) { String moreRecent; if(Book1 &gt; Book2) { moreRecent = "Book 1"; } if (Book2 &gt; Book1) { moreRecent = "Book 2"; } else moreRecent = "Both"; return moreRecent; } } public class Chpt2930BookTitleAuthorYear { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter title of Book: "); String nextLine = scan.next(); Book titleofBook = new Book(nextLine); } } EDIT-------------------------- Ok thanks for all the responses! I improved my code further but am still not able to get a correct result. I'm especially having difficulty with the method moreRecent. How do I set the yearofPub for those books? Here is my code: class Book { private String title; private String author; private String yearofPub; Book(String input) { title = input.toString(); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getYearofPub() { return yearofPub; } public void setYearofPub(String yearofPub) { this.yearofPub = yearofPub; } public String toString() { System.out.println("Book{" + "Title=" + title …
type: Question
has title: Private instance variables/Class Definitions
has answer: http://stackoverflow.com/a/20685594
tagged with: java

http://stackoverflow.com/comment/31146213
type: Comment
has text: `record.attributes.entry` ia a `JSONArray` you can also parse on this array
comment on: http://stackoverflow.com/q/20778968
score: 0
type: QuestionComment

http://stackoverflow.com/a/20751888
has body: boolean doesValueBelongToKey(Map map, Object key, Object value) { if(map.containsKey(key) &amp;&amp; map.get(key).equals(value)) return true; else return false; } Can be simplified to return map.containsKey(key) &amp;&amp; map.get(key).equals(value);, of course.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20751618
type: Answer
accepted answer of: http://stackoverflow.com/q/20751618

http://stackoverflow.com/q/20758664
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31110041
has comment: http://stackoverflow.com/comment/31109997
tagged with: tomcat
type: Question
has body: I compile my web app(using ant task) on JDK 7 and deploy it on tomcat 6, but get this error: java.lang.verifyerror expecting a stackmap frame at branch Does anyone else recognize this error?
tagged with: java-7
has title: java.lang.verifyerror expecting a stackmap frame at branch target in tomcat
linked to: http://stackoverflow.com/q/15122890
has comment: http://stackoverflow.com/comment/31109968
has comment: http://stackoverflow.com/comment/31109923
score: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/15122890
tagged with: ant

http://stackoverflow.com/comment/31199916
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20809171
type: Comment
has text: I have no idea where you are going with this. Can you give us an example?

http://stackoverflow.com/q/20813848
has comment: http://stackoverflow.com/comment/31208619
answer count: 4
has comment: http://stackoverflow.com/comment/31208641
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20813912
has title: Put .txt file data in array
has comment: http://stackoverflow.com/comment/31208711
tagged with: java
has comment: http://stackoverflow.com/comment/31208676
type: Question
has answer: http://stackoverflow.com/a/20813909
has body: I'm new at java I would like to know how to read a .txt file and then put every single line in an array cell. .txt file must be formatted as shown: car //goes in array[0] boat //goes in array[1] ship //goes in array[2] airplane //goes in array[3] //...and so on.. I've already tried to create a ReadFile class implemented in this way: import java.io.*; import java.util.*; public class ReadFile { private Scanner x; public void open(){ try{ x = new Scanner(new File("time_table_data.txt")); }catch(Exception e){ System.out.println("Could Not Create The File"); } } public String read(){ String s = ""; while(x.hasNext()){ String a = x.next(); s = a.format("%s\n",a); } return s; } public void close(){ x.close(); } }
score: 0
has answer: http://stackoverflow.com/a/20813948
has comment: http://stackoverflow.com/comment/31208625
has comment: http://stackoverflow.com/comment/31208670
has answer: http://stackoverflow.com/a/20813968

http://stackoverflow.com/a/20780367
has comment: http://stackoverflow.com/comment/31150855
has comment: http://stackoverflow.com/comment/31148656
has comment: http://stackoverflow.com/comment/31150457
downvote count: 0
has comment: http://stackoverflow.com/comment/31150948
has body: 12-26 11:43:06.253: E/AndroidRuntime(506): java.lang.NoClassDefFoundError: com.project.findmybuffet.SearchPage 12-26 11:43:06.253: E/AndroidRuntime(506): at com.project.findmybuffet.AndroidTabRestaurantDescListView$3.onClick(AndroidTabRestaurantDescListView.java:101) It is unable to find com.project.findmybuffet.SearchPage class. Please check your package name once. &lt;activity android:name="com.project.findmybuffet.SearchPage" &gt; &lt;/activity&gt; You have mentioned your search page activity in this path "com.project.findmybuffet.SearchPage" so please check whether that SearchPage.class is in that path or not. If everything is good. Try clean your project and run again Now try this Photos.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent photoIntent=new Intent(AndroidTabRestaurantDescListView.this,AndroidTabRestaurantDescImageListView.class); startActivity(photoIntent); } }); Filter.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent filterIntent=new Intent(AndroidTabRestaurantDescListView.this,Filters.class); startActivity(filterIntent); } }); Search.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent searchIntent=new Intent(AndroidTabRestaurantDescListView.this,SearchPage.class); startActivity(searchIntent); } }); Account.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent accountIntent=new Intent(AndroidTabRestaurantDescListView.this,RestaurantAccount.class); startActivity(accountIntent); } });
has comment: http://stackoverflow.com/comment/31150320
type: Answer
has comment: http://stackoverflow.com/comment/31148828
has comment: http://stackoverflow.com/comment/31150723
has comment: http://stackoverflow.com/comment/31150409
score: 1
has comment: http://stackoverflow.com/comment/31151188
has comment: http://stackoverflow.com/comment/31150286
upvote count: 1
has comment: http://stackoverflow.com/comment/31148937
has comment: http://stackoverflow.com/comment/31149081
has comment: http://stackoverflow.com/comment/31150889
answers question: http://stackoverflow.com/q/20780096
has comment: http://stackoverflow.com/comment/31149156
has comment: http://stackoverflow.com/comment/31151059

http://stackoverflow.com/a/20842034
has body: mot;word oui;yes utiliser;use comment;how It appears that the structure of each line is frenchWord;englishWord So you can read each line of your file using a Scanner (using the constructor Scanner(File source)) and the nextLine() method, and split each line by ";". The first element in the array will be the french word and the second one the english word. Add those element in two separate List (ArrayList per example), one containing all the french words, and the other one the english words.
score: 0
answers question: http://stackoverflow.com/q/20841980
type: Answer

http://stackoverflow.com/q/20713502
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31028390
has comment: http://stackoverflow.com/comment/31028340
has comment: http://stackoverflow.com/comment/31028369
tagged with: java
has answer: http://stackoverflow.com/a/20713527
tagged with: methods
has answer: http://stackoverflow.com/a/20713528
type: Question
score: -2
has title: Why can't I access to this method?
has comment: http://stackoverflow.com/comment/31028373
has comment: http://stackoverflow.com/comment/31028275
tagged with: class
has comment: http://stackoverflow.com/comment/31028377
has comment: http://stackoverflow.com/comment/31028292
answer count: 2
downvote count: 3
upvote count: 1
has body: package learnclass; public class Car { public String manuName; public int engineCC; public float fuelammount; public float carWeight; public float presentAmountFuel(){ return fuelammount; } } ////////////////////// package learnclass; public class LearningClass { static private Car ourCar; public static void main(String[] args) { ourCar. } } I just cant access presentAmountFuel() method by ourCar object . Why is this happening ?

http://stackoverflow.com/comment/31148892
has text: Why don't you use `Integer temp=sc.nextInt();`? I don't think this solves your problem. But to make more short. And why scanner is closing and creating again?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20780471
score: 0

http://stackoverflow.com/comment/31052743
comment on: http://stackoverflow.com/q/20726794
score: 0
type: Comment
has text: @Phrank post the whole code. `layout` set to activity?
type: QuestionComment

http://stackoverflow.com/comment/31208750
has text: I updated the answer and check it now. When you make the object of this class, pass the context of activity into the constructor of the `CellInformation` class and Use this context to call the `context.getSystemService`
type: AnswerComment
comment on: http://stackoverflow.com/a/20813885
score: 0
type: Comment

http://stackoverflow.com/a/20726491
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20726304
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20726304
type: Answer
has body: Jsoup probably supports xpath. The xpath query you are looking for is : //span[@class='nextprev']/a[2]/@href Instead of relying on regular expressions, this might be easier. If you are going the regex way, capture the after part of the regex. The highest count gives the url to the next page. http://www.reddit.com/r/\\w+/\\?count=\\w+&amp;amp;after=(\\w+) The url with the largest after number gives the url to the next page. Better still use any of the java wrappers around the reddit api.
has comment: http://stackoverflow.com/comment/31054513
score: 1

http://stackoverflow.com/comment/31170081
score: 0
has text: Check *Deployment assembly* in your project settings. Linked project needs to be deployed within the web application. Just linking it as a class path entry is not enough. http://stackoverflow.com/questions/11081411/eclipse-web-app-deployment-with-tomcat-providing-multiple-projects-dependencie
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20792313

http://stackoverflow.com/comment/30969764
type: QuestionComment
has text: You said that you where not able to download the file. Are you sure the file was uploaded properly?
comment on: http://stackoverflow.com/q/20681434
score: 0
type: Comment

http://stackoverflow.com/comment/41211545
score: 0
has text: Ugh, you should not use serialized longs, you are wasting lot of space. I would use [`readLong()`](http://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html#readLong%28%29) from DataInputStream and readFully() (as seen in answer below).
comment on: http://stackoverflow.com/q/20713862
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31222342
type: Comment
comment on: http://stackoverflow.com/a/20821102
type: AnswerComment
score: 0
has text: I understand the parsing portion, but I only want to compare the 'scores' portion of the arrays: Like so: array1[1] to all of the other array socres. And then find out where it will go...

http://stackoverflow.com/comment/31227047
type: AnswerComment
comment on: http://stackoverflow.com/a/20812597
type: Comment
score: 1
has text: Well, it would be better for you to use a more recent Java version. But if the problem really was the Java version then the error message would likely be different. You would also not have many of these problems if you used Maven. It's not difficult to set up.

http://stackoverflow.com/comment/31035763
has text: are u sure that u r asking a question and not ordering us.;)
type: Comment
comment on: http://stackoverflow.com/q/20717705
score: 2
type: QuestionComment

http://stackoverflow.com/a/20843299
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20843089
answers question: http://stackoverflow.com/q/20843089
has comment: http://stackoverflow.com/comment/31274918
type: AcceptedAnswer
downvote count: 0
has body: Hadoop is definitely not the tool for the job for a multi-megabyte job. For reference, the default block size of HDFS is 64MB, because it was determined roughly that any data smaller than that would involve greater spin-up overhead than was worth it for the parallelism provided by Hadoop. So, if your few megabytes job was run on Hadoop, it would only use one processor at a time, completely not using the parallelism of the platform. The general rule of thumb is, if the entire data corpus can fit into the RAM of a single JVM, then you don't need Hadoop at all. Given that the available RAM of a basic production machine these days is on the order of several GB, then you should not consider Hadoop until you move to the multi-GB per day range of data sizes. For a small task like that over text corpuses, there are natural language libraries in python that would probably be better suited, such as nltk. Of course, if it is just a word count you are looking for then any language will be fine, such as native python, or perl.

http://stackoverflow.com/comment/31164601
has text: Items to be added in the actionbar need to be in the res/menu directory where you create a menu xml. In your java file you override onCreateOptionsMenu(...) you then make sure you inflate a your menu xml there
comment on: http://stackoverflow.com/q/20789616
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31051665
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20726118
has text: @PakkuDon it is an online class and the teacher doesn't ever want to be bothered because he has about 10 classes this semester.
score: 0

http://stackoverflow.com/comment/31218816
type: Comment
score: 0
has text: I have edited my code above. Now I have added another user. Do I have to instantiate output class each time I create another user? I get errors If I don't! Is there a way to pass d1,d2 to the output class together output v = new output(d1,d2).
type: AnswerComment
comment on: http://stackoverflow.com/a/20818681

http://stackoverflow.com/a/54956819
answers question: http://stackoverflow.com/q/20800006
has body: As you had written, lcm(firstnumber, secondnumber); this method will return an int type value, but in your code, you are not obtaining the returned value in any variable. So, you should write like this : int variable=lcm(firstnumber, secondnumber);
score: 0
type: Answer

http://stackoverflow.com/q/20819697
tagged with: java
has answer: http://stackoverflow.com/a/20821190
has answer: http://stackoverflow.com/a/20842742
has body: I've got a really odd problem with the Google Drive Android SDK. I've been using it for several months now, and until last week it performed perfectly. However, there is now a really odd error, which doesn't occur all the time but does 9 out of 10 times. I'm trying to list the user's files and folders stored in a particular Google Drive folder. When I'm trying to use the method Drive.files().list().execute(), 9 out of 10 times literally nothing happens. The method just hangs, and even if I leave it for an hour, it just remains doing... nothing. The code I'm using is below - all of this being run within the doInBackground of an AsyncTask. I've checked credentials - they are all fine, as is the app's certificate's SHA1 hash. No exceptions are thrown. Google searches have yielded nothing. Here is the particular bit of code that's bothering me: try { GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2( SettingsActivity.this, Arrays.asList(DriveScopes.DRIVE)); if (googleAccountName != null && googleAccountName.length() > 0) { credential.setSelectedAccountName(googleAccountName); Drive service = new Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), credential).build(); service.files().list().execute(); // Google Drive fails here } else { // ... } } catch (final UserRecoverableAuthIOException e) { // Authorisation Needed runOnUiThread(new Runnable() { @Override public void run() { try { startActivityForResult(e.getIntent(), REQUEST_AUTHORISE_GDRIVE); } catch (Exception e) { Log.e("SettingsActivity: Google Drive", "Unable to add Google Drive account due to Exception after trying to show the Google Drive authroise request intent, as the UserRecoverableIOException was originally thrown. Error message:\n" + e.getMessage()); } } }); Log.d("SettingsActivity: Google Drive", "UserRecoverableAuthIOException when trying to add Google Drive account. This is normal if this is the first time the user has tried to use Google Drive. Error message…
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22479752
tagged with: google-drive-api
has title: Google Drive for Android SDK Doesn't List Files
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/31235364
has text: @Raghunandan yeah, I read the stacktrace later.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20828079

http://stackoverflow.com/comment/31037409
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20716017
has text: @NimChimpsky While I appreciate the plug for [HikariCP](http://brettwooldridge.github.io/HikariCP/), even HikariCP won't save you from leaking resources. :-) See Steve's answer below.

http://stackoverflow.com/q/20694291
type: Question
tagged with: bluej
has answer: http://stackoverflow.com/a/20694357
downvote count: 0
has title: File indexing program not working
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: alphabetical
tagged with: indexing
score: 2
has body: I have to make a program that reads each word a file and makes an index of which lines the word occurs on in alphabetical order. for example, if the file had: a white white dog crowded around the valley the output should be: a around: 2 crowded: 2 dog: 1 the: 2 valley: 1 white: 1, 1 When my file contains: one fish two fish blue fish green fish cow fish milk fish dog fish red fish can you find a little lamb can you find a white calf THE OUTPUT IS WRONG!: (NOT IN ALPHA ORDER) a: 3 4 calf: 4 find: 3 4 4 lamb: 3 little: 3 white: 4 you: 3 4 blue: 1 can: 3 cow: 2 dog: 2 green: 1 1 2 2 2 2 milk: 2 red: 2 two: 1 1 1 fish: 1 one: 1 Here is my code:: INDEXMAKER MASTER CLASS import java.io.*; import java.util.*; public class IndexMaker { private ArrayList&lt;Word&gt; words; private String fileName; private String writeFileName; public IndexMaker(String fileName, String writeFileName) { this.fileName = fileName; this.writeFileName = writeFileName; words = new ArrayList&lt;Word&gt;(); } public void makeIndex() { try { File file = new File(fileName); Scanner lineScanner = new Scanner(file); int lineNum = 0; while (lineScanner.hasNext()) { lineNum++; Scanner wordScanner = new Scanner(lineScanner.nextLine()); while (wordScanner.hasNext()) { String word = wordScanner.next().toLowerCase(); if (!words.contains(new Word(word))) { insertInto(word, findPosition(word), lineNum); } else { addLineNum(word, lineNum); } } } } catch (Exception e) { e.printStackTrace(); } } public void displayIndex() { try { //FileWriter fileWriter = new FileWriter(new File(writeFileName)); //BufferedWriter writer = new BufferedWriter(fileWriter); for (Word word : words) System.out.println(word.getWord() + ": " + word.getLineNums()); } catch (Exception e) { } } private int findPosition(String word) { for (int i = 0; i &lt; words.size(); i++) { if (word.compareTo(words.get(i).getWord()) &lt;= 0) return i; } return 0; } private void insertInto(String word, int pos, int lineNum) { words.add(pos, new Word(word, Str…
tagged with: java

http://stackoverflow.com/comment/31266129
score: 0
type: Comment
has text: I have downloaded it and extracted it inside the folder which has the eclipse.exe but it didn't work !
type: QuestionComment
comment on: http://stackoverflow.com/q/20844734

http://stackoverflow.com/a/20813600
has comment: http://stackoverflow.com/comment/31208442
has body: I just use e.getPoint() which returns the point of the mouse clicked. You could either have your Frame implement MouseListener of you can register a MouseListener to the frame if it is not the main GUI component. public class MyFrame extends JFrame implements MouseListener { @Override public void mouseClicked(MouseEvent e) { Point p = e.getPoint(); int x = (int) p.getX(); int y = (int) p.getY(); // do something withe the x and y points } } If you do the above, you also need to override the other MouseListener methods. Though you don't need to implement any action for them @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } If your GUI class didn't extend JFrame, then you can just register the listener to the Frame, in which case you only need to use the MouseAdapter, which allows you to just implement 0 or more action method (i.e. just mouseClicked) frame.addMouseListener(new MouseAdapter() { void mouseClicked(MouseEvent e) { Point p = e.getPoint(); int x = (int) p.getX(); int y = (int) p.getY(); // do somthing withe the x and y points } }); Edit for MouseMotionListener "I want to know location of mouse always not just when clicked." If you wan't to know the location of the mouse at any given time, you should implement MouseMotionListener and override the mouseDragged and mouseMoved public class MyFrame extends JFrame implements MouseMotionListener { .... public void mouseMoved(MouseEvent e){ Point p = e.getPoint(); int x = (int) p.getX(); int y = (int) p.getY(); // do something withe the x and y points } public void mouseDragged(MouseEvent e){ } } The mouseMoved will fire an event every time the mouse is moved, and the mouseDragged will fire an event whenever the mouse is dragged
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/31209025
upvote count: 6
has comment: http://stackoverflow.com/comment/31208493
has comment: http://stackoverflow.com/comment/31208481
answers question: http://stackoverflow.com/q/20813518
accepted answer of: http://stackoverflow.com/q/20813518
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/20706988
has body: Here is a good example of base64 encoding byte arrays. It gets more complicated when you throw unicode characters in the mix to send things like PDF documents. After encoding a byte array the encoded string can be used as a JSON property value. Apache commons offers good utilities: byte[] bytes = getByteArr(); String base64String = Base64.encodeBase64String(bytes); byte[] backToBytes = Base64.decodeBase64(base64String); https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding Java server side example: public String getUnsecureContentBase64(String url) throws ClientProtocolException, IOException { //getUnsecureContent will generate some byte[] byte[] result = getUnsecureContent(url); // use apache org.apache.commons.codec.binary.Base64 // if you're sending back as a http request result you may have to // org.apache.commons.httpclient.util.URIUtil.encodeQuery return Base64.encodeBase64String(result); } JavaScript decode: //decode URL encoding if encoded before returning result var uriEncodedString = decodeURIComponent(response); var byteArr = base64DecToArr(uriEncodedString); //from mozilla function b64ToUint6 (nChr) { return nChr &gt; 64 &amp;&amp; nChr &lt; 91 ? nChr - 65 : nChr &gt; 96 &amp;&amp; nChr &lt; 123 ? nChr - 71 : nChr &gt; 47 &amp;&amp; nChr &lt; 58 ? nChr + 4 : nChr === 43 ? 62 : nChr === 47 ? 63 : 0; } function base64DecToArr (sBase64, nBlocksSize) { var sB64Enc = sBase64.replace(/[^A-Za-z0-9\+\/]/g, ""), nInLen = sB64Enc.length, nOutLen = nBlocksSize ? Math.ceil((nInLen * 3 + 1 &gt;&gt; 2) / nBlocksSize) * nBlocksSize : nInLen * 3 + 1 &gt;&gt; 2, taBytes = new Uint8Array(nOutLen); for (var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx &lt; nInLen; nInIdx++) { nMod4 = nInIdx &amp; 3; nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) &lt;&lt; 18 - 6 * nMod4; if (nMod4 === 3 || nInLen - nInIdx === 1) { for (nMod3 = 0; nMod3 &lt; 3 &amp;&amp; nOutIdx &lt; nOutLen; nMod3++, nOutIdx++) { taBytes[nOutIdx] = nUint24 &g…
has comment: http://stackoverflow.com/comment/113251327
has comment: http://stackoverflow.com/comment/102138849
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20706783
type: Answer
answers question: http://stackoverflow.com/q/20706783
score: 91
upvote count: 91
has comment: http://stackoverflow.com/comment/107940835

http://stackoverflow.com/comment/61363966
type: Comment
comment on: http://stackoverflow.com/a/20807657
score: 16
has text: "soon to be fixed" bug still exists in JDK 1.8.0_92 on Max OSX 10.11 (El Capitan). I mean, come on.
type: AnswerComment

opencv
type: Tag
tags question: http://stackoverflow.com/q/20831351
tags question: http://stackoverflow.com/q/20771443
tags question: http://stackoverflow.com/q/20739574
tags question: http://stackoverflow.com/q/20684505
tags question: http://stackoverflow.com/q/20755343
tags question: http://stackoverflow.com/q/20845153
tags question: http://stackoverflow.com/q/20808325
tags question: http://stackoverflow.com/q/20820900
tag name: opencv
tags question: http://stackoverflow.com/q/20689252
tags question: http://stackoverflow.com/q/20751681
tags question: http://stackoverflow.com/q/20848263
tags question: http://stackoverflow.com/q/20729919
tags question: http://stackoverflow.com/q/20803198

http://stackoverflow.com/q/20743151
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20743215
accepted answer: http://stackoverflow.com/a/20743215
has comment: http://stackoverflow.com/comment/31081706
has comment: http://stackoverflow.com/comment/31081753
has title: What Lock is not reentrant i.e. blocks if acquired in the same thread without previously releasing?
tagged with: multithreading
type: AnsweredQuestion
downvote count: 0
has body: When I click Button1 I want to tryLock() in the main thread and then start a background task. The background task will post unlock() to the main thread when it completes. If the lock is not acquired the click should do nothing and just return. I don't want to lock from within the background task's thread because initialising the task object is expensive. I want to avoid creating a task object altogether if the lock has already been acquired by a previous button click. The same thing should happen for Button2 and tryLock() should fail if Button1's task has not completed. A reentrant lock won't work here since both buttons lock from the same thread. Since the lock will only ever be acquired and released from the main thread, is the solution simply a private boolean class member? Does it even have to be volatile?
score: 1
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/31081847
type: Question
tagged with: locking
upvote count: 1

http://stackoverflow.com/comment/31045673
has text: @McDowell you are right :D
comment on: http://stackoverflow.com/q/20719393
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20781060
linked to: http://stackoverflow.com/q/6772709
tagged with: android
answer count: 4
has title: Loading array from a text file in assets folder (Android)
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31149586
has answer: http://stackoverflow.com/a/20781192
tagged with: java
has answer: http://stackoverflow.com/a/20781157
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31149585
has body: PLEASE, I know this question has been asked many times, but I still can't get my code to work. I have a text file in my assets folder called words.txt. There is one word per line in each line of that text file with no blank lines. I want to put every word in an array. First I tried using scanner, but after reading many stackoverflow threads I found out I needed to use AssetManager. Here's what I tried: AssetManager assetManager = getAssets(); InputStream inputStream = assetManager.open("words.txt"); It gives me the error message: default constructor cannot handle exception type IOException thrown by implicit super constructor... before I even do anything else. I don't know what this means. Also, looking at the api, it seems like InputStream can only read bytes. How can I read words from the text file? The threads are overwhelming because it seems like each answer proposes a different method, using InputStreams, BufferedStreams, FileInputStreams, File, Res folders, Asset folders, and lots of other language I am unfamiliar with. I am just learning to develop android apps and have limited java experience.
score: 0
has answer: http://stackoverflow.com/a/36400124
has answer: http://stackoverflow.com/a/20781403
favorite count: 0

http://stackoverflow.com/a/20777791
upvote count: 1
has body: According to my opinion and scientifically one can not do this by closing the eyes and picking a random value from 0 to 1. Maybe, maybe not. Tuning a smoothing filter is usually an empirical task, you pick a value that works "well enough" in practice. You're trading-off smoothness of result against speed (i.e. ability to respond quickly to changes in the input). On the other hand, if there is a specific time-constant you're aiming for, then yes, just use that! * You can analyse the filter expression to determine its frequency response. However, that basically requires the discrete-time Fourier transform (and maybe the Z transform as well). That's a little out of the scope for a Stack Overflow answer, I'm afraid! * However, I'm not sure what you read from that datasheet that led you to believe that that particular value of tau is what you should be using...
downvote count: 0
has comment: http://stackoverflow.com/comment/31144245
type: Answer
has comment: http://stackoverflow.com/comment/31145010
answers question: http://stackoverflow.com/q/20777726
score: 1

http://stackoverflow.com/a/20737160
upvote count: 1
answers question: http://stackoverflow.com/q/20737099
has comment: http://stackoverflow.com/comment/31071847
has comment: http://stackoverflow.com/comment/31071937
downvote count: 0
has body: Edit: Brian's way of using Shuffle is better; forgot about that method, haha. My bad. Ignore this answer and use that. Create an ArrayList of your strings with "button 1", "button 2", "button 3", "button 4" Every time a button is clicked, create an ArrayList that is a copy of the above array (not a copy of the reference). eg: ArrayList&lt;String&gt; copy = new ArrayList&lt;String&gt;(intialArrayList); Then use JButton#setText and Math.Random() to choose one of those strings for the first button. Every time you choose a string, delete the string from the copy. (that would make it impossible to set a button text twice). Then repeat with the remaining buttons, but make sure the random number generated is first between 0-3, then 0-2, then 0-1. eg: int j = 3; ArrayList&lt;String&gt; copy = new ArrayList&lt;String&gt;(initialArrayList); for(int i = 0; i&lt; 3; i++) { //int rand = generate random number between i and j String text = copy.get(rand); // setText(text) for each b1, b2, b3, b4; // copy.remove(text); j--; } Create a separate method for this so you don't have to keep typing this in for each actionPerformed method. That's just how I would do it.
type: Answer
has comment: http://stackoverflow.com/comment/31072153
score: 1

http://stackoverflow.com/a/20710772
type: Answer
answers question: http://stackoverflow.com/q/20710742
has comment: http://stackoverflow.com/comment/31022877
has body: A common way to generate a "card" is to choose a random number between 0 and 51, and then calculating the suit as number % 4 and the rank as number / 4. So something like: Random rand = new Random(); int card = rand.nextInt(52); String suit = suitValues[card % 4]; String rank = numberValues[card / 4]; Note that this method is appropriate for generating a single, random card. If you want to generate a hand, or deal a deck, it's much simpler to instead randomly "shuffle" a full "deck" of numbers, since that ensures you don't "deal" the same card more than once. Determining which card has been dealt can still use the above method, though.
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/20789577
has title: i am confused about j2ee and php
has comment: http://stackoverflow.com/comment/31164584
tagged with: php
has answer: http://stackoverflow.com/a/20789817
has comment: http://stackoverflow.com/comment/31164743
has comment: http://stackoverflow.com/comment/31164918
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20789718
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/20789718
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31164805
tagged with: jakarta-ee
upvote count: 1
has answer: http://stackoverflow.com/a/20789821
has comment: http://stackoverflow.com/comment/31164589
has body: As a developer going through web development I would like to know if J2EE or PHP is better for building web sites. My initial thoughts were that J2EE was better because it is Java based but upon reading several articles I read that PHP might be easier and more focused with regard to web development. On this topic I have another query, whilst looking at different articles on web design and construction I came across websites that claimed to be built in J2EE, Java and Ruby. Is J2EE the same as Java? Or is it something completely different.
answer count: 3
has comment: http://stackoverflow.com/comment/31164616
accepted answer: http://stackoverflow.com/a/20789817
has comment: http://stackoverflow.com/comment/31164741
favorite count: 0

http://stackoverflow.com/q/20713411
favorite count: 0
has comment: http://stackoverflow.com/comment/31028897
has comment: http://stackoverflow.com/comment/31028278
has comment: http://stackoverflow.com/comment/31028189
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31028155
tagged with: java
downvote count: 2
has title: Will this regex match "i.imgur.com/xxx"?
accepted answer: http://stackoverflow.com/a/20713514
type: Question
has body: Will this regex match http://i.imgur.com/xxx? "http://i.imgur.com/[a-zA-Z0-9]*" I don't use regex really, and I have learned it once barely. I googled how to do it for imgur and every one had really long ones, isn't this good enough? it seems to be working but what will it miss and how to improve? I want to find all i.imgur.com/xxx in order to download the imgur .jpg. Basically it MUST look like "http://i.imgur.com/" the rest is going to be either "afsidjf123" "Bdfsi13" "123aslefBA"
score: -2
has comment: http://stackoverflow.com/comment/31028154
possible better answer: http://stackoverflow.com/a/20713505
has answer: http://stackoverflow.com/a/20713505
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31028210
has answer: http://stackoverflow.com/a/20713514

http://stackoverflow.com/q/20788687
has answer: http://stackoverflow.com/a/20788738
type: Question
has title: java syntax int compareQuantity = ((Fruit) compareFruit).getQuantity(); not understood
has answer: http://stackoverflow.com/a/20788742
accepted answer: http://stackoverflow.com/a/20788733
has comment: http://stackoverflow.com/comment/31162796
possible better answer: http://stackoverflow.com/a/20788742
has answer: http://stackoverflow.com/a/20788752
answer count: 5
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/20788739
has body: I can across the following code in this tutorial, which I don't understand public int compareTo(Fruit compareFruit) { //I don't understand this typecasting int compareQuantity = ((Fruit) compareFruit).getQuantity(); //ascending order return this.quantity - compareQuantity; //descending order //return compareQuantity - this.quantity; } why are we typecasting compareFruit to Fruit type, when it is already a Fruit type to begin with? It seems redundant. Where did the getQuantity method come from? Where can I see the source code for this ? I tried to look through some documentation but could not find anything.
has answer: http://stackoverflow.com/a/20788733

http://stackoverflow.com/comment/31079837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20742180
has text: google for *coefficient of restitution* or *elastic collision*
score: 0

http://stackoverflow.com/comment/31036956
comment on: http://stackoverflow.com/q/20716169
has text: I did that already! didnt find anything. Yes all queries are same, reading some data from different tables, running some process on that and write it in other table. there are around 800k iteration for that, I could say that it almost stop at 200th iteration! Could it be related to garbage collector?!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20791411
answers question: http://stackoverflow.com/q/20791363
has body: This is a very general question - you would serialize an object into bytes for any number of reasons. Transfer an object across the internet to another program Save an object to a database or file system so you can restore your programs state at a later date or time Save an object for the sake of undo/redo within your program There are many other reasons as well, of course, but you can get the idea from these! I recommend searching online to see if serialization is useful for your application.
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/20791363
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31188868
type: Comment
comment on: http://stackoverflow.com/a/20803243
score: 0
type: AnswerComment
has text: Sorry, but my String is exactly `5 4\rad`. Indeed how to delete `\rad`?

http://stackoverflow.com/a/78901621
has body: Now you can use app:min, like this app:min="@integer/min_circle_tracker_timeout"
score: 0
answers question: http://stackoverflow.com/q/20762001
type: Answer

http://stackoverflow.com/a/28792458
downvote count: 1
answers question: http://stackoverflow.com/q/20770294
has body: I solved the problem by right click on the pom.xml in Eclipse and 'Maven Add Dependency' org.springframework spring-web 3.0.4.RELEASE
upvote count: 2
type: Answer
score: 1

http://stackoverflow.com/q/20786571
has comment: http://stackoverflow.com/comment/31161928
tagged with: android-activity
favorite count: 0
tagged with: android-studio
accepted answer: http://stackoverflow.com/a/20786657
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/20786657
upvote count: 1
downvote count: 1
has body: I'm new to Android and am following the example here. I can get the Layout fine, and the button event fires, but Android Studio doesn't seem to work in the same way as Eclipse does in their example. I add a new Activity but Android Studio forces a new Fragment to be added as well. I've read up on Fragments but don't understand why we're forced to use it in AS but not in Eclipse. Either way, this seems to be breaking my app. When I click the button I get an error saying java.lang.RuntimeException: Unable to start activity ComponentInfo{com.t.at/com.t.at.DisplayMessageActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f07003c (com.tutorials.androidtutorials:id/container) for fragment PlaceholderFragment{b1e1f5e8 #0 id=0x7f07003c} I'm sure I've followed everything the tutorial has said but the only difference I see is the fragment file that AS always creates. How can I launch a new activity after clicking a button? Here's my click handler 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); } My activity_displaymessage.xml file looks like this &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".DisplayMessageActivity" tools:ignore="MergeRootFrame" /&gt; and fragment_displaymessage.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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/acti…
type: Question
has comment: http://stackoverflow.com/comment/31158768
has title: Launch new activity after clicking a button
has comment: http://stackoverflow.com/comment/31158853
score: 0
has comment: http://stackoverflow.com/comment/31158936
has comment: http://stackoverflow.com/comment/31159074
answer count: 1

http://stackoverflow.com/a/20741983
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20741916
has body: You just get value from edittext and check the length of string that you got from editext. like below. String str=editext.getText().tostring.trim(); String str2=editext2.getText().tostring.trim(); .. .. if(str.length()&gt;0 || str2.length()&gt;0 ......){ //your navigation code }else{ //your alert message } do this for every editext. hope this may help you.
has comment: http://stackoverflow.com/comment/31080504
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31081142
has comment: http://stackoverflow.com/comment/31080366

http://stackoverflow.com/comment/31235642
comment on: http://stackoverflow.com/q/20828057
has text: @Kunu have a look at this blog http://androidhub.wordpress.com/2011/08/03/android-intents-for-passing-data-between-activities-part-3/ and the link in my previous comment. title and vincinty is null for some reason
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/20693020
tagged with: libgdx
has answer: http://stackoverflow.com/a/20963134
has title: libgdx ActorGestureListener.pan() parameters not moving actor in smooth line
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/31007541
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31006958
tagged with: drag
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/38551083
type: Question
has body: I override the pan method in ActorGestureListener to implement dragging actors in libgdx (scene2d). When I move individual pieces on a board they move smoothly, but when moving the whole board, the x and y coordinates that is sent to pan is "jumping", and in an increasingly amount the longer it is dragged. These are an example of the deltaY coordinates sent to pan when dragging smoothly downwards: 1.1156368 -0.13125038 -1.0500145 0.98439217 -1.0500202 0.91877174 -0.984396 0.9187679 -0.98439026 0.9187641 -0.13125038 This is how I move the camera: public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) { cam.translate(-deltaX, -deltaY); I have been using both the delta values sent to pan and the real position values, but similar results. And since it is the coordinates that are wrong, it doesn't matter whether I move the board itself or the camera. What could the cause be for this and what is the solution? EDIT When I move camera only half the delta-values, it moves smoothly but only at half the speed of the mouse pointer: cam.translate(-deltaX / 2, -deltaY / 2); It seems like the moving of camera or board affects the mouse input coordinates. How can I drag at "mouse speed" and still get smooth movements?

http://stackoverflow.com/q/20718363
answer count: 1
has comment: http://stackoverflow.com/comment/31037136
has title: Error on certain loop through of code
has comment: http://stackoverflow.com/comment/31037100
has comment: http://stackoverflow.com/comment/31037242
tagged with: compiler-errors
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31037030
has body: I have designed a RPN algorithm to compute the result of a sum given to a calculator. My code for the RPN is as follows: import java.util.ArrayList; public class RPNCalculator { String operator; double number_1; double number_2; double result; public int length_change; public void calculateResult(ArrayList&lt;Object&gt; outputQueueArray) { int length = outputQueueArray.size(); length_change = length; int i; int b; int a; for(b = 0; b &lt; length; b++){ for(i = 0; i &lt; length_change; i++){ if(outputQueueArray.get(i).equals("+") || outputQueueArray.get(i).equals("-") || outputQueueArray.get(i).equals("/") || outputQueueArray.get(i).equals("*")){ a = i - 2; operator = (String) outputQueueArray.remove(i) ; number_1 = (double) outputQueueArray.remove(i - 1); number_2 = (double) outputQueueArray.remove(i - 2); outputQueueArray.add(a,useOperator(number_1, number_2, operator)); length_change = outputQueueArray.size(); System.out.println(outputQueueArray); } } } } public double useOperator(double number_1, double number_2, String operator) { if(operator.equals("+")){ return number_2 + number_1; } else if(operator.equals("-")){ return number_2 - number_1; } else if(operator.equals("/")){ return number_2 / number_1; } else if(operator.equals("*")){ return number_2 * number_1; } else{ return 0; } } } if i give the code the following calculation to do: [3.0, 2.0, /, 8.0, 3.0, +, -, 2.0, /] it gives the following output: [1.5, 8.0, 3.0, +, -, 2.0, /] [1.5, 11.0, -, 2.0, /] java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double So the error occurs when processing [1.5, 11.0, -, 2.0, /] However if i initially give it the following calculation to do: [1.5, 11.0, -, 2.0, /] It gives the correct answer: [1.5, 11.0, -, 2.0, /] [-9.5, 2.0, /] [-4.75] Could anyone help with this :) p.s. sorry for the long question
tagged with: java
type: Question
tagged with: rpn
tagged with: casting
score: 0
has answer: http://stackoverflow.com/a/20718791

http://stackoverflow.com/comment/31154693
type: Comment
has text: Ok. now, where is the "section number"? Are you getting it inside `dummyTextView`?
type: QuestionComment
comment on: http://stackoverflow.com/q/20783944
score: 0

http://stackoverflow.com/a/20797118
has comment: http://stackoverflow.com/comment/31178002
type: Answer
downvote count: 0
score: 1
has body: There is (animal as Elephant).UseTrunk(), same ordering and same number of parentheses. But I still prefer the regular casting. It comes from C or even earlier, so yes, historical reasons.
answers question: http://stackoverflow.com/q/20797060
upvote count: 1

http://stackoverflow.com/a/21124189
upvote count: 4
downvote count: 0
has body: This issue was actually a little misleading. The reason for simple qr codes with number sequences failing was that their patterns were bigger, as the code contained less information. URL QR codes had more information and thus a higher resolution and smaller "patterns". The source of the issue was that the webcam I was testing with was extremely sensitive to focus issues (or chromatical aberration, I do not know), so QR codes with low resolution had to be moved FURTHER away from the webcam in order to be read correctly, than URL QR codes... This issue was only this significant with my development PC's Asus webcam, all other webcams I tried basically worked with all my test QR codes.
answers question: http://stackoverflow.com/q/20732135
score: 4
accepted answer of: http://stackoverflow.com/q/20732135
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/78890863
type: AnswerComment
comment on: http://stackoverflow.com/a/37922722
type: Comment
score: 3
has text: 1 is not a prime number, adjust your sample.

http://stackoverflow.com/comment/31249259
has text: Okay, I have fixed the error. It wasn't Intent data's fault but my code that followed. Your code works but it is simpler to call super.onActivityResult(int, int, Intent) in your main activity thread and then you just override the method in your fragment. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/20828714
score: 0
type: Comment

http://stackoverflow.com/comment/31139784
has text: PKCS5Padding is interpreted as a synonym for PKCS7Padding in the cipher specification. It is simply a historical artifact, and rather than change it Sun decided to simply pretend the PKCS5Padding means the same as PKCS7Padding when applied to block ciphers with a blocksize greater than 8 bytes.
type: Comment
comment on: http://stackoverflow.com/a/20770158
score: 37
type: AnswerComment

http://stackoverflow.com/a/20802898
downvote count: 0
has body: I think you want to use for (Enumeration&lt;? extends ZipEntry&gt; em1 = jarfile.entries(); em1.hasMoreElements();) { ZipEntry entry = em1.nextElement(); // Get a ZipEntry if(entry.getName().endsWith(".java")) { // Get the name, should probably be // ".class" notes = Collections.list(em1); // It does end with ".java". } }
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20802839
upvote count: 1

http://stackoverflow.com/comment/31123501
score: 0
type: AnswerComment
has text: Well it's not _exactly_ equivalent (as no warning is produced) but _is_ functionally equivalent
type: Comment
comment on: http://stackoverflow.com/a/20765843

http://stackoverflow.com/comment/31098265
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20737449
has text: OK, so I use in my applications a general ancestor of all pages (e.g. MyBasePage) and when I need a general functionality it is implemented here very easy, including anything after PageParameters. Also I use it the same way as you described.
score: 0

http://stackoverflow.com/a/20885794
type: Answer
answers question: http://stackoverflow.com/q/20816389
has body: If you do not want to use XSD:ANY element, so there is an example how to define more than one element by XSD:CHOICE. The abstract element you are looking for is probably JAXBElement that means any element of type T. XSD: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsd:schema targetNamespace="http://www.wicketstuff.cz/p/bossflow/examples/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:test="http://www.wicketstuff.cz/p/bossflow/examples/test"&gt; &lt;xsd:annotation&gt; &lt;xsd:documentation&gt;Test version 0.1&lt;/xsd:documentation&gt; &lt;/xsd:annotation&gt; &lt;xsd:attributeGroup name="coordinates"&gt; &lt;xsd:attribute name="x" use="optional" type="xsd:integer"&gt;&lt;/xsd:attribute&gt; &lt;xsd:attribute name="y" use="optional" type="xsd:integer"&gt;&lt;/xsd:attribute&gt; &lt;/xsd:attributeGroup&gt; &lt;xsd:attributeGroup name="size"&gt; &lt;xsd:attribute name="width" use="optional" type="xsd:integer"&gt;&lt;/xsd:attribute&gt; &lt;xsd:attribute name="height" use="optional" type="xsd:integer"&gt;&lt;/xsd:attribute&gt; &lt;/xsd:attributeGroup&gt; &lt;xsd:attributeGroup name="attrs"&gt; &lt;xsd:attribute name="id" use="required" type="xsd:string"&gt;&lt;/xsd:attribute&gt; &lt;xsd:attribute name="className" use="optional" type="xsd:string"&gt;&lt;/xsd:attribute&gt; &lt;xsd:attribute name="text" use="optional" type="xsd:string"&gt;&lt;/xsd:attribute&gt; &lt;/xsd:attributeGroup&gt; &lt;xsd:complexType name="Element"&gt; &lt;xsd:annotation&gt; &lt;xsd:documentation&gt;Abstract ancestor of all elements&lt;/xsd:documentation&gt; &lt;/xsd:annotation&gt; &lt;xsd:attributeGroup ref="test:attrs"&gt;&lt;/xsd:attributeGroup&gt; &lt;xsd:attributeGroup ref="test:coordinates"&gt;&lt;/xsd:attributeGroup&gt; &lt;xsd:attributeGroup ref="test:size"&gt;&lt;/xsd:attributeGroup&gt; &lt;/xsd:complexType&gt; &lt;xsd:complexType name="Ml"&gt; &lt;xsd:choice minOccurs="0" maxOccurs="unbounded"&gt; &lt;xsd:element name="button" type="test:Element"&gt…
score: 0

http://stackoverflow.com/comment/31236399
comment on: http://stackoverflow.com/a/20828565
has text: Thank you so much. Upvoted. I saw that the main activity was defined this way, but none of the posts/forums I looked at mentioned to do this for secondary/tertiary/etc activities. They just said to do it the "activity android:name=".ActivityName"></activity> way. As soon as I used this code - done. Thanks again.
score: 0
type: AnswerComment
type: Comment

linux-mint
type: Tag
tag name: linux-mint
tags question: http://stackoverflow.com/q/20716556

web-services
type: Tag
tags question: http://stackoverflow.com/q/20804805
tags question: http://stackoverflow.com/q/20838224
tags question: http://stackoverflow.com/q/20682361
tags question: http://stackoverflow.com/q/20838723
tags question: http://stackoverflow.com/q/20744955
tags question: http://stackoverflow.com/q/20828452
tags question: http://stackoverflow.com/q/20827600
tags question: http://stackoverflow.com/q/20699128
tags question: http://stackoverflow.com/q/20692167
tags question: http://stackoverflow.com/q/20747532
tags question: http://stackoverflow.com/q/20688414
tags question: http://stackoverflow.com/q/20752432
tags question: http://stackoverflow.com/q/20798541
tags question: http://stackoverflow.com/q/20761425
tags question: http://stackoverflow.com/q/20760244
tags question: http://stackoverflow.com/q/20728188
tags question: http://stackoverflow.com/q/20741405
tags question: http://stackoverflow.com/q/20680860
tags question: http://stackoverflow.com/q/20810957
tags question: http://stackoverflow.com/q/20700388
tags question: http://stackoverflow.com/q/20839020
tags question: http://stackoverflow.com/q/20680669
tags question: http://stackoverflow.com/q/20762109
tags question: http://stackoverflow.com/q/20696811
tags question: http://stackoverflow.com/q/20760359
tags question: http://stackoverflow.com/q/20709505
tags question: http://stackoverflow.com/q/20736688
tags question: http://stackoverflow.com/q/20796794
tags question: http://stackoverflow.com/q/20786034
tags question: http://stackoverflow.com/q/20783658
tags question: http://stackoverflow.com/q/20757208
tags question: http://stackoverflow.com/q/20824254
tags question: http://stackoverflow.com/q/20729694
tags question: http://stackoverflow.com/q/20741365
tags question: http://stackoverflow.com/q/20777951
tags question: http://stackoverflow.com/q/20743426
tags question: http://stackoverflow.com/q/20713121
tags question: http://stackoverflow.com/q/20801961
tags question: http://stackoverflow.com/q/20815412
tags question: http://stackoverflow.com/q/20804522
tags question: http://stackoverflow.com/q/20743858
tags question: http://stackoverflow.com/q/20846196
tags question: http://stackoverflow.com/q/20743482
tags question: http://stackoverflow.com/q/20794485
tags question: http://stackoverflow.com/q/20686351
tags question: http://stackoverflow.com/q/20795719
tags question: http://stackoverflow.com/q/20795488
tags question: http://stackoverflow.com/q/20798006
tags question: http://stackoverflow.com/q/20699078
tags question: http://stackoverflow.com/q/20689197
tags question: http://stackoverflow.com/q/20815261
tags question: http://stackoverflow.com/q/20745168
tags question: http://stackoverflow.com/q/20791116
tag name: web-services
tags question: http://stackoverflow.com/q/20814237
tags question: http://stackoverflow.com/q/20740952
tags question: http://stackoverflow.com/q/20825679
tags question: http://stackoverflow.com/q/20764644
tags question: http://stackoverflow.com/q/20800116
tags question: http://stackoverflow.com/q/20744332
tags question: http://stackoverflow.com/q/20694965
tags question: http://stackoverflow.com/q/20698135
tags question: http://stackoverflow.com/q/20731363
tags question: http://stackoverflow.com/q/20722652
tags question: http://stackoverflow.com/q/20698013
tags question: http://stackoverflow.com/q/20761977
tags question: http://stackoverflow.com/q/20848287

http://stackoverflow.com/comment/30995980
has text: I actually didn't use the design part at all! I just wrote the code. It's a very simple code. For every row in the database I wanna add a row here! how hard can that be?
comment on: http://stackoverflow.com/q/20695570
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20754628
has comment: http://stackoverflow.com/comment/31103188
has comment: http://stackoverflow.com/comment/31103139
tagged with: java
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/31103247
has comment: http://stackoverflow.com/comment/31103236
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/20754678
possible better answer: http://stackoverflow.com/a/20754780
has body: Currently, i'm just using this: for (ClassX value : listabc) { if (value.Id.equals(currentId)) { return value; } else if (value.Id.equals(defaultId)) { def = value; } } if (def != null) { return def; } return listabc.get(0); For a given currentId and defaultId, loop through the listabc, if listabc has currentId, return it, else if it has defaultId, return it, else, return the first element of the list. Notice that if listabc has both currentId and defaultId, currentId is the one which should be returned. this code looks a bit ugly, could anyone help to provide a elegant one? my brain just stop working..
has answer: http://stackoverflow.com/a/20754780
has comment: http://stackoverflow.com/comment/31103101
has comment: http://stackoverflow.com/comment/31103121
has title: Elegant way to write this kind of for loop in java
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31103105
has answer: http://stackoverflow.com/a/20754678
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/20760072
upvote count: 8
has answer: http://stackoverflow.com/a/20760293
has comment: http://stackoverflow.com/comment/31120304
tagged with: space-complexity
tagged with: recursion
type: AnsweredQuestion
has body: Consider, the case of Merge Sort on an int Array containing n elements, we need an additional array of size n in order to perform merges.We discard the additional array in the end though.So the space complexity of Merge Sort comes out to be O(n). But if you look at the recursive mergeSort procedure, on every recursive call mergeSort(something) one stack frame is added to the stack.And it does take some space, right? public static void mergeSort(int[] a,int low,int high) { if(low&lt;high) { int mid=(low+high)/2; mergeSort(a,low,mid); mergeSort(a,mid+1,high); merge(a,mid,low,high); } } My Questions is : Why don't we take the size of stack frames into consideration while calculating Merge Sort complexity ? Is it because the stack contains only a few integer variables and one reference, which don't take much memory? What if my recursive function creates a new local array(lets say int a[]=new int [n];).Then will it be considered in calculating Space complexity?
has comment: http://stackoverflow.com/comment/31116066
has comment: http://stackoverflow.com/comment/31120327
has comment: http://stackoverflow.com/comment/31120433
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20760293
score: 8
tagged with: algorithm
tagged with: arrays
has comment: http://stackoverflow.com/comment/31112275
possible better answer: http://stackoverflow.com/a/20760139
answer count: 2
has answer: http://stackoverflow.com/a/20760139
downvote count: 0
has title: Why don't we consider stack frame sizes while calculation Space Complexity of recursive procedures?
has comment: http://stackoverflow.com/comment/31112771
favorite count: 0
has comment: http://stackoverflow.com/comment/31112740
has comment: http://stackoverflow.com/comment/31120573

http://stackoverflow.com/comment/30997776
comment on: http://stackoverflow.com/q/20680377
type: Comment
type: QuestionComment
has text: `stringValue` **might** be an `Attrib`, but not necessarily. There are about five `Attrib` values, and then a sixth which is just a `String` and this variable can be anything. So it's almost, but not, an `enum'.
score: 0

http://stackoverflow.com/q/20826948
has answer: http://stackoverflow.com/a/20827218
has comment: http://stackoverflow.com/comment/42825108
has body: I am trying to send email using the javamail api and it looks like I have to install a SMTP server to get it working.I enabled the default SMTP server on IIS 6 on windows 8. I followed all the steps mentioned in the following blog for setting it up http://pdhewaju.com.np/blog/how-to-install-smtp-on-windows-8-developer-preview/. But still I am getting the following exceptions when I run the code sample given on JavaMail API's wiki page: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) at javax.mail.Service.connect(Service.java:295) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at EmailTester.main(EmailTester.java:47) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) 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 com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:321) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:237) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927) ... 7 more The code is as follows: import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class EmailTester { public static void main…
upvote count: 1
has comment: http://stackoverflow.com/comment/31233300
has comment: http://stackoverflow.com/comment/31233723
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20766044
possible better answer: http://stackoverflow.com/a/20827158
tagged with: java
has answer: http://stackoverflow.com/a/20827158
downvote count: 1
has title: JavaMail API and SMTPserver
type: Question
accepted answer: http://stackoverflow.com/a/20827218
answer count: 2
score: 0
tagged with: jakarta-mail
tagged with: email
has comment: http://stackoverflow.com/comment/31233829
has comment: http://stackoverflow.com/comment/31233401
favorite count: 0

http://stackoverflow.com/comment/31261160
score: 0
has text: yes. All the devices are supporting multicast. its working fine when its connected to a normal router hosted wifi network. and even when other devices are connected to the tethering hosting device they detect each others data packets. only the hosting device do not receive them.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20841753

http://stackoverflow.com/q/20786375
score: 2
has body: I need to store locally emails downloaded via POP3 and so I'm tring to use JavaMail Mbox Store, which is part of the JavaMail source code but not compiled. https://java.net/projects/javamail/pages/MboxStore I've followed the instructions at the end of this page, but with no luck. Here comes what the instructions says: export MACH=`uname -p` export JAVA_HOME=/usr/java cd mbox mvn cd native mvn I've changed the JAVA_HOME variable according to my environment. I get no error until the last command. The docs says that by default these are the options used by maven: mvn -Dcompiler.name=c89 \ -Dcompiler.start.options='-Xa -xO2 -v -D_REENTRANT -I${env.JAVA_HOME}/include -I${env.JAVA_HOME}/include/solaris' \ -Dlinker.name=c89 \ -Dlinker.start.options='-G' \ -Dlinker.end.options='-L${env.JAVA_HOME}/jre/lib/${env.MACH} -lmail -ljava -lc' I've changed the compiler name to gcc and removed some options unrecognized by gcc (-Xa and -x02). Unfortunately, it complains about a missing maillock.h. Do you know where I can find a complete list of dependencies? Am I doing something wrong with options? I've tried to look for any pre-compiled version, but I had no luck. I'm trying to compile on Slackware 14.1.
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29794938
tagged with: linux
type: Question
has answer: http://stackoverflow.com/a/20796579
favorite count: 0
upvote count: 2
tagged with: maven
has title: How to compile JavaMail Mbox Store on Linux?
tagged with: java
tagged with: jakarta-mail
answer count: 2

http://stackoverflow.com/a/20842448
has body: At the moment, no: there is no support for that. I suppose (thinking aloud here) I could add something like: [ProtoContract(SchemaFile="some.proto")] // this does not exist today! public class ClassA { [ProtoMember(1)] public int a { get; set; } } and have GetProto treat that as a break when resolving types - adding the necessary schema import instead. This probably isn't particularly hard - but: it doesn't exist at the moment. You would have to split the schema manually.
type: Answer
has comment: http://stackoverflow.com/comment/31262328
score: 0
answers question: http://stackoverflow.com/q/20840028

http://stackoverflow.com/comment/35469902
type: AnswerComment
comment on: http://stackoverflow.com/a/20811942
type: Comment
has text: ok sush thank, solved
score: 0

http://stackoverflow.com/a/20697591
score: 0
answers question: http://stackoverflow.com/q/20697395
type: Answer
has body: From java.nio package API: A byte buffer can be allocated as a direct buffer, in which case the Java virtual machine will make a best effort to perform native I/O operations directly upon it. Example: FileChannel fc = ... ByteBuffer buf = ByteBuffer.allocateDirect(8192); int n = fc.read(buf);

http://stackoverflow.com/comment/31255979
type: AnswerComment
comment on: http://stackoverflow.com/a/20838080
score: 0
type: Comment
has text: +1 but this question isn't answerable without an SSCCE, pressed released is a standard setting in Native OS for key repeating, Java only to use this (Native OS) property

http://stackoverflow.com/comment/31106635
score: 0
has text: add the code in your question please and format it pl
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20744387

http://stackoverflow.com/comment/31199737
type: Comment
type: QuestionComment
score: 0
has text: @Fractal see http://stackoverflow.com/questions/831716/command-to-find-information-about-cpus-on-a-unix-machine
comment on: http://stackoverflow.com/q/20808941

http://stackoverflow.com/comment/31258479
type: AnswerComment
has text: This is actually *not a good idea* since quartz would have to make lots of round-trips to the JDBCStore (=database). And as the OP added in an EDIT - the cluster option is already in use.
comment on: http://stackoverflow.com/a/20804378
type: Comment
score: 0

http://stackoverflow.com/q/20845977
has answer: http://stackoverflow.com/a/20846082
type: UnansweredQuestion
has body: The structure of my table: id int AUTO_INCREMENT PRIMARY KEY title text url text age int Here's how I am trying to save data into this table: PreparedStatement ps=con.prepareStatement("insert into table(title, url, age) values ('\"+title+\",\"+url+\",\"+age+\"')"); System.out.println("Connected database successfully.."); ps.executeUpdate(); But when I run the app, I get java.sql.SQLException: Column count doesn't match value count at row 1 I guess the problem might be in the id column, how to solve it?
has comment: http://stackoverflow.com/comment/31269165
tagged with: jdbc
tagged with: column-count
score: 2
upvote count: 2
tagged with: java
has title: java.sql.SQLException: Column count doesn't match value count at row 1
has answer: http://stackoverflow.com/a/20846052
type: Question
has answer: http://stackoverflow.com/a/66927566
tagged with: sqlexception
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31268517
favorite count: 0

http://stackoverflow.com/comment/31154953
type: AnswerComment
has text: Well, I was thinking about it too. But it will increase number of classes in twice. Ideally I want to make it without any changes in bean classes structure (or with annotations or some extra field), to make it with some specific parser changes.
type: Comment
comment on: http://stackoverflow.com/a/20783558
score: 0

http://stackoverflow.com/comment/31179689
comment on: http://stackoverflow.com/a/20797454
type: AnswerComment
score: 0
has text: Filesystem semantics are different under unix- and windows. I am pretty sure OP is using unix (".sh" file terminations), and you seem to be using windows.
type: Comment

http://stackoverflow.com/comment/31231294
type: Comment
has text: @MihaiMaruseac I don't think so :(
comment on: http://stackoverflow.com/q/20826003
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31080097
comment on: http://stackoverflow.com/a/20734366
type: Comment
has text: Apologies for the late response, I fell asleep. :P Anyway, thank you for your strategy! Funny enough, that was how I implemented it at first. But my solutions were wrong and I lost track of what was happening with the recursions, so I gave it another approach. I still have the algorithm for the permutations, so I could give this another try. I actually thought that using this method, I would have to use all 6 numbers but I overlooked something so simple as recursively going through the operators..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31011956
type: Comment
has text: Sir, Can I print i value ? i.e on place of 11 it's 1 then on place of 9 it's2 and on place of 7 it's 3.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20704803

http://stackoverflow.com/comment/31192853
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20805123
has text: Thank you Peeskillet, i removed it
score: 0

http://stackoverflow.com/a/20795675
has comment: http://stackoverflow.com/comment/31175736
has comment: http://stackoverflow.com/comment/31247544
score: 2
has comment: http://stackoverflow.com/comment/31203509
upvote count: 2
has body: And if this is possible it is a security risk too, because typically information regarding sessions on a website will be stored in a cookie. If you are able to read cookies on other domains that is a security breach.
answers question: http://stackoverflow.com/q/20795554
has comment: http://stackoverflow.com/comment/58281948
downvote count: 0
type: Answer

http://stackoverflow.com/a/20679786
answers question: http://stackoverflow.com/q/20679373
type: Answer
downvote count: 0
score: 1
has body: When a() is a synchronized method, f.a() literally means: synchronized(f){ f.a(); } So in this case a lock would happen for object monitor f. In your case you would require a second object to create a deadlock, I don't think it's possible to create a deadlock with a single object monitor. A typical deadlock pattern is when an order of lock acquisition is not being maintained, i.e. when this happens in two different threads: synchronized(a){ synchronized(b){ ... } } // and synchronized(b){ synchronized(a){ ... } }
upvote count: 1

header
type: Tag
tags question: http://stackoverflow.com/q/20712039
tags question: http://stackoverflow.com/q/20827504
tags question: http://stackoverflow.com/q/20791116
tag name: header

http://stackoverflow.com/a/29448506
type: Answer
answers question: http://stackoverflow.com/q/20762720
has body: What fixed it in my case was to change the location of my color.xml As I copied it from some other project of mine and pasted it in the new project, Android Studio placed it in the v21 folder, meaning my emulator (v19) could not reach the resource file color.xml. I did the following to fix it: Right click on color.xml. Select Refactor > Move. On the dialog that open, removed the suffix -v21. Now, my "old" emulator was able to read the file. I hope it helps..
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/61093923
downvote count: 0

http://stackoverflow.com/comment/31165600
has text: I'm not sure how your entities are, you don't post the code, but I think you're trying to find a CustomerProfile by its id (That's what the load method does) so first check if the customer.getProfile() returns the Object CustomerProfile you has already get the object, do it in a session context, or if you are trying to find an object given it's primary key you should do this "CustomerProfile cust_info = (CustomerProfile) session.load(CustomerProfile.class, customer.getProfileId());" or "CustomerProfile cust_info = (CustomerProfile) session.load(CustomerProfile.class, new Integer(135));",
type: Comment
comment on: http://stackoverflow.com/a/20789156
score: 0
type: AnswerComment

http://stackoverflow.com/a/20758736
has body: Global Roboto light for TextView and Button classes. Just select the style you want from list themes.xml then create your custom style based on the original. At the end apply the style as the theme of the application.
answers question: http://stackoverflow.com/q/20758427
score: 0
type: Answer

http://stackoverflow.com/q/20820900
has title: Sending a Mat object over socket from c++ to Java
type: Question
tagged with: opencv
has body: I'm interested on sending a video stream from a C++ server to a Java client. The C++ server is written with boost/asio. I was thinking of using opencv in order to easily connect to a computer's usb camera. However, I'm having troubles with sending Mat object over socket. The only way ,that I encountered, to do so is this way: Mat frame; ... int imgSize = frame.total()*frame.elemSize(); bytes = send(clientSock, frame.data, imgSize, 0)) but I cannot send it with boost this way, since it has to be in one of these forms: http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/basic_raw_socket/send_to.html So I thought of converting frame.data ,imgSize to string, and sending a container of these two buffers, but I don't think this is the right way. And even if it is, how can I "rebuild" the image in the Java client? Any idea would be appreciated!
tagged with: boost-asio
answer count: 2
accepted answer: http://stackoverflow.com/a/20922005
score: 2
has comment: http://stackoverflow.com/comment/31227692
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/20841435
has comment: http://stackoverflow.com/comment/31231371
has comment: http://stackoverflow.com/comment/31228969
tagged with: c++
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20841435
linked to: http://stackoverflow.com/q/17746688
tagged with: java
has answer: http://stackoverflow.com/a/20922005
linked to: http://stackoverflow.com/q/15274713

http://stackoverflow.com/comment/31083021
has text: Note: you can remove the `BufferedReader` from your answer as it's no longer needed.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20743306

http://stackoverflow.com/comment/31220743
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20820289
score: 0
has text: @SotiriosDelimanolis: I was personally thinking that one could mock the `Scanner` instance, although that would mean it'd make the test easier if it was passed in. It's *possible* to test this, but it's not *pretty*.

http://stackoverflow.com/q/20837270
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20837389
linked to: http://stackoverflow.com/q/15248265
score: 0
has body: I am integrating a code for how to capture image and how to get image from gallery.Here is my source code. its working fine for individual but it didn't show the imageview when upload image from gallery. please help me private static int RESULT_LOAD_IMAGE = 1; private static final int CAMERA_REQUEST = 1888; private ImageView imageView,imageView1; private static final int SELECT_PICTURE = 1; String selectedPath; private String selectedImagePath; Uri selectedImageUri; //ADDED private String filemanagerstring; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.imageView = (ImageView)this.findViewById(R.id.imageView1); Button photoButton = (Button) this.findViewById(R.id.button1); photoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_REQUEST); } }); } ShutterCallback shutterCallback = new ShutterCallback() { public void onShutter() { //Log.d(TAG, "onShutter'd"); } }; protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAMERA_REQUEST &amp;&amp; resultCode == RESULT_OK) { Bitmap photo = (Bitmap) data.getExtras().get("data"); imageView.setImageBitmap(photo); } Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); } protected void onActivityResult1(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[]…
answer count: 1
has title: How to capture image and how to get image from gallery in android
has comment: http://stackoverflow.com/comment/31252212
has comment: http://stackoverflow.com/comment/31252176
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31252152

http://stackoverflow.com/a/20723077
has comment: http://stackoverflow.com/comment/31045964
has comment: http://stackoverflow.com/comment/31049149
type: Answer
has comment: http://stackoverflow.com/comment/31052311
has comment: http://stackoverflow.com/comment/31045938
has comment: http://stackoverflow.com/comment/31046014
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31050160
answers question: http://stackoverflow.com/q/20722835
has body: There are several things that stand out BufferedReader#readLine is a blocking method and may not respond to the interrupted flag of the current thread (and unblock) You've surrounded your entire logic in a single try-catch blocking, meaning that if InterruptedException is thrown, you skip the entire portion of the code that you are trying to use to dispose of the process. Something like this might be a slightly better approach. InputStream#read is still your Achilles heel, but because I'm now check isCancelled BEFORE trying to read something, it's less likely to cause a great deal of issue InputStream is = null; Process p = null; try { ProcessBuilder pb = new ProcessBuilder(commands); pb.redirectErrorStream(true); p = pb.start(); StringBuilder sb = new StringBuilder(128); is = p.getInputStream(); int in = -1; while (!isCancelled() &amp;&amp; (in = is.read()) != -1) { sb.append((char)in)); if (((char)in) == '\n') { publish(sb.toString()); sb.delete(0, sb.length()); } } if (!isCancelled()) { status = p.waitFor(); } else { p.destroy(); } } catch (IOException ex) { ex.printStackTrace(System.err); } catch (InterruptedException ex) { ex.printStackTrace(System.err); try { p.destroy(); } catch (Exception exp) { } } finally { try { is.close(); } catch (Exception exp) { } // Make sure you are re-syncing this to the EDT first... closeWindow(); } (nb Typed directly, so I've not tested it)
has comment: http://stackoverflow.com/comment/31045879
upvote count: 1
has comment: http://stackoverflow.com/comment/31048383
has comment: http://stackoverflow.com/comment/31050223
has comment: http://stackoverflow.com/comment/31045614
has comment: http://stackoverflow.com/comment/31063132

http://stackoverflow.com/comment/31064825
type: Comment
comment on: http://stackoverflow.com/q/20705162
type: QuestionComment
has text: @VextoR `myNode.outerHTML`
score: 0

http://stackoverflow.com/a/20837191
has body: You need to escape all backslashes, so special characters appear "double escaped" - once for the String, once for the regular expression.
answers question: http://stackoverflow.com/q/20837137
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/20751867
tagged with: static
upvote count: 30
answer count: 5
possible better answer: http://stackoverflow.com/a/20752110
tagged with: factory
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20752110
tagged with: syntax
has answer: http://stackoverflow.com/a/20751875
accepted answer: http://stackoverflow.com/a/20752703
tagged with: java
type: Question
has title: Java Generics and Static Factory Methods -- Syntax
has body: Here's what I've got: public class Node&lt;T&gt; { // instance variables private Node&lt;T&gt; next; private T data; // construct with data private Node(T data){ next = null; this.data = data; } // construct without data private Node(){ next = null; this.data = null; } // static factory method public static &lt;T&gt; Node&lt;T&gt; newNodeWithData(T data){ return new Node&lt;T&gt;(data); } // static factory method public static &lt;T&gt; Node&lt;T&gt; newNode(){ return new Node&lt;T&gt;(); } ... } My question really just about the syntax of generics coupled with that of a static factory method. I don't really understand why we put the &lt; T > before the return type in the method declaration. Is it kind of like typecasting? Any help would be much appreciated!
has answer: http://stackoverflow.com/a/20751928
downvote count: 0
has answer: http://stackoverflow.com/a/20752703
tagged with: generics
score: 30
has answer: http://stackoverflow.com/a/22697263
favorite count: 0

http://stackoverflow.com/q/20790560
upvote count: 1
has comment: http://stackoverflow.com/comment/31166514
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31166416
has comment: http://stackoverflow.com/comment/31166573
has title: java.lang.OutOfMemoryError and GC overhead limit
score: 0
has body: I have got 5 million tuples and insert mysql from java. But I get an error out of memory in eclipse. I configured eclipse.ini last lines like that; -XX:MaxPermSize=1024m -Xms512m -Xmx1024m But I get an error again. What should I do? Thanks.
has comment: http://stackoverflow.com/comment/31166590
favorite count: 0
has comment: http://stackoverflow.com/comment/31166622
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/31166306
has comment: http://stackoverflow.com/comment/31166404
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/31025530
score: 0
type: AnswerComment
type: Comment
has text: No, I would not say so. I don't think it's problematic to use real objects, especially when it makes testing significantly easier. For an object like File that has been heavily tested and used in nearly every Java app (so it probably works pretty well) AND has all sorts of OS specific stuff associated with it, no harm in using a real file.
comment on: http://stackoverflow.com/a/20712102

http://stackoverflow.com/comment/31188877
score: 2
has text: One tip is to see how the information is getting onto the page. If the page is dynamically being loaded and the information is being presented though a JavaScript function, you could just parse the file the JavaScript is loading. It is much simpler to parse a JSON file than it is to parse a verbose and wordy HTML document.
comment on: http://stackoverflow.com/q/20803163
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20816451
answer count: 1
tagged with: rest
type: AnsweredQuestion
has title: REST - Server Throwing Exception when Mapping JSON Request with Extra Undefined Parameters to Java Object
has comment: http://stackoverflow.com/comment/31213391
tagged with: java
accepted answer: http://stackoverflow.com/a/20829030
type: Question
tagged with: jersey
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/20829030
score: 0
has body: I'm using a RESTFUL J2EE Web Server; when my method in a resource class is consuming JSON and a there is a JSON request with extra parameters which are not defined in my java mapping object, the server throws exception. The problem is: I DON'T WANT THE SERVER TO THROW EXCEPTION! - I just want the server to ignore the request and return an error code like '400 Bad Request'! My method: @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createUser(final UserCreateRequest request) { return request.getHandler().handle(); } My Simplified Java Class: public final class UserCreateRequest extends BaseRequest { @JsonProperty("username") private String username; @JsonProperty("password") private String password; public final String getUsername() { return username; } public final void setUsername(String username) { this.username = username.trim().toLowerCase(); } public final String getPassword() { return password; } public final void setPassword(String password) { this.password = password.trim(); } @Override @JsonIgnore public BaseRequestHandler getHandler() { return new UserCreateHandler(this); } } Sample wrong JSON request: { username: "test", password: "1234", name: "hello" } In this sample the parameter 'name' is undefined!

http://stackoverflow.com/comment/31002381
type: Comment
score: 1
has text: @Stroboskop If you don't have fields that are good for calculating `equals` and `hashCode`, default is good. If you don't have the key fields, the each instance is distinct.
comment on: http://stackoverflow.com/a/20686217
type: AnswerComment

http://stackoverflow.com/q/20758168
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31344477
answer count: 0
tagged with: java
type: Question
tagged with: liferay
score: 0
has comment: http://stackoverflow.com/comment/31317964
tagged with: portlet
has body: I've got non-instanceable portlet on liferay portal 6.1.20-ee-ga2. After startup I cache some data from DB for better performance. I know, that data may be updated once a day, at 23 PM. How can I easily update data in cache? Is it possible to reinit portlet automatically, every day after 23 PM, or should I wrote updating cache manually? (With scheduler or something like that)
has comment: http://stackoverflow.com/comment/31139067
has title: Scheduled portlet redeployment

http://stackoverflow.com/comment/31190108
comment on: http://stackoverflow.com/q/20803877
has text: If the two are in the same file, delete the `public` from `Plane` A file can't have two `public` classes
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20715825
has comment: http://stackoverflow.com/comment/31033312
has comment: http://stackoverflow.com/comment/31033710
score: 0
has body: There are multiple reasons your current attempt is failing. The first is that this line: if (column.getCodigo() != codigo) { Is testing for object equivalence between Integers, not value equavalence between ints. If you want to compare Integers, you have to use the equals method: if (!column.getCodigo().equals(codigo)) { However, if getCodigo returns an int and getSelectedCustomer returns an int[] then this line should be changed instead: for(int codigo : this.getSelectedCustomer()){ Because you didn't need to use Integer in the first place. Secondly, this line attempts to remove auxRemoColumnKeys itself so you probably mean removeAll: this.getColumnCustomer().remove(auxRemoColumnKeys); Lastly, your logic is generally flawed. It basically says "for each element in getColumnCustomer, if getCodigo is not equal to all of getSelectedCustomer remove it". I don't think that's what you've intended. This is a modified loop that uses the same "add to a list and remove the list items" procedure but the logic will work: List&lt;ValidColumnKey&gt; auxRemoColumnKeys = new ArrayList&lt;ValidColumnKey&gt;(); int[] selected = this.getSelectedCustomer(); for (ValidColumnKey column : this.getColumnCustomer()) { int i = 0; for ( ; i &lt; selected.length; i++) { /* note: if getCodigo returns an Integer change this check to * "if (column.getCodigo().equals(selected[i])) {" */ if (column.getCodigo() == selected[i]) { break; } } /* this says "if the search loop did not break early" */ if (i == selected.length) { auxRemoColumnKeys.add(column); } } this.getColumnCustomer().removeAll(auxRemoColumnKeys);
has comment: http://stackoverflow.com/comment/31033773
has comment: http://stackoverflow.com/comment/31033475
type: Answer
has comment: http://stackoverflow.com/comment/31033145
has comment: http://stackoverflow.com/comment/31033752
answers question: http://stackoverflow.com/q/20715451

http://stackoverflow.com/a/20781768
downvote count: 0
has comment: http://stackoverflow.com/comment/31153224
has body: I think the reason you can not access the remote mysql may be due to the remote access restriction in my.cnf please check the line bind-address: is set to 127.0.0.1 under this restriction, you can not connect remotely with that mysql server; to solve this, you need to change this line to: bind-address: 0.0.0.0 in addition you should specify the port for connection as below: String URL = "jdbc:mysql://192.168.11.157:3306/DB_name"; because mysql will connect port 3306 in default. wish my answer could help you!
score: 4
has comment: http://stackoverflow.com/comment/31155237
answers question: http://stackoverflow.com/q/20781588
has comment: http://stackoverflow.com/comment/31158306
type: Answer
has comment: http://stackoverflow.com/comment/31154279
upvote count: 4
has comment: http://stackoverflow.com/comment/31156445

tiles
tags question: http://stackoverflow.com/q/20826869
tag name: tiles
type: Tag
tags question: http://stackoverflow.com/q/20801347

http://stackoverflow.com/q/20796134
type: Question
has answer: http://stackoverflow.com/a/20796205
accepted answer: http://stackoverflow.com/a/20796205
possible better answer: http://stackoverflow.com/a/20796664
has title: importing sqlite database from asset
score: 0
answer count: 2
tagged with: sqlite
has body: I am beginner of android development with due search i was able to make a working sqlite database but i would like to import pre-made database from asset folder. though i have found tutorial and code for it but facing problem of integration in my code. can any one help me to provide coding help with this class:- Wfdaadapter.java public class Wfdaadapter { public static final String KEY_ROWID = "_id"; public static final String KEY_FD1 = "fd1"; public static final String KEY_FD2 = "fd2"; public static final String KEY_FD3 = "fd3"; public static final String KEY_FD4 = "fd4"; public static final String KEY_FD5 = "fd5"; private static final String TAG = "CountriesDbAdapter"; private DatabaseHelper mDbHelper; private SQLiteDatabase mDb; private static final String DATABASE_NAME = "iigdatabase"; private static final String SQLITE_TABLE = "iigimport"; private static final int DATABASE_VERSION = 1; private final Context mCtx; private static final String DATABASE_CREATE = "CREATE TABLE if not exists " + SQLITE_TABLE + " (" + KEY_ROWID + " integer PRIMARY KEY autoincrement," + KEY_FD1 + "," + KEY_FD2 + "," + KEY_FD3 + "," + KEY_FD4 + "," + KEY_FD5 + "," + " UNIQUE (" + KEY_FD1 + "));"; private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { Log.w(TAG, DATABASE_CREATE); db.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + SQLITE_TABLE); onCreate(db); } } public Wfdaadapter(Context ctx) { this.mCtx = ctx; } public Wfdaadapter open() throws SQLException { mDbHelper = new DatabaseHelper(mCtx); mDb = mDbHelper.getWritableDatabase(); return this; } public void close() { if (mDbHelper != null) { mDbHelper.close(); } } …
has answer: http://stackoverflow.com/a/20796664
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31176412

http://stackoverflow.com/a/20778377
score: 7
has comment: http://stackoverflow.com/comment/45336698
upvote count: 7
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20767241
accepted answer of: http://stackoverflow.com/q/20767241
type: Answer
has body: I have found a solution that works. It still has some minor glitches, but mainly with unimportant details. Here is what I have now, and it seems to be working. class Task extends SwingWorker&lt;Void, Void&gt;{ @Override public Void doInBackground(){ setProgress(0); //Create Backup Directory Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy_HMMSS"); String timestamp = sdf.format(date); backupDir = backupDrive + ":\\" + "Backup_" + timestamp; File backupDirectory = new File(backupDir); backupDirectory.mkdir(); //Copy Files //Main directories String pics = mainDrive + ":\\Users\\" + username + "\\Pictures\\"; String docs = mainDrive + ":\\Users\\" + username + "\\Documents\\"; String vids = mainDrive + ":\\Users\\" + username + "\\Videos\\"; String musc = mainDrive + ":\\Users\\" + username + "\\Music\\"; //Backup directories String bkPics = backupDir + "\\Pictures\\"; String bkDocs = backupDir + "\\Documents\\"; String bkVids = backupDir + "\\Documents\\"; String bkMusc = backupDir + "\\Pictures\\"; String[] directories = {pics, docs, vids, musc}; String[] bkDirectories = {bkPics, bkDocs, bkVids, bkMusc}; //Loop through directories and copy files for (int i = 0; i &lt; directories.length; i++){ File dir = new File(directories[i]); File dest = new File(bkDirectories[i]); for(File file: dir.listFiles()){ try{ if(file.isFile()){ FileUtils.copyFileToDirectory(file, dest); txtCopiedDirs.append(file.getAbsolutePath() + "\n"); } else if (file.isDirectory()){ FileUtils.copyDirectoryToDirectory(file, dest); txtCopiedDirs.append(file.getAbsolutePath() + "\n"); } if(getDirSize(file) &gt;= ONE_PERCENT){ currentPercent = getDirSize(file)/ONE_PERCENT; progressBar.setValue((int)currentPercent); currentSize = 0; } else { currentSize = currentSize + getDirSize(file); if(currentSize &gt;= ONE_PERCENT){ currentPercent = currentSize/ONE_PERCENT; currentPercent++; progressBar.setValue((int)currentPercent); currentSize = 0; } } } catch (IOException e){ e.print…

http://stackoverflow.com/comment/31206730
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20812643
type: Comment
has text: [prime factorization example](http://stackoverflow.com/questions/4273368/prime-factorization-program-in-java)

http://stackoverflow.com/comment/31170730
comment on: http://stackoverflow.com/a/20792942
type: Comment
has text: evict is the better solution but i'm using JPA (entityManager) and i don't have this tool, just clear().
score: 0
type: AnswerComment

http://stackoverflow.com/a/20765961
has comment: http://stackoverflow.com/comment/31123265
has comment: http://stackoverflow.com/comment/31122976
accepted answer of: http://stackoverflow.com/q/20765850
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20765850
has comment: http://stackoverflow.com/comment/31123272
has body: You have forgotten about permissions over there. &lt;uses-permission&gt; needs to be there to access restricted data and hardware of the phone. For your case, you must use following permissions: 1. ACCESS_NETWORK_STATE 2. INTERNET
has comment: http://stackoverflow.com/comment/31123375
type: Answer
has comment: http://stackoverflow.com/comment/31123179
score: 2
has comment: http://stackoverflow.com/comment/31122913
upvote count: 2

http://stackoverflow.com/comment/31144737
comment on: http://stackoverflow.com/q/20778012
has text: Are you asking what the difference is between reference equality and value equality? Use `==` for reference equality, use `equals`, implemented correctly, for value equality.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31124007
has text: because in some place `executorService.shutdown()` executed :)
score: 0
comment on: http://stackoverflow.com/q/20765949
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21333979
accepted answer of: http://stackoverflow.com/q/20790704
has body: The problem was solved by change Jersey JAXB default implementation to MOXy. Ok, I think, I can delete my question, because all problems, that I had duirind investigation of my issue, have been already answered on several other questions.
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20790704

http://stackoverflow.com/comment/31000167
has text: why you have closing bracket like this `});`?
score: 0
comment on: http://stackoverflow.com/q/20698071
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/30972918
type: Comment
has text: great thats what I've needed, a double array
comment on: http://stackoverflow.com/a/20682985
type: AnswerComment
score: 0

http://stackoverflow.com/a/30290782
has body: In my case, i just changed the name of variable and the target folder was not reflecting the changes. So when I compile and redeploy it worked for me.
type: Answer
answers question: http://stackoverflow.com/q/20798696
score: 0

http://stackoverflow.com/comment/31077599
has text: I tried something like: [[a-zA-Z0-9/: +]+\]\s"[a-zA-Z0-9._/?&=-]+"\s[a-zA-Z0-9-]+. But this returns single recognized pattern when I use Java's Pattern and Matcher classes. I want to get 3 distinct groups.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20740767

http://stackoverflow.com/comment/31064419
has text: You should use HH, not hh in SimpleDateFormat-pattern (hour from 0 to 23).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20733276

http://stackoverflow.com/a/20790524
has comment: http://stackoverflow.com/comment/31166634
has body: It works for me on a PC. Did you make the eclipse project a maven project? If you do that then you can use org.glassfish.jersey.bundles jaxrs-ri version 2.5 (or whichever) as a dependency in your pom and then when you do run->maven-install from eclipse it will build a war file with all the necessary dependencies in it.
type: Answer
has comment: http://stackoverflow.com/comment/31166779
answers question: http://stackoverflow.com/q/20784531
has comment: http://stackoverflow.com/comment/31166556
has comment: http://stackoverflow.com/comment/31168754
has comment: http://stackoverflow.com/comment/31167623
score: 0

http://stackoverflow.com/a/20728913
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31104788
type: Answer
has comment: http://stackoverflow.com/comment/31114646
has comment: http://stackoverflow.com/comment/31071514
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20728451
has comment: http://stackoverflow.com/comment/31107743
accepted answer of: http://stackoverflow.com/q/20728451
has comment: http://stackoverflow.com/comment/31104683
upvote count: 3
has body: I think this is just a Threading problem. Use this code: public class Test2 { public static final Object LOCK = new Object(); static int count = 0; public static void main(String[] args) { try { System.out.println(new Date()); final ApplicationServiceClient app = WSClient.getClient("http://192.168.1.15:81/az-server", ApplicationServiceClient.class); final int max=250; for (int i = 1; i &lt;= max; i++) { Thread t = new Thread() { public void run() { synchronized (LOCK) { app.verifyToken("7056451004350030976"); } System.out.print(count++); System.out.print(", "); if (count &gt;= max) System.out.println("\n" + new Date()); } }; t.start(); } } catch (Exception ex) { ex.printStackTrace(); } } } This method (verifyToken) must be thread safe, otherwise you will have so many problems using this method inside threads.

http://stackoverflow.com/comment/31090882
type: AnswerComment
score: 0
type: Comment
has text: Thank you for giving the reference, It helped-:)
comment on: http://stackoverflow.com/a/20747987

http://stackoverflow.com/q/20775165
tagged with: java
score: 23
has body: Yesterday I came across HikariCP and spent the whole night studying it. I'm really impressed with the amount of detail and effort put into fine tuning its implementation and design. Straight to the point, I could not determine how it actually deals with connections that are checked back into the pool with their autoCommit set to false, while neither commit() nor rollback() is issued on them, for example, due to an exception. This potentially can be the source of many serious transactional problems for the next requester that expects a fresh connection but unfortunately receives this connection with its dangling transaction state. While C3P0 and Tomcat's JDBC pool have some of these so called Knobs for this very purpose (through configuration or interception), I could not find anything in HikariCP's documentation or support group. Please correct me if I'm wrong, but writing a simple unit test showed me that the pool does nothing about this. I need to know if this observation is actually correct and I'm not missing anything about it. Also, if there is any plan for addressing this in HikariCP since it is critical for me. Thanks.
type: Question
has title: How does HikariCP handle incomplete JDBC transactions?
tagged with: hikaricp
has comment: http://stackoverflow.com/comment/31139033
tagged with: jdbc
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/20776035
favorite count: 0
upvote count: 23
type: AnsweredQuestion
tagged with: connection-pooling
tagged with: transactions
accepted answer: http://stackoverflow.com/a/20776035

http://stackoverflow.com/a/20717150
has body: I would use a trie https://community.oracle.com/thread/2070706. The example here explains it well. You can specify a prefix and get all the words by traversing the tree
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20717111

openide
type: Tag
tag name: openide
tags question: http://stackoverflow.com/q/20695059

http://stackoverflow.com/q/20758704
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31110081
possible better answer: http://stackoverflow.com/a/20758845
score: -1
has body: Help me to fill an array Final[] in a way that values of array Even[] stores on even indexes of Final[] &amp; of Array Odd[] fills on Final[] odd indexes.. public class Test { public static void main(String[] args) { A obj = new A(); obj.run(); } } class A { int temp, b; public void run(){ Double[] ResultList = {1.1,2.2,3.33,4.1,5.0,6.7777}; //Dummy Values Double[] Final = new Double[ResultList.length]; Double[] Even = {11.989898,22.545454,33.5454,44.444,55.5647,66.11111}; //Dummy Values Double[] Odd = {11.545454,22.5454,33.444,44.5647,55.989898,66.11111}; //Dummy Values for(int a = 0; a &lt; ResultList.length ; a+=2) { if(temp != 0) { b = temp; System.out.println("Outer Temp B: "+temp+"\n"); } for(b = 0; b &lt;= a; b++) //Want to stop this loop in a Manner That b=0,1,2,3,4... { temp = b; System.out.println("Inner Temp: "+b+"\n"); Final[a] = Even[b]; Final[a+1] = Odd[b]; if(b != 0) //Trying this to stop thsi loop from repetition { b = a+1; System.out.println("Inner B: "+b+"\n"); } } } for(int i = 0; i &lt; ResultList.length; i++) System.out.print(Final[i]+" "); } } OUTPUT REQUIRED : {11.989898, 11.545454, 22.545454, 22.5454, 33.5454, 33.444, 44.444, 44.5647, 55.5647, 55.989898, 66.11111, 66.11111}
has answer: http://stackoverflow.com/a/20758835
accepted answer: http://stackoverflow.com/a/20758835
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/31110042
favorite count: 0
has comment: http://stackoverflow.com/comment/31110142
has answer: http://stackoverflow.com/a/20758845
upvote count: 0
has title: FIll Array with two Different Array sequentially
tagged with: java
has comment: http://stackoverflow.com/comment/31109955
type: Question

http://stackoverflow.com/a/20708479
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20708418
type: AcceptedAnswer
downvote count: 0
has body: Check your preferences.xml or your strings.xml for duplicate keys. It seems that both your preference keys are "password".
accepted answer of: http://stackoverflow.com/q/20708418
type: Answer

http://stackoverflow.com/comment/31081847
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/20743151
type: Comment
has text: Yes, a plain non-volatile `boolean` is all you need, and should use. If you make it volatile, you can take the additional comfort of resetting it from the child thread.

http://stackoverflow.com/comment/31032302
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20712096
type: AnswerComment
has text: Let the patcher just replace the old class file with the recompiled one - the source is not requred on any computer.

http://stackoverflow.com/comment/30967916
type: AnswerComment
has text: Yes, you should do something like `int secSize = in.nextInt(); sec = new int [secSize]`. Maybe you should rethink it. Or maybe the sec is a known array, so it shall be initialized elsewhere, or you shall initialize it here.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20680246

http://stackoverflow.com/q/20802794
tagged with: file-io
has comment: http://stackoverflow.com/comment/31188063
type: UnansweredQuestion
has body: The following program is meant to read from a file:- import java.util.*; import java.io.*; import java.lang.*; public class file_read { private Scanner input = new Scanner(System.in); private Scanner fileinput; public void open() // [1] { try { String filename = input.next(); fileinput = new Scanner(new File(filename+".txt")); // [2] } catch(Exception e) { System.out.println("opening error."); } } public void read() { // some task to read the file } public void closeFile() { // closing the file } } Problem lies with [1] and I think that the statement [2] is creating the problem. If I replace the filename+".txt" with the actual filename, everything runs fine. I am unable to pinpoint the reason. Please help.
has title: Unable to accept filenames as arguments for reading from (or writing to) a file
answer count: 0
has comment: http://stackoverflow.com/comment/31188115
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31189980
has comment: http://stackoverflow.com/comment/31188507
type: Question
has comment: http://stackoverflow.com/comment/31188281
has comment: http://stackoverflow.com/comment/31189901
has comment: http://stackoverflow.com/comment/31190294
has comment: http://stackoverflow.com/comment/31188017
has comment: http://stackoverflow.com/comment/31188113

http://stackoverflow.com/comment/31063676
comment on: http://stackoverflow.com/a/20732674
has text: @MarkoTopolnik: very true. In that situation I would look towards creating a class that holds a few fields and represents data necessary for packets to handle whatever it is they have to do. That way the client is loosely coupled and you've only sent the data that is actually needed (I don't imagine it will be much different for each packet). `Client` should prepare the variables needed in a `Packet` to do its operations, that way there's no coupling at all. Your method could then return a class `PacketResult` which could hold all the information to continue in `Client`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20710501
has comment: http://stackoverflow.com/comment/31022581
answer count: 1
has body: So I read a few threads that had tool tips working and tried to work off that to no avail. import java.awt.event.MouseEvent; public String getToolTipText(MouseEvent e) { String tip = "tommy likes trucks"; java.awt.Point p = e.getPoint(); int rowIndex = FursJTable.rowAtPoint(p); int colIndex = FursJTable.columnAtPoint(p); int realColumnIndex = FursJTable.convertColumnIndexToModel(colIndex); //if (description[realColumnIndex] = null || description[realColumnIndex] = "") { // tip = null; //} else { // tip = description[realColumnIndex]; //} return tip; } The if statement should just pull a string from an array I will have set up but even if I just set the tip at the beginning of the code it doesn't show a tooltip anywhere in my jtable. All help is appreciated. :) I also need the tooltip to be across the entire row. but this still doesn't matter yet because i can't get the tooltip to appear anywhere.
has title: I don't know how to get my tooltips to work
tagged with: tooltip
has comment: http://stackoverflow.com/comment/31023785
has comment: http://stackoverflow.com/comment/31026317
type: UnansweredQuestion
tagged with: jtable
type: Question
has answer: http://stackoverflow.com/a/20711404
tagged with: netbeans-7.4
has comment: http://stackoverflow.com/comment/31023519
score: 0
tagged with: java

http://stackoverflow.com/q/20811697
has body: From the book "java concurrency in practice" , there is a statement - > if the task is not responsive to interruption, timedRun will not return until the task finishes, which may be long after the desired timeout private static final ScheduledExecutorService cancelExec = ...; public static void timedRun(Runnable r, long timeout, TimeUnit unit) { final Thread taskThread = Thread.currentThread(); cancelExec.schedule(new Runnable() { public void run() { taskThread.interrupt(); } }, timeout, unit); r.run(); } Does that means that the interrupt() function might get stuck? What may cause the interrupt() to stuck. It is just setting the isInterrupted flag of the targeted thread. I foresee unless and until any process might starve the process that is calling the interrupt(), i don't think the interrupt function will get stuck.
tagged with: multithreading
has answer: http://stackoverflow.com/a/20811784
accepted answer: http://stackoverflow.com/a/20811784
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/33301852
tagged with: java
possible better answer: http://stackoverflow.com/a/20811833
has answer: http://stackoverflow.com/a/20811833
has title: Interrupting a unresponsive thread
has answer: http://stackoverflow.com/a/20812128
type: Question
score: 0
answer count: 4

http://stackoverflow.com/comment/31126694
comment on: http://stackoverflow.com/q/20762495
has text: Note that the client is sending an *empty* CertificateChain. This means it couldn't find a certificate that matches the constraints expressed in the CertificateRequest. Does the client have an RSA or DSS certificate?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/80262880
comment on: http://stackoverflow.com/a/20700183
has text: I am having a `gradle.build` file - What is these "app gradle file" and the "module gradle"?
type: AnswerComment
type: Comment
score: 16

http://stackoverflow.com/q/20697968
has title: Can Android apps be native and Java
answer count: 1
tagged with: decompiler
tagged with: android
accepted answer: http://stackoverflow.com/a/20698000
has body: I was just wondering if Android apps can be made from a combination of native (C++) and Java code. This is because I tried decompiling an Android app (just to see how hard it is) and I got quite a bit of Java code, but some of the methods/functions that I recon would do very important and secure work simply return null in the Java code. I guess that they actually reference a C++ library and that the decompiler does not understand that, could this be the case?
tagged with: c++
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20698000

http://stackoverflow.com/a/20722223
downvote count: 0
score: 12
type: Answer
upvote count: 12
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20722120
has body: The main difference is that System.out is a PrintStream and the other one is a PrintWriter. Essentially, PrintStream should be used to write a stream of bytes, while PrintWriter should be used to write a stream of characters (and thus it deals with character encodings and such). For most use cases, there is no difference.
accepted answer of: http://stackoverflow.com/q/20722120

http://stackoverflow.com/q/20737541
type: Question
has body: I have the following methods that I wrote are array and boolean methods. I was wondering how, if possible, can I convert the array method into an ArrayList one. public int[] letsMap(){ int[] iArray = new int[maxBagSize + 1]; int w; for(int i = 0; i &lt; ourBags.size(); i++){ w = ourBags.get(i).foo; iArray[w]++; } return iArray; } . public boolean comp(SearchState search){ boolean cool = false; if(search.unBaggedItems.equals(this.unBaggedItems)){ int[] mine = letsMap(); int[] theirs = search.letsMap(); cool= true; for(int i = 0; i &lt; maxBagSize; i++){ if(mine[i] != theirs[i]){ cool = false; break; } } } return cool; }
score: 0
answer count: 1
tagged with: arrays
tagged with: arraylist
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31072399
has comment: http://stackoverflow.com/comment/31072548
has answer: http://stackoverflow.com/a/20737743
tagged with: java
has title: From Arrays to ArrayList

http://stackoverflow.com/comment/31226923
comment on: http://stackoverflow.com/q/20823690
score: 0
has text: Use [`\b`](http://docs.oracle.com/javase/tutorial/java/data/characters.html)?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31248028
score: 0
has text: May i know why do you want to set the time-to-live property at runtime?
comment on: http://stackoverflow.com/q/20834645
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21471434
downvote count: 0
answers question: http://stackoverflow.com/q/20734823
type: Answer
upvote count: 1
has body: I got this same error when I didn't put my Java code in the expected default locations: src/main/java and src/test/java. Once I fixed that, I could run tests from IDEA or the commandline.
score: 1

http://stackoverflow.com/a/20727398
has comment: http://stackoverflow.com/comment/31053800
answers question: http://stackoverflow.com/q/20727331
type: Answer
has comment: http://stackoverflow.com/comment/31053930
score: 2
downvote count: 0
has body: SQL Server is returning NULL value which you don't handle in the code. One way to do it could be to return zero instead of null in this situation: String sql="Select isnull(Balance,0) as Balance From loyaltycard where LCnum='"+LCnum+"' "; BTW, do not concatenate your queries, this leaves you vulnerable to SQL injection. Use parameters instead. UPDATE: Based on the discussion, there's also more problems: As the type of LCnum column is int, the where clause in the queries should be without quote characters: "... where LCnum="+value1
has comment: http://stackoverflow.com/comment/31053950
upvote count: 2

http://stackoverflow.com/comment/31274680
type: Comment
has text: @nachokk It's much easier when you're not typing on an iPad at 530 in the morning ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20849003

http://stackoverflow.com/q/20708527
has comment: http://stackoverflow.com/comment/31019309
type: Question
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/31019986
has comment: http://stackoverflow.com/comment/31019006
score: 0
has body: I know there many versions of this question is all over the place. However, I went through most of them and it did not work for me. I followed this link https://netbeans.org/kb/docs/java/javase-deploy.html to package my java source but the folders build and dist are not added to the project folder as it's stated in the official article. The folder I see after building the application are classes maven-archiver surefire surefire-report test-classes myApp.jar file Additionally, I set the main class to the main class of my Application in the Netbeans by choosing properties->run->Main Class. Now, the problem is that the jar file is not executed and gives me the "no main manifest attribute" error. Also, I tried to add some of the suggested tags in the pom.xml but that gave me errors as well. How could I fix this? my pom.xml file: http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.mycompany TerminalGUI 1.0-SNAPSHOT jar TerminalGUI http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 3.8.1 test com.googlecode.lanterna lanterna 2.1.6 Thanks,
has comment: http://stackoverflow.com/comment/31018986
answer count: 0
has title: Java packaging and distribution in Netbeans 7.3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/574594
has comment: http://stackoverflow.com/comment/31018695
tagged with: java

http://stackoverflow.com/comment/31176177
has text: I found some instruction on hibernate site, but I don't think I have access to that low level of configs in this project. Things seem to be pretty much so-called "well encapsulated." are there other ways to see the generated query?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20795882

http://stackoverflow.com/q/20821126
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/20821360
score: 0
has comment: http://stackoverflow.com/comment/31222710
has comment: http://stackoverflow.com/comment/31222343
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31222796
has title: Spring: MethodInvokingFactoryBean calls wrong method
tagged with: spring
has body: I need to do the following Java line in XML: usersConnectionRepository.setConnectionSignUp(new AccountConnectionSignUp()); So I did this: <constructor-arg ref="dataSource" /> <constructor-arg ref="connectionFactoryLocator" /> <constructor-arg ref="textEncryptor" /> <aop:scoped-proxy proxy-target-class="false" /> setConnectionSignUp The error occurs when the method is supposed to be called. java.lang.NoSuchMethodException: com.sun.proxy.$Proxy12.setConnectionSignUp(edu.kit.tm.cm.ksc.config.AccountConnectionSignUp) As you can see above, it's totally searching in the wrong package, and I have no idea why. I have no idea how to debug this further. I'm inexperienced with Spring and it's XML-Notation. I hope someone can help me. Thank you. UPDATE As requested, the complete social.xml. Although, I do not think it is needed to solve this. <?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:facebook="http://www.springframework.org/schema/social/facebook" xmlns:twitter="http://www.springframework.org/schema/social/twitter" xmlns:social="http://www.springframework.org/schema/social" xmlns:c="http://www.springframework.org/schema/c" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/social/twitter http://www.springframework.org/schema/social/spring-social-twitter.xsd http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd http://www.springframework.org/schema/context …
has comment: http://stackoverflow.com/comment/31222560
has answer: http://stackoverflow.com/a/20821360
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31222361
tagged with: methods
has comment: http://stackoverflow.com/comment/31222746

http://stackoverflow.com/comment/30979804
score: 0
type: Comment
has text: Oh, I just realized that you don't use a Holder Pattern! This is very easy to implement and very important for you performance of the list. Please read here: http://www.jmanzano.es/blog/?p=166 What happens now: During the creation of your 20 items the button variable always gets the overridden with the currently created list item. That's why your bottom item is the one that gets always changed: It was the last one created.
type: AnswerComment
comment on: http://stackoverflow.com/a/20686209

http://stackoverflow.com/comment/30986240
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20689799
has text: I just took a look with the SQL Profiler. That was exactly may problem. Thanky you very much :)

http://stackoverflow.com/comment/89689879
score: 2
comment on: http://stackoverflow.com/a/20719756
type: AnswerComment
type: Comment
has text: @MrSanchez I also found this and going through the lint description, I found out `Incorrect order of elements in manifest The <application> tag should appear after the elements which declare which version you need, which features you need, which libraries you need, and so on. In the past there have been subtle bugs (such as themes not getting applied correctly) when the <application> tag appears before some of these other elements, so it's best to order your manifest in the logical dependency order.`

http://stackoverflow.com/comment/31084843
type: Comment
has text: ffmpeg -i file:///home/xyz %d.png is running fine when i run this on local terminal . Here %d is creating different number for images ..
comment on: http://stackoverflow.com/q/20744807
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31137793
type: Comment
has text: Yes, it should show list downloaded files. Could you show your project's pom.xml? You could manually add dependency on hibernate libs in pom.xml.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20774380

http://stackoverflow.com/a/24566366
type: Answer
answers question: http://stackoverflow.com/q/20719590
score: 0
has body: I got the same problem before. I added slf4j-api-1.6.1.jar to the project and fixed this problem. I was using Hibernate 4.3.5.

http://stackoverflow.com/comment/31041194
score: 0
type: QuestionComment
type: Comment
has text: @JonSkeet, yes, just typo.
comment on: http://stackoverflow.com/q/20720766

http://stackoverflow.com/comment/31080671
has text: Yeah I got rid of it now :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20742226
type: AnswerComment

http://stackoverflow.com/a/20845374
downvote count: 0
has comment: http://stackoverflow.com/comment/31267269
type: Answer
answers question: http://stackoverflow.com/q/20845298
upvote count: 1
has body: I'm not aware of any good techniques. But getting rid of multiple spaces and interpunction might be a start. String s1, s2; s1 = s1.replaceAll(" {2,}", " ").replaceAll("[.?!/\\()]", "").trim(); s2 = s2.replaceAll(" {2,}", " ").replaceAll("[.?!/\\()]", "").trim(); if (s1.equalsIgnoreCase(s1)) { } Demo that works on your string demo: http://ideone.com/FSHOJt
score: 1

http://stackoverflow.com/a/20746673
has comment: http://stackoverflow.com/comment/31088129
score: 3
has body: I'll give you an alternative since it looks like quick-json has trouble parsing empty json arrays. Check out Gson. String json = "{ \"response\": true, \"model_original_id\": \"5acea0b5:1431fde5d6e:-7fff\", \"model_new_id\": 500568, \"model_new_version\": 1, \"reload\": true, \"idsModelProperties\": [{ \"key\": \"creation_date\", \"value\": \"2013-12-23\" }, { \"key\": \"state\", \"value\": 1, \"displayValue\": \"Analisi\" }], \"idsNodes\": [], \"idsConnectors\": [], \"idsNodesProperties\": []}"; JsonParser jsonParser = new JsonParser(); JsonElement jsonElement = jsonParser.parse(json); JsonElement is an abstract class. Its sub types are JsonArray, JsonNull, JsonObject and JsonPrimitive. In the example above, the actual instance is a JsonObject because your json String is a json object. It internally contains a LinkedTreeMap but you don't really need access to it. You can access the different json objects directly on the JsonElement.
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/20746464
type: Answer
accepted answer of: http://stackoverflow.com/q/20746464
has comment: http://stackoverflow.com/comment/31088167
downvote count: 0

http://stackoverflow.com/q/20837705
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jsonschema
type: Question
has title: Generate java interfaces from JSON Schema
tagged with: jackson
has answer: http://stackoverflow.com/a/21193144
has comment: http://stackoverflow.com/comment/69443908
has body: I'm looking for tool to work with JSON Schema in java. Main requirement is interface generation. I'd like to get interfaces from parser API and provide my own implementations to serializer API. The main purpose is to avoid beans pollution with annotations like JsonProperty, JsonIgnore and so on. There are many tools that can generate java beans (classes) from JSON Schema. Jackson has a feature @JsonSerialize(as=MyInterface.class), but I could not find any tools to generate interfaces from schema.
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/31016501
favorite count: 0

http://stackoverflow.com/comment/31009933
comment on: http://stackoverflow.com/q/20703856
type: Comment
type: QuestionComment
has text: Nope, they could be on multiple lines.
score: 0

http://stackoverflow.com/q/20758424
possible better answer: http://stackoverflow.com/a/20758720
has comment: http://stackoverflow.com/comment/31109588
has comment: http://stackoverflow.com/comment/31460086
has comment: http://stackoverflow.com/comment/31211689
type: AnsweredQuestion
downvote count: 0
score: 1
has body: While working of something, I needed to check if the value(s) in a JavaBean (a form bean in my case) has changed. Generally in web form submission we encounter similar situation in update/edit flow. We generally store the form bean is session before update operation and compare the values in the newly submitted form bean. This is simple but clutters the code and requires code change when properties are added/modified. Problem Statement:- I have a class with properties , primitive types, arrays, other class types.... I have an object of this class. This object goes through a method which can potentially change the properties of this object. How I can transparently know:- a) If the object properties has changed. b) What are the properties that changed. c) Add listener to the property change event. The JDK has a java.beans.PropertyChangeSupport that solves this. This works fine but I think it can be done in a better way. I want to add "Monitoring" functionality to my POJO declarative using annotations / reflections. For Example :- @Monitored class UserFormBean{ private String name; private UserAccount account; } This class should have method similar to these injected:- public boolean hasChanged(); // null if not changed, old value if changed. public Object hasChanged(String propName); Question:- 1) Is there an exiting API similar to what I suggest?. 2) Is it good idea to write such API ? Feasibility ?
favorite count: 0
has comment: http://stackoverflow.com/comment/31109753
has answer: http://stackoverflow.com/a/20968660
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31109802
has comment: http://stackoverflow.com/comment/31366201
tagged with: java
has title: Java | JavaBean Monitoring
has answer: http://stackoverflow.com/a/20758720
accepted answer: http://stackoverflow.com/a/20968660

http://stackoverflow.com/comment/31256891
type: Comment
score: 0
has text: Can you give the code of your configuration file (xml file ) also , with your question ?
type: AnswerComment
comment on: http://stackoverflow.com/a/20838947

http://stackoverflow.com/a/20839147
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20839032
has body: you forgot to add adView.setAdSize(AdSize.BANNER); or Smart_Banner in the setAdSize method

http://stackoverflow.com/q/20714331
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/20715010
answer count: 1
has body: I'm having difficulty creating several JTextFields and JLabels in my JPanel for a hangman game I a making. I am trying to display the users input as "Letters Used" in a JLabel. I have commented the area that is not displaying below. Thanks in advance. /*PACKAGE DECLARATION*/ package Game; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; /************************ * GAME MECHANICS CLASS * * **********************/ public class GameMechanics { /* STATIC DECLARATIONS */ static JPanel jp;//panel static JLabel jl;//label static JTextField tf;//text field static String input = ""; /********************* * USER INPUT METHOD * * *******************/ public void userInput() { jp = new JPanel(); jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); jl = new JLabel("Enter a Letter");//prompt with label tf = new JTextField(null);//length of text field by character jp.add(jl);//add label to panel jp.add(tf);//add text field to panel tf.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JTextField tf = (JTextField)e.getSource(); input = tf.getText();//get user input JLabel jl2 = new JLabel("Letters Used: " + input);//NOT DISPLAYING jp.add(jl2);//NOT DISPLAYING }//end actionPerformed method }); }//end userInput method /***************** * WINDOW METHOD * * ***************/ public void window() { LoadImageApp i = new LoadImageApp();//calling image class JFrame gameFrame = new JFrame();//declaration gameFrame.add(i); //adds background image to window i.add(jp); // adds panel containing label to background image panel gameFrame.setTitle("Hangman");//title of frame window gameFrame.setSize(850, 600);//sets size of frame gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//exit when 'x' button pressed gameFrame.setIconImage(new ImageIcon("Hangman-Game-grey.png").getImage());//set the frame icon to an image loaded from a file gameFrame.setLocationRelativeTo(null);//window centered gameFrame.setR…
score: 0
accepted answer: http://stackoverflow.com/a/20715010
tagged with: jlabel
tagged with: swing
has title: Difficulty displaying several JTextFields and JLabels inside JPanel

http://stackoverflow.com/q/20718116
has answer: http://stackoverflow.com/a/20718228
has answer: http://stackoverflow.com/a/20718180
has answer: http://stackoverflow.com/a/20718134
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27987094
tagged with: android
upvote count: 1
type: AnsweredQuestion
has title: Android programming ,Syntax error on token "Invalid Character", delete this token
score: 1
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/20718180
possible better answer: http://stackoverflow.com/a/20718134
has body: i am beginner in android programming . i tried to add a text view or anything in my app. but somehow in id class which is automatically generated in r.java , i am getting invalid character as u can see in textview and i can't delete it or alter it . need help!!!!!!!!!!!!!!!!! public static final class id { public static final int action_settings=0x7f080001; public static final int textViewà¥§=0x7f080000; } Syntax error on token "Invalid Character", delete this token

http://stackoverflow.com/a/20703024
downvote count: 0
has body: Using a TreeSet will not be the most memory-efficient for this, and it won't even be the fastest way. You should use an ArrayList and perform a sort on it: List&lt;MyClass&gt; sorted = new ArrayList&lt;&gt;(oldSet.size()); oldSet = null; Collections.sort(sorted, myComparator); The overhead of a single array used inside ArrayList should not be an issue, and in any case it is the smallest issue you can have. The single-shot bulk sort operation is faster than finding the right place for each individual item in a TreeSet, along with all the allocation needed in that case.
has comment: http://stackoverflow.com/comment/31011864
type: Answer
answers question: http://stackoverflow.com/q/20702622
score: 2
has comment: http://stackoverflow.com/comment/31009010
upvote count: 2
has comment: http://stackoverflow.com/comment/31011777
has comment: http://stackoverflow.com/comment/31012072
has comment: http://stackoverflow.com/comment/31011118

http://stackoverflow.com/q/20848082
has answer: http://stackoverflow.com/a/20874821
tagged with: factory-pattern
has answer: http://stackoverflow.com/a/44105480
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20849652
has answer: http://stackoverflow.com/a/20859513
linked to: http://stackoverflow.com/q/5739611
upvote count: 11
has comment: http://stackoverflow.com/comment/93499166
has title: Motivation for Simple Factory and Factory Method Pattern
has body: I know there are a lot of questions out there about differences of different factory patterns, but the answers are so different and confusing. The books that i read use unclear and (over)simplified examples. I have a number of questions even after reading Wikipedia explanations, and a lot of online explanations about them including all on these site. The book that I'm currently reading is Head First Design Patterns. In Simple Factory the client uses separate class (Creator) with factory method (which CAN be static) to return Products. In Factory Method Pattern the Creator and the Client are the same thing and they use abstract method in the same class to create new Products, on which they operate in that same class. Of course the Creator (or Client) are abstract, so the decision about making the Concrete Product is deferred to sub-classes. Is my understanding correct (for ex. are the Client and Creator in FMP the same thing, I never see Client in FMP diagram)? In Factory Method Pattern it seams that the create method is not reusable outside of the Creator, so it can only be reused when making some new Creator? What are the situations where I can choose one over the other? (P.S. Please don't mark this as duplicate, I want to make this thing clear on this site)
has answer: http://stackoverflow.com/a/28216485
score: 11
tagged with: design-patterns
tagged with: factory
type: Question
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/24720179
answer count: 6

http://stackoverflow.com/a/20758309
downvote count: 0
has comment: http://stackoverflow.com/comment/31109886
has body: To use slf4j your pom.xml must include following set of dependencies org.springframework spring-context 4.0.0.RELEASE runtime commons-logging commons-logging org.slf4j jcl-over-slf4j 1.5.8 runtime org.slf4j slf4j-api 1.5.8 runtime org.slf4j slf4j-log4j12 1.5.8 runtime log4j log4j 1.2.14 runtime
type: Answer
has comment: http://stackoverflow.com/comment/31109326
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20757821

http://stackoverflow.com/comment/31087697
has text: And what empty string?
type: QuestionComment
comment on: http://stackoverflow.com/q/20746464
score: 0
type: Comment

http://stackoverflow.com/comment/31091546
comment on: http://stackoverflow.com/q/20748351
type: Comment
type: QuestionComment
score: 3
has text: Which `join` method are you using? I'm not getting any `join` method which takes 2nd argument as `char` array.

http://stackoverflow.com/q/20754864
has answer: http://stackoverflow.com/a/20754912
has body: I want to move a custom array item up and down using Collections.swap, but I don't understand how to implement it in a way so that my app doesn't crash. private List&lt;Drinks&gt; myDrinks = new ArrayList&lt;Drinks&gt;(); private ArrayList&lt;String&gt; yourItems; ... private void populateDrinkList() { if (yourItems.contains("pie")){ myDrinks.add(new Drinks("a")); myDrinks.add(new Drinks("b")); myDrinks.add(new Drinks("c")); myDrinks.add(new Drinks("d")); myDrinks.add(new Drinks("e")); if (yourItems.contains("chocolate")){ String toMoveUp = "e"; while (myDrinks.indexOf(toMoveUp) != 0) { int i = myDrinks.indexOf(toMoveUp); Collections.swap(myDrinks, i, i - 1); } }
has title: Move a custom array item up or down
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31103631
tagged with: arrays
has comment: http://stackoverflow.com/comment/31103898
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/31103563
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31103644
has comment: http://stackoverflow.com/comment/31103702
possible better answer: http://stackoverflow.com/a/20754912
type: Question
has answer: http://stackoverflow.com/a/20755026
tagged with: sorting
accepted answer: http://stackoverflow.com/a/20755026

http://stackoverflow.com/a/20826486
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20787657
answers question: http://stackoverflow.com/q/20787657
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I've solved my problem. The keystore was created using setEntry with specific alias. Therefore, in my conversion function I had to get the entry using the old password and set the same entry with the same alias again with the new password. Now, with this updated keystore the KeyManagerFactory.init() runs successfully. See the following code below: static void convertPasswordAlgorithm(String keystorePath, String fromAlgorithm, String toAlgorithm) throws Exceptionc { FileInputStream fileInStream = null; String keystoreFullPath = keystorePath + ISiteConstants.c_FILE_SEPERATOR + KEYSTORE_FILE_NAME; KeyStore keyStore; try { String alias = getCertificateAlias(); keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); fileInStream = new FileInputStream(keystoreFullPath); // Try to load the keystore with fromAlgorithm password hash. char[] machineOldAlgPassword = getMachinePassword(fromAlgorithm).toCharArray(); keyStore.load(fileInStream, machineOldAlgPassword); // Save the entry to update KeyStore.Entry entry = keyStore.getEntry(alias, new KeyStore.PasswordProtection(machineOldAlgPassword)); HandleFiles.close(fileInStream); // If succeeded, recalculate password using toAlgorithm hash and save. String machineNewAlgPassword = getMachinePassword(toAlgorithm); keyStore.setEntry(alias, entry, new KeyStore.PasswordProtection(machineNewAlgPassword.toCharArray())); FileOutputStream fileOutputStream = new FileOutputStream(keystoreFullPath); keyStore.store(fileOutputStream, machineNewAlgPassword.toCharArray()); HandleFiles.close(fileOutputStream); } finally { HandleFiles.close(fileInStream); } }
score: 1

http://stackoverflow.com/q/20765534
accepted answer: http://stackoverflow.com/a/20765564
has answer: http://stackoverflow.com/a/20765582
favorite count: 0
has answer: http://stackoverflow.com/a/20765564
upvote count: 5
answer count: 5
has title: Java Serializable: Must E be serializable in ArrayList<E>?
type: AnsweredQuestion
has body: I have the following class containing the fields specified below. My question is, must Admin, Worker and all my other self-defined classes implement Serializable for MyClass to be Serializable? public class MyClass implements java.io.Serializable { private static final long serialVersionUID = 1L; ArrayList&lt;Admin&gt; admins; ArrayList&lt;Worker&gt; workers; ArrayList&lt;Manager&gt; managers; ArrayList&lt;Secretary&gt; secretaries; ArrayList&lt;Category&gt; categories; HashMap&lt;Issue, HashMap&lt;Category,Manager&gt;&gt; ManagedIssues; private static MyClass instance; ... }
has answer: http://stackoverflow.com/a/20765775
downvote count: 0
has answer: http://stackoverflow.com/a/20765565
tagged with: java
has answer: http://stackoverflow.com/a/20765570
type: Question
possible better answer: http://stackoverflow.com/a/20765775
score: 5
tagged with: serializable

http://stackoverflow.com/q/20781005
type: Question
has comment: http://stackoverflow.com/comment/31282066
answer count: 2
tagged with: ewsjavaapi
linked to: http://stackoverflow.com/q/9203073
tagged with: exchangewebservices
has answer: http://stackoverflow.com/a/21954000
tagged with: android
linked to: http://stackoverflow.com/q/4956262
has body: I'm trying to use EWS Java API for android app to connect to Exchange Server 2010 but I get an error when I used the EWS API: Exeptions: Could not find method javax.xml.stream.XMLOutputFactory.newInstance, referenced from method microsoft.exchange.webservices.data.EwsUtilities.formatLogMessage VFY: unable to resolve static method 6011: Ljavax/xml/stream/XMLOutputFactory;.newInstance ()Ljavax/xml/stream/XMLOutputFactory; Could not find method javax.xml.stream.XMLStreamWriter.writeStartElement, referenced from method microsoft.exchange.webservices.data.EwsUtilities.writeTraceStartElement Errors: FATAL EXCEPTION: main 12-26 14:20:10.384: java.lang.VerifyError: microsoft/exchange/webservices/data/EwsServiceXmlWriter at microsoft.exchange.webservices.data.ServiceRequestBase.emit(Unknown Source) at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source) My source code to send mail is: ExchangeService service = new ExchangeService(); ExchangeCredentials credentials = new WebCredentials("username", "password"); service.setCredentials(credentials); try { uri = new URI("https://host name/ews/Exchange.asmx"); } catch (URISyntaxException e) { e.printStackTrace(); } service.setUrl(uri); try { EmailMessage msg= new EmailMessage(service); msg.setSubject("Heloo World "); msg.setBody(MessageBody.getMessageBodyFromText("Send using ews api in android ")); msg.getToRecipients().add("email address"); msg.send(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Thanks in advance.
has title: How to use EWS Java API on Android application
linked to: http://stackoverflow.com/q/12285615
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20781825
tagged with: java

http://stackoverflow.com/a/20680160
has comment: http://stackoverflow.com/comment/30967612
type: Answer
accepted answer of: http://stackoverflow.com/q/20680111
answers question: http://stackoverflow.com/q/20680111
upvote count: 5
downvote count: 0
score: 5
type: AcceptedAnswer
has body: use: getIntent().getIntExtra("DDL_ID", 0)); All Activity's have a getIntent() method, which will return the Intent used to launch the Activity. By calling getIntent() you get an instance of an Intent, and you can call non-static methods on them

http://stackoverflow.com/comment/31208753
has text: @RakeshKR what is StackTrace?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20813606
score: 0

http://stackoverflow.com/comment/31221115
type: Comment
type: QuestionComment
score: 0
has text: You can edit your question to add more details.
comment on: http://stackoverflow.com/q/20819993

http://stackoverflow.com/comment/31143188
score: 0
type: QuestionComment
type: Comment
has text: You need an **instance** of a class (i.e. something created with `new`) in order to invoke non-static methods.
comment on: http://stackoverflow.com/q/20777349

http://stackoverflow.com/comment/31166459
comment on: http://stackoverflow.com/q/20790634
type: Comment
type: QuestionComment
has text: are you using application/json content-type ?
score: 0

http://stackoverflow.com/a/20819017
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20791357
accepted answer of: http://stackoverflow.com/q/20791357
has body: The status code "100 continue" is usually sent by the server after it got the request header of the POST request, to signal the client that it can follow up with the POST body. This way the server can reject requests early based on the request header (e.g. authorization required) without wasting resources on the client. The final response will then be sent after the server received the request body from the client, which might be immediately or hours later, depending on how fast the clients sends the request body.

checkout
type: Tag
tag name: checkout
tags question: http://stackoverflow.com/q/20842929

http://stackoverflow.com/comment/31209873
type: Comment
score: 0
comment on: http://stackoverflow.com/q/20810115
has text: You may find [this article](http://rosettacode.org/wiki/Power_Set) informative.
type: QuestionComment

http://stackoverflow.com/comment/31217032
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20818036
has text: is DisplayPic a String or a byte[] ?

http://stackoverflow.com/q/20680430
type: Question
upvote count: 16
has title: Is it possible to justify text in PDFBOX?
accepted answer: http://stackoverflow.com/a/20681996
tagged with: pdfbox
answer count: 1
has answer: http://stackoverflow.com/a/20681996
favorite count: 0
has comment: http://stackoverflow.com/comment/30968046
tagged with: pdf-generation
type: AnsweredQuestion
downvote count: 0
has body: Is there any function in PDFBOX API to make text justified or we have to do it manually?? and if manually then how to justify text using java(logic behind it)
tagged with: java
score: 16
linked to: http://stackoverflow.com/q/19635275

http://stackoverflow.com/comment/31006720
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20701070
has text: Note that the Java compiler can treat some `static final` fields as compile-time constants - if you have a `public static final double THRESHOLD = 0.5` (for example), and you modify the value or remove the `final` modifier, then you will probably have to re-compile any other classes that refer to this field as they will have had the previous value "baked-in" at compile time.
score: 0

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/20789768
tags question: http://stackoverflow.com/q/20774604
type: Tag
tags question: http://stackoverflow.com/q/20707383
tags question: http://stackoverflow.com/q/20784397

http://stackoverflow.com/q/20752432
has comment: http://stackoverflow.com/comment/31099796
type: AnsweredQuestion
has title: Convert BufferedInputStream into image
tagged with: java
has comment: http://stackoverflow.com/comment/31099199
score: -1
tagged with: mysql
tagged with: inputstream
has comment: http://stackoverflow.com/comment/31099596
type: Question
has comment: http://stackoverflow.com/comment/31099801
has comment: http://stackoverflow.com/comment/31099736
has comment: http://stackoverflow.com/comment/31099433
has comment: http://stackoverflow.com/comment/31099640
tagged with: jersey
answer count: 1
duplicate of: http://stackoverflow.com/q/20736688
has comment: http://stackoverflow.com/comment/31099362
has comment: http://stackoverflow.com/comment/31099879
downvote count: 1
has answer: http://stackoverflow.com/a/20753089
has comment: http://stackoverflow.com/comment/31099858
accepted answer: http://stackoverflow.com/a/20753089
has body: Im having trouble turning my blob into a buffered image so I can use it. I'm getting a blob (jpg image) back from my database I uploaded using inputstream. In my database it is stored as BufferedInputStream I notice. I get the blob just fine, its a bunch of weird symbols and says its a jpg so the image has to be fine. Can anyone spot what I'm doing wrong? Maybe im converting it wrong? At image = ImageIO.read(new ByteArrayInputStream(data)); Image returns null. @GET @Path("{id}") @Produces("image/*") public Response post(@PathParam("id") String id) throws IOException { Connection con = connection(); Blob blob = getPhoto(con); BufferedImage image = null; byte[] data = null; int blobLength = 0; try { blobLength = (int) blob.length(); data = blob.getBytes(1, blobLength); image = ImageIO.read(new ByteArrayInputStream(data)); // ImageIO.write(image, "JPEG", new File("C:/Users/Nicolas/Desktop/image.jpg")); } catch (SQLException e2) { e2.printStackTrace(); } return Response.ok(image).build(); } How I write to database public void postPhoto(Connection con, InputStream uploadedInputStream){ String mySQL = "INSERT INTO photos (photo) values (?)"; PreparedStatement pStmt = con.prepareStatement(mySQL); pStmt.setBlob(1, uploadedInputStream); pStmt.execute(); } How I send the file to my servlet var fileInput = document.getElementById('file'); var file = fileInput.files[0]; var formData = new FormData(); formData.append("file", file); var parameters="first="+firstName+"&amp;last="+lastName+"&amp;file="+file; xmlhttp.open("post","http://localhost:8080/restService/api/submitinfo",true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(formData);
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/31099730
tagged with: web-services

http://stackoverflow.com/q/20729434
linked to: http://stackoverflow.com/q/16498649
answer count: 4
has body: So I'm having trouble with an assignment where I need to return the first or second token of a string, based on the given argument, using the stringtokenizer constructs and methods. EX: "3+5", 2. the return on this should be 5. Now what I have so far is: StringTokenizer st = new StringTokenizer (input, "+-*/%"); if (st.hasMoreTokens()); return st.nextToken(); this returns the first token of the string, but im unsure of how to return the second token. any advice?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20729758
has answer: http://stackoverflow.com/a/20729740
linked to: http://stackoverflow.com/q/13432094
has answer: http://stackoverflow.com/a/20730114
type: Question
has answer: http://stackoverflow.com/a/20729450
tagged with: java
score: 0
has title: Java stringtokenizer assignment trouble
tagged with: stringtokenizer

http://stackoverflow.com/comment/86589862
type: Comment
comment on: http://stackoverflow.com/a/32304962
has text: @Someguy I did implement it.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31225877
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20823070
has text: I think you're going to need to store your "ChangeRoomVO" in the session.
score: 0

http://stackoverflow.com/a/20815593
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20815501
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20815501
score: 3
has body: This code will fail if there is e.g. an empty line in the file, or a line formatted differently, or if the spaces are actually tabs (maybe there are more reasons). If you want to program defensively, you should do: while((line=br.readLine())!=null) { String[] columns = line.split(" "); if( columns != null &amp;&amp; columns.length &gt;= 5 ) { sum = sum + Integer.parseInt(columns[4]); } else { // do what you must here; it may be an error to encounter such a line: throw new IllegalArgumentException("malformatted line: " + line); // or it may be OK to swallow the exceptional case // or you may only need to silently log it: logger.warn("malformatted line: " + line); // etc... } }
upvote count: 3

apache-poi
tags question: http://stackoverflow.com/q/20767252
tags question: http://stackoverflow.com/q/20752601
tags question: http://stackoverflow.com/q/20694915
tags question: http://stackoverflow.com/q/20740879
tags question: http://stackoverflow.com/q/20847731
type: Tag
tags question: http://stackoverflow.com/q/20802486
tag name: apache-poi
tags question: http://stackoverflow.com/q/20811957
tags question: http://stackoverflow.com/q/20840008
tags question: http://stackoverflow.com/q/20817255
tags question: http://stackoverflow.com/q/20810700
tags question: http://stackoverflow.com/q/20811141
tags question: http://stackoverflow.com/q/20751082

http://stackoverflow.com/comment/31166925
comment on: http://stackoverflow.com/q/20790546
type: QuestionComment
type: Comment
score: 2
has text: This `100 * 24 * 60 * 60 * 1000` is a bunch of `int` values. Since `*` has priority, the result of this expression will be an `int` that will have overflown. Only when added to the `long` from `current.getTime()` will it be widened to a `long`, but it will be too late.

http://stackoverflow.com/a/20784464
has body: first get the distance between dragger control and drag receiver control: textview1 is dragger control textview2 is drag receiver control //if text view2 is below textview one and text view 2 is on the right of text view one int topMargin=textview2_top_margin - textview1_top_margin int leftMargin=textview2_left_margin - textview1_left_margin public void animation() { Animation animation = new TranslateAnimation(left_margin, 0, topMargin, 0); animation.setDuration(1000); controlToAnimate.startAnimation(animation); }
accepted answer of: http://stackoverflow.com/q/20741022
answers question: http://stackoverflow.com/q/20741022
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31189469
type: QuestionComment
comment on: http://stackoverflow.com/q/20803436
has text: Encrypted? What do mean you encrypted them? Also, please post the results of `jar tvvf <yourjarfile>.jar`.
score: 0
type: Comment

layout
tags question: http://stackoverflow.com/q/20845200
tags question: http://stackoverflow.com/q/20723289
tags question: http://stackoverflow.com/q/20723419
tag name: layout
tags question: http://stackoverflow.com/q/20742134
tags question: http://stackoverflow.com/q/20772847
tags question: http://stackoverflow.com/q/20778470
tags question: http://stackoverflow.com/q/20737457
tags question: http://stackoverflow.com/q/20726904
tags question: http://stackoverflow.com/q/20796195
tags question: http://stackoverflow.com/q/20727669
tags question: http://stackoverflow.com/q/20806819
tags question: http://stackoverflow.com/q/20813827
tags question: http://stackoverflow.com/q/20841810
type: Tag
tags question: http://stackoverflow.com/q/20839252
tags question: http://stackoverflow.com/q/20828805
tags question: http://stackoverflow.com/q/20766363
tags question: http://stackoverflow.com/q/20826493
tags question: http://stackoverflow.com/q/20743051
tags question: http://stackoverflow.com/q/20811850

http://stackoverflow.com/a/20832839
downvote count: 0
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/20832814
score: 8
accepted answer of: http://stackoverflow.com/q/20832814
has body: Just get the contents as an array List&lt;String[]&gt; list = new ArrayList&lt;&gt;(); ... String[][] array = list.toArray(new String[0][0]); // the size here is not important, the array is just an indication of the type to use
has comment: http://stackoverflow.com/comment/31244922
type: AcceptedAnswer

http://stackoverflow.com/comment/31132756
type: QuestionComment
has text: can you clarify, if you're talking about opencv's java wrappers, or javacv ?
score: 0
comment on: http://stackoverflow.com/q/20771443
type: Comment

http://stackoverflow.com/q/20689002
has comment: http://stackoverflow.com/comment/30984221
tagged with: java
type: Question
upvote count: 0
has body: How to Creating an instance of a class from string i.e.class name will be passed as string and also want to call methods (methods do not have any parameters). for example with class name TEST having methods like 1) GetData 2) GetAddtionof2numbres etc... i want to pass class name TEST using a variable. String className = "TEST"; i have tried with refection i.e using as below Class cls = Class.forName(className); object o = cls.newinstance(); but not able to get/access methods in that class. when i get method names from the class i will compare them with the names stores in text files and run that method in that class by creating an instance of the class at run time. Can any body help me in this thanks in advance i have tried with below String className = "test.t456"; Class c = Class.forName(className); Object obj = c.newInstance(); Method[] method = c.getDeclaredMethods(); for(Method m : method) { System.out.println(m.getName()); } able to print method names in console. Now how to run these methods by creating instance of that class.?
score: -2
has comment: http://stackoverflow.com/comment/30984388
has answer: http://stackoverflow.com/a/20689817
has comment: http://stackoverflow.com/comment/30983857
has title: Creating an instance of a class from String and call methods in that class in Java
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/160970
has comment: http://stackoverflow.com/comment/30983852
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30984127
downvote count: 2
has comment: http://stackoverflow.com/comment/30983795

http://stackoverflow.com/a/20770313
downvote count: 0
answers question: http://stackoverflow.com/q/20770006
type: Answer
score: 2
upvote count: 2
has body: The way I see it, Strings can be used in one of two ways: As properties / keys / enumerations - or in other words, as an internal representation of another Objects/states of your application, where one code component writes them, and another one reads them. In UI - for GUI / console / logging display purposes. I Think it's easy to see how in both cases it's important to avoid hard-coding. The first kind of strings must (if possible) be stored as constants and exposed to whichever program component that might use them for input/output. Displayed Strings (like in your Logger case) are strings that you might change somewhere in the future. Having them all stored as static final fields in a constants-dedicated class can make later modifications much easier, and help avoid duplicates of similar massages. Regarding the optimization question - as others have already answered, I believe there's no significant difference.

http://stackoverflow.com/q/20779554
answer count: 4
has comment: http://stackoverflow.com/comment/31148346
downvote count: 0
score: 1
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/31147121
type: Question
has comment: http://stackoverflow.com/comment/31147228
has title: HTTP 404 when trying to run a jsp file in eclipse
has comment: http://stackoverflow.com/comment/31147274
has comment: http://stackoverflow.com/comment/31147794
linked to: http://stackoverflow.com/q/18348741
has comment: http://stackoverflow.com/comment/31147299
has comment: http://stackoverflow.com/comment/31147687
has comment: http://stackoverflow.com/comment/31147266
tagged with: java
has answer: http://stackoverflow.com/a/35906327
has body: I get 404 error when trying to run a jsp file eclipse. The confusing thing is the server is running and I can go to localhost:8080 without any problems. I have attached an image of my configuration of server, the jsp file and also the location of the file and the error. I embed the image cause of the reputation thing so I have linked it More information: I am using TOMCAT 7, ECLIPSE KEPLER I have checked the location of helloworld.jsp its in WebContent. I have restarted the server. I have created another dynamic web project nothing works. I get the same problem I can go to localhost:8080 but I cant run an JSP file SOLVED: Okay guys its pretty simple to solve this problem. There are two things you need to try. 1)Right click your project and export the war file into C:\ProgramFiles\Tomcat7 folder If this does not work then. 2) Right click your project and export the war file into some directory and copy the war file into C:\ProgramFiles\Tomcat7 then start the Tomcat server and there you go your JSP file work. You will probably end up doing step 2 because of stupid windows file permissions Also thanks for all the help guys really appreciate it.
upvote count: 1
has comment: http://stackoverflow.com/comment/31147287
has answer: http://stackoverflow.com/a/40501509
has comment: http://stackoverflow.com/comment/31147140
has comment: http://stackoverflow.com/comment/31147197
has comment: http://stackoverflow.com/comment/31147160
has answer: http://stackoverflow.com/a/20781051
has comment: http://stackoverflow.com/comment/31147181
has answer: http://stackoverflow.com/a/20779738
has comment: http://stackoverflow.com/comment/31147613
tagged with: jsp
type: UnansweredQuestion
tagged with: tomcat

http://stackoverflow.com/a/20828582
has comment: http://stackoverflow.com/comment/31236818
has comment: http://stackoverflow.com/comment/31236630
score: 0
has body: Your missing the while (rs.next()) to move the result set to the next result. Try this out. Also as @Learing pointed out, you spelled "Position" wrong in your else if. while (rs.next()) { if (rs.getString("Position").contentEquals("Admin")) { JOptionPane.showMessageDialog(null, "WELCOME ADMIN"); CP.show(); dispose(); con.close(); st.close(); } else if (rs.getString("Position").contentEquals("Staff")) { JOptionPane.showMessageDialog(null, "WELCOME STAFF"); AS.show(); dispose(); con.close(); st.close(); } } EDIT To prevent SQL injection, you should use a PreparedStatment. Try this instead of what you have PreparedStatment pstmt = conn.prepareStatement("SELECT * from loginUsers WHERE Username=? and Password=?"); pstmt.setString(1, userTxt.getText()); pstmt.setString(2, passTxt.getText()); ResultSet rs = pstmt.executeQuery();
has comment: http://stackoverflow.com/comment/31236324
has comment: http://stackoverflow.com/comment/31236731
answers question: http://stackoverflow.com/q/20828494
has comment: http://stackoverflow.com/comment/31236226
type: Answer
has comment: http://stackoverflow.com/comment/31236808
has comment: http://stackoverflow.com/comment/31236377
has comment: http://stackoverflow.com/comment/31236526
has comment: http://stackoverflow.com/comment/31236204
has comment: http://stackoverflow.com/comment/31236549

http://stackoverflow.com/q/20838522
score: 3
possible better answer: http://stackoverflow.com/a/20839482
tagged with: java
type: Question
answer count: 2
tagged with: batch-processing
has body: I am quite new to Spring-Batch and I wonder whether there is a way to access the step-id from within an ItemReader or ItemWriter? In my case that would allow switching enum types based on different step-definitions in a single ItemReader implementation. Does anyone know a way to do that?
downvote count: 0
has answer: http://stackoverflow.com/a/20851371
favorite count: 0
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/31258279
has title: Spring Batch: How to access the current step's id / name from within an ItemReader or ItemWriter
tagged with: spring
upvote count: 3
accepted answer: http://stackoverflow.com/a/20851371
has answer: http://stackoverflow.com/a/20839482
type: AnsweredQuestion

http://stackoverflow.com/q/20682619
has title: Failed to Fill Spinner Values From Bean Class using Java in Android?
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/20682670
score: 1
tagged with: android-context
upvote count: 1
answer count: 1
has body: public class BriefFragmentActivity extends Fragment { public BriefFragmentActivity() { } public static final String ARG_SECTION_NUMBER = "section_number"; String getParameter_Url = "parameters/getParameters"; Spinner spinnerSystemType; ArrayList&lt;String&gt; systemTypeArrayList; DataBaseAdapter dataBaseAdapterInstance; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.brief_fragment_view, null); getAllSpinnerValues(); spinnerSystemType = (Spinner) v.findViewById(R.id.spinner_systemtype); return v; } private void getAllSpinnerValues() { systemTypeArrayList = new ArrayList&lt;String&gt;(); dataBaseAdapterInstance = new DataBaseAdapter(getActivity().getApplicationContext()); dataBaseAdapterInstance.openToRead(); List&lt;Parameters&gt; parameterList = new ArrayList&lt;Parameters&gt;(); parameterList = dataBaseAdapterInstance.getParameterList(); for (Parameters p : parameterList) { Log.i("parameter list",""+p.getId() + "cash code" + p.getCashCode() +"....." + p.getParamType()); if(p.getParamType().trim().toString().equalsIgnoreCase("system type")) { Log.i("system type","string comparison block"); systemTypeArrayList.add(p.getParamDescription().trim().toString()); Log.i("systemTypeArrayList:",""+systemTypeArrayList); **// getting correct data on this line from bean class.....** //**Error is when trying to add this arrayList to ArrayAdapter** ArrayAdapter&lt;String&gt; adapterSystemType = new ArrayAdapter&lt;String&gt;(getActivity(),R.layout.custom_spinner,systemTypeArrayList); adapterSystemType.setDropDownViewResource(R.layout.custom_spinner_item_list); spinnerSystemType.setAdapter(adapterSystemType); adapterSystemType.notifyDataSetChanged(); } else { Log.i("values",""+p.getParamType()); } } dataBaseAdapterInstance.close(); } } please ignore mistake of { } i think there is some mistake of Context thats why its giving me error.Error starts from this LOC: ArrayAdapter adapterSyst…
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/20682670

http://stackoverflow.com/comment/30997740
score: 1
comment on: http://stackoverflow.com/q/20696542
type: QuestionComment
type: Comment
has text: check for null as well :) since the raw value is a string,

http://stackoverflow.com/comment/30981658
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20687016
has text: Yes I think I am, however i think you have misunderstood what i meant. The question and response are not pairs, the response is on of the pieces of information stored under the question. It should be able to call the name each piece of information individually for each question. Ill update the question with the code i have so far.

http://stackoverflow.com/comment/31950848
type: AnswerComment
comment on: http://stackoverflow.com/a/20734893
score: 0
has text: any expert can suggest any temporary work around? i tried driver.navigate().back() and still the test run abruptly same like the earlier problem..
type: Comment

http://stackoverflow.com/comment/31047139
type: QuestionComment
type: Comment
score: 0
has text: Please post the exact SQLite version you use, as well as driver class and connection string .
comment on: http://stackoverflow.com/q/20723711

http://stackoverflow.com/comment/31146610
type: QuestionComment
type: Comment
has text: "Chain of responsibility" and "command" (and/or "interpreter") pattern(s).
score: 0
comment on: http://stackoverflow.com/q/20779239

http://stackoverflow.com/q/20845746
has comment: http://stackoverflow.com/comment/31277654
tagged with: scope
score: 0
has comment: http://stackoverflow.com/comment/31292562
type: UnansweredQuestion
tagged with: lookup
answer count: 0
tagged with: jsf
tagged with: java
type: Question
has title: ApplicationScoped ManagedBean as Timer / Scheduler, shorter scope issue
has body: I am writing a simple web application that must run on different (probably old) Java application servers. Therefore I can't use the latest JEE goodies :) please consider this before answering. The project uses JSF 2.0 jsf-myfaces.version2.1.7 jsf-mojarra.version 2.1.7 javax.servlet 1.2 I have a managed bean that processes the GUI requests, creates objects and uses another managed bean to persist these objects. @Entity @Table (name = "HOSTS") public class Host implements Comparable&lt;Host&gt;{ //... } @ManagedBean(name = "HostController") @RequestScoped public class HostController { @PersistenceContext private EntityManager em; @Resource private UserTransaction utx; public void merge(Host host) { //.... } //.... } So far everything works as planned. The next requirement is a batch job which runs every 24 hours. As supposed here: Spawning threads in a JSF managed bean for scheduled tasks using a timer I created a managed bean (ApplicationScoped) and tried to use it as a timer. (I can't use the other solutions because the necessary libs are probably not provided by the target AS) The batch job is supposed to grab all Host objects from the database and run some tasks on them. The result of those tasks are new objects that need to be stored in the database. I already have a requestScoped managed bean similar to HostController that can do the DB operations. As supposed in the other Thread the class that implements the batch-job is not a bean. (link above: SomeDailyJob) Therefore I can't get an instance of my HostController class. (At least I don't know how to do that). Note: javax.enterprise.inject.spi is not available - if you think this package would help I need to know the oldest versions of JBoss and WebLogic that provide it. The application scoped bean is not able to access the HostController, too. (shorter scope)
tagged with: pojo

http://stackoverflow.com/a/20803243
has body: The \ is special both in string literals and in regular expressions. To put an actual \ in a regular expression, you have to escape it twice. You also have to assign the result somewhere, which it wasn't clear from your question you were doing. So: input = input.replaceAll("\\\\[a-zA-Z0-9]*", ""); Complete example: Live Copy import java.util.*; public class Temp { public static void main(String[] args) { String input = "4 5 \\rad"; input = input.replaceAll("\\\\[a-zA-Z0-9]*", ""); System.out.println(input); } } Output: 4 5
type: Answer
has comment: http://stackoverflow.com/comment/31189143
answers question: http://stackoverflow.com/q/20803209
has comment: http://stackoverflow.com/comment/31188780
has comment: http://stackoverflow.com/comment/31188868
score: 5
has comment: http://stackoverflow.com/comment/31189026
upvote count: 5
has comment: http://stackoverflow.com/comment/31189265
accepted answer of: http://stackoverflow.com/q/20803209
has comment: http://stackoverflow.com/comment/31189502
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20686499
has answer: http://stackoverflow.com/a/20686642
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20686711
accepted answer: http://stackoverflow.com/a/20686642
possible better answer: http://stackoverflow.com/a/20686646
has answer: http://stackoverflow.com/a/20686646
has title: Java how to convert a multidimensional array to single array easily?
score: 0
duplicate of: http://stackoverflow.com/q/2569279
favorite count: 0
answer count: 4
duplicate of: http://stackoverflow.com/q/80476
upvote count: 2
has body: [[4, 17, 28, 38, 43, 58, 69, 77, 83], [4, 12, 24, 35, 48, 55, 62, 73, 87], [11, 15, 22, 36, 46, 60, 67, 80, 84]] how to convert that to this: [4, 17, 28, 38, 43, 58, 69, 77, 83, 4, 12, 24, 35, 48, 55, 62, 73, 87, 11, 15, 22, 36, 46, 60, 67, 80, 84] is there an easy way?
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/20686691
type: Question

http://stackoverflow.com/comment/31210359
score: 0
has text: @MGorgon How I can fix this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20814539

http://stackoverflow.com/comment/31112733
has text: There will be `n` recursive calls to `mergeSort()` and the size of each stack frame will be same, isn't it?
comment on: http://stackoverflow.com/a/20760293
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20803737
has comment: http://stackoverflow.com/comment/31189745
has comment: http://stackoverflow.com/comment/31190314
answer count: 1
has comment: http://stackoverflow.com/comment/31189759
favorite count: 0
accepted answer: http://stackoverflow.com/a/20804049
type: AnsweredQuestion
has body: I am trying to write a code that takes multiple Uniprot IDs for proteins from user and performs further actions on those IDs. As the Uniprot ID consists of 6 letters, I want to implement it so that when the user enter 6 letters, the cursor automatically moves to the next line. I am using jTextArea for taking input. Any help would be highly appreciated.
has title: handling String input at runtime in java
downvote count: 2
upvote count: 1
type: Question
tagged with: jtextarea
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31189703
has answer: http://stackoverflow.com/a/20804049

http://stackoverflow.com/comment/30973230
comment on: http://stackoverflow.com/q/20683361
type: Comment
type: QuestionComment
score: 2
has text: You should increase the count of calls in your benchmark to something like 5000 in a loop. **Then** you probably will get a better output!

http://stackoverflow.com/comment/31271379
comment on: http://stackoverflow.com/q/20836063
type: QuestionComment
type: Comment
score: 1
has text: "deployment procedure is too slow" Funny :-)

http://stackoverflow.com/q/20804063
has body: I am using NetBeans 7.3.1 and JavaFX 2.2. I am getting an error which says just '2' (not like NullPointerException, etc). When I change some 2-d Array values then error is some other number. StackTrace : Executing com.javafx.main.Main from (my project path).jar using platform D:\Java\jdk1.7.0_25/bin/java 2 this is my error. sometimes 6,5 ,etc file:/(my project path).jar!/&lt;project name&gt;/SelectionWindow.fxml at &lt;project name&gt;.SelectionWindowController.attachBrandImagesAndNamesToTiles(SelectionWindowController.java:92) at &lt;project name&gt;.SelectionWindowController.initialize(SelectionWindowController.java:33) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2152) at ..... all the trailing trace Explain me this error and how to solve it.
has comment: http://stackoverflow.com/comment/31190293
tagged with: java
tagged with: javafx
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/20804256
score: 0
tagged with: nullpointerexception
tagged with: exception
has answer: http://stackoverflow.com/a/20804168
has title: Unknown Exception/Error in JavaFX FXML 2.2
type: UnansweredQuestion

http://stackoverflow.com/comment/31005093
has text: hi mvieghofer thanx for replying..but this sol is not working. Runtime.getRuntime().exec("cmd /c start scheduler1.bat") is working.but cmd by default taking path where weblogic batch file is stored.the path address i m giving through code is not working.
comment on: http://stackoverflow.com/a/20698966
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/20776843
score: 0
answer count: 2
has body: I use this technique: http://webcache.googleusercontent.com/search?q=cache:gaSIT9QWcNcJ:eggie5.com/8-hook-share-picture-via-menu-android+&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=uk and it works amazingly. However, it works only when there's an internet connection. How can I make it work so when user doesn't have an internet connection, he shares the image to my app, and my app waits for internet to be available, and only then make a POST request? Current code doesn't make it work. Or the only way to do it, is just save it to the external storage, and when user opens my application, check if there's an internet connection, and if there is, send photos to the server which are not already saved in the server? Is there an easier way?
has answer: http://stackoverflow.com/a/20777039
type: UnansweredQuestion
tagged with: android
has title: Android: how to add app to “Share via” list for camera picture when there's no internet connection
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20777598

http://stackoverflow.com/q/20697446
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20697617
has answer: http://stackoverflow.com/a/20697617
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/20697846
has body: I have a text file "abc.txt" encoded in utf-8 data being a set of emoticons from wikipedia page: (^_^) happy My code extracts this info from the file to the netbeans stdout My code: public static void main(String[] args) throws FileNotFoundException { Scanner sc=new Scanner(new File("abc.txt")); while(sc.hasNext()){ System.out.println(sc.nextLine()); } } In netbeans the output is this : While in console the output is: What is this character? And how do I remove this?
linked to: http://stackoverflow.com/q/6769311
downvote count: 0
has comment: http://stackoverflow.com/comment/31000209
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/30999976
has comment: http://stackoverflow.com/comment/30999327
tagged with: netbeans
has answer: http://stackoverflow.com/a/20697846
upvote count: 1
has comment: http://stackoverflow.com/comment/31000119
type: AnsweredQuestion
has title: Unknown Character in Netbeans and Console

http://stackoverflow.com/a/20837351
has comment: http://stackoverflow.com/comment/31262898
has comment: http://stackoverflow.com/comment/31260036
has comment: http://stackoverflow.com/comment/31254388
downvote count: 0
answers question: http://stackoverflow.com/q/20833969
type: Answer
has comment: http://stackoverflow.com/comment/31258473
upvote count: 3
score: 3
has body: As shown here, here and here, the JComponent.sizeVariant property value is a String, e.g. "mini", "small", "regular" and "large". For "scale" to work, the enclosing panel's layout must allow the component to resize. In the variation below, GridLayout is used: f.add(variantPanel("scale")); … private static JPanel variantPanel(String size) { JPanel variantPanel = new JPanel(new GridLayout()); … return variantPanel; }

http://stackoverflow.com/q/20803519
tagged with: java
type: Question
tagged with: websphere-7
answer count: 1
has answer: http://stackoverflow.com/a/20803647
tagged with: ear
has body: I have an ear application (myApp) that runs on a Websphere Application Server (WAS). I have a jar (myJar) that is loaded into the classpath of myApp when the WAS server is started. myJar has a class (MyInitClass) that reads from a db and loads a set of data (myData) into memory. This data gets read many times by myApp. The point is to get myData into memory to prevent doing a db call every time this data is used. This part works great! The solution I am trying to provide is a manual initialization of MyInitClass. myData gets changed from time to time and I would like to be able to reinitialize MyInitClass from a command line so I don't have to restart the application. Is this possible? myApp calls a class (MyClass) that has something like this: public static MyInitClass initClass; public boolean doStuff() { if (initClass == null) { // this method loads the data into initClass.myData array initClass.dataInitializer(); } else // no need to reload initClass.myData } I have created code similar to this in another class (MyManualInit): public static void main(String[] args) { MyClass.initClass = new MyInitClass(); MyClass.initClass.dataInitializer(); } When I run MyManualInit from command line it prints all the same debug info that gets printed during the initialization from myApp. But myApp does not recognize that MyInitClass has been reinitialized. I have printed System.out.println(System.getProperty("java.home")) from both processes to validate that I am using the same JRE to run both. Am I doing something obviously wrong here or does it just not work like that? I assumed if I ran MyManualInit on the same JRE it would work. MyClass, MyInitClass and MyManualInit are all in myJar. Please let me know if you need more info.
score: 0
accepted answer: http://stackoverflow.com/a/20803647
has title: How to initialize an application's java object from command line
type: AnsweredQuestion

http://stackoverflow.com/q/20724618
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: graphics
has comment: http://stackoverflow.com/comment/31048933
tagged with: java
type: Question
has body: I have a simple drawing app for android and I would like to detect if a user has clicked on a line. To speed this process up I would like to get the bounds of all the Paths and check if the user input is within the bounds to quickly eliminate some of the paths. The problem I am encountering is that the method: pathInstance.computeBounds(boundsObject,false); Always returns 0, Or rather a rect containing all 0's. Weirdly if I debug my app and while the app is stopped at a breakpoint I draw on the screen, the computeBounds works when the app continues to execute Has anyone had this before? I can post my code but I was just wondering if it was a common problem first? edit: I know what the problem is now and have hacked around it but This solution still doesn't work. The problem is is that when the user first inputs data eg a touch that touch is drawn to the screen and as I add points to that path it never updates the Bounds calculation. I am now manually iterating through the points and calculating the bounds myself. code: DrawingPanel.java: for (int index = 0; index &lt; mSketches.size(); index++) { Sketch s = mSketches.get(index); canvas.drawPath(s.getPath().getPath(), s.getPaint()); canvas.drawRect(10,10,50,50,rad); RectF temp = s.computeBounds(); for (int i = 0; i &lt; s.mEnds.size(); i++){ canvas.drawPoint(s.mEnds.get(i).first, s.mEnds.get(i).second , endsPaint); canvas.drawCircle(s.mEnds.get(i).first , s.mEnds.get(i).second , END_STICK_WIDTH, rad); } canvas.drawRect(s.computeBounds(),rad); } Where Sketch is basicly a Pair of paint and path. Thanks,
downvote count: 0
has comment: http://stackoverflow.com/comment/31050206
has comment: http://stackoverflow.com/comment/31050965
has title: compute bounds in Path object returns 0
tagged with: android
score: 1

http://stackoverflow.com/a/20791082
has comment: http://stackoverflow.com/comment/31183869
downvote count: 0
has comment: http://stackoverflow.com/comment/31187330
score: 1
has comment: http://stackoverflow.com/comment/31180219
has comment: http://stackoverflow.com/comment/31191888
type: Answer
has comment: http://stackoverflow.com/comment/31185677
has comment: http://stackoverflow.com/comment/31187628
has body: You can render any element inside the &lt;p:columns&gt; element. What you want to do is probably render the cell contents differently, depending on the column. You can try something like this : //classic rendering (for all cells) &lt;h:outputText value="#{car[column.property]}"/&gt; //conditional rendering (for 'report' cells only) &lt;h:panelGroup rendered="#{column.property == 'report'}"&gt; &lt;p:commandLink id="MRepShowButton" update=":form1:display" onclick="EditorDialog.show();" title="Editer le compte rendu"&gt; &lt;f:setPropertyActionListener value="#{exam}" target="#{dyna.selectedExamen}" /&gt; &lt;p:graphicImage id="img1" value="/images/study_Report_icons/Text/0.png" rendered="#{exam.examen.rapport.rapportWrittenState == null}"/&gt; &lt;p:graphicImage id="img2" value="/images/study_Report_icons/Text/#{exam.examen.rapport.rapportWrittenState}.png" rendered="#{exam.examen.rapport.rapportWrittenState != null}"/&gt; &lt;/p:commandLink&gt; &lt;/h:panelGroup&gt;
upvote count: 1
answers question: http://stackoverflow.com/q/20789832
has comment: http://stackoverflow.com/comment/31196086

http://stackoverflow.com/comment/31076713
has text: @Jayaprasad I mean running the batch file as an admin.
comment on: http://stackoverflow.com/q/20739732
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31057191
score: 0
type: Comment
has text: Thanks Tim for answering my first question and for the link.
type: AnswerComment
comment on: http://stackoverflow.com/a/20718900

http://stackoverflow.com/comment/31269281
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20846327
has text: HTTP isn't all that bad (especially if you GZip) but if you're that concerned, you shouldn't be using JSON. That's probably a way bigger overhead than HTTP is.

http://stackoverflow.com/q/20846883
has answer: http://stackoverflow.com/a/20846945
type: AnsweredQuestion
tagged with: rmi
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/20846945
type: Question
downvote count: 0
answer count: 1
has body: I would like to access an existing RMI server. I do not have access to its source code, so I would like to set up a client that calls an existing service in the RMI Server. What is the best way to create a client to invoke a particular method and can RMI be converted to a webservice? Below is the class I have created: package server; import com.SerialService; import java.rmi.Naming; public class NewClass { public static void main(String args[]) { //SerialService obj = null; try { SerialService obj = (SerialService) Naming.lookup("//localhost:8083/"); System.out.println(obj.getSerial()); } catch (Exception e) { e.printStackTrace(); } } }
has title: Accessing RMI Server
score: 1
favorite count: 0

http://stackoverflow.com/comment/31946700
has text: Thanks, the problem is solved by adding the LD_LIBRARY_PATH inside wsgi script.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20799735
score: 0

http://stackoverflow.com/a/20761186
has body: To create the CVS, I just use the toString() from List: String cvs = list.toString().replaceAll("[\\[\\] ]", ""); It's just one line of code and will work every time. The replaceAll() removes all square brackets and spaces. You may want to leave the spaces (which appear after commas).
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20761089
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31208670
comment on: http://stackoverflow.com/q/20813848
has text: @peeskillet I think OP is asking for that class which is not here..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20795053
tagged with: escaping
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20795077
type: Question
has body: When using angle brackets in Java regex, what is difference between "\\&lt;" and just "&lt;"? When I tested, the result was same(or I might miss some cases). If they are same, why people add "\\" redundantly? Like this or this? Note: I'm not asking how I can remove HTML from string, so please don't recommend me like JSoup or JTidy.
has title: replaceAll("\\<.?>") vs replaceAll("<.?>")
linked to: http://stackoverflow.com/q/1732348
accepted answer: http://stackoverflow.com/a/20795077
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31174641
favorite count: 0
upvote count: 2
tagged with: regex

http://stackoverflow.com/q/20680589
type: Question
tagged with: ant
tagged with: osx-mavericks
tagged with: java
has body: today I have update my OS to Mavericks from Lion and now the ANT command doesn't works :( this is the error: iMac:$ ant Error: JAVA_HOME is not defined correctly. We cannot execute /System/Library/Frameworks/JavaVM.framework/Home/bin/java iMac:$ I tried to write this: export JAVA_HOME="$(/System/Library/Frameworks/JavaVM.framework/Versions/Current/Comman‌​ds/java_home)" in ~/.bash_profile but I have always the same error... :( There some people can help me?
has title: Error ANT command in OS Mavericks
answer count: 1
has answer: http://stackoverflow.com/a/20682879
score: 0
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/a/20763001
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20762663
type: Answer
upvote count: 1
has body: The exception that you printed reference to Form is ambiguous; it is imported twice in the same scope by import play.data._ and import play.api.data._ means that there are two classes with name Form one under package play.data._ , the other one under the package play.api.data._ I would recommend that you explicitly do your imports that means import just classes you would use.

http://stackoverflow.com/q/20830999
score: 0
tagged with: java
tagged with: reload
has title: WebViewClient always reloads site
answer count: 1
type: UnansweredQuestion
has body: my WebViewClient always reloads the site it shows. It looks like a stroboscope. At first it gets his values from another activity, than it insert them supported by javascript and get to the "target" site. Up to this action everything is ok but then it flickers. How can I prevent that? Here's my code: public class Webview extends Activity { WebView webView; String site = "xyz.com"; private String bnm, pwd1; private ProgressBar bar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.web_view); webView = (WebView) findViewById(R.id.webView1); bnm = getIntent().getStringExtra("benutzername"); pwd1 = getIntent().getStringExtra("password"); website(site); } public void website(String website) { website = site; bar = (ProgressBar) findViewById(R.id.progressBar1); webView.setVisibility(View.GONE); bar.setVisibility(View.VISIBLE); if (!DetectConnection.checkInternetConnection(this)) { Toast.makeText(getApplicationContext(), "No Internet!", Toast.LENGTH_LONG).show(); Intent intent = new Intent(Webview.this, MainActivity.class); startActivity(intent); } else { webView.loadUrl(site); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.getSettings().setBuiltInZoomControls(true); webView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { String user=bnm; String pwd= pwd1; view.loadUrl("javascript:document.getElementById('username').value = '"+user+"';document.getElementById('password').value='"+pwd+"';"+"document.getElementById('submit').click();"); view.loadUrl("xyz.com"); bar.setVisibility(View.GONE); webView.setVisibility(View.VISIBLE); } }); } } }
type: Question
tagged with: android
tagged with: webview
has answer: http://stackoverflow.com/a/20832195

http://stackoverflow.com/comment/31203875
score: 1
has text: Why not just use HTTPS?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20811236

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/20734913

http://stackoverflow.com/comment/30997764
score: 0
has text: are you running your application on emulator?
comment on: http://stackoverflow.com/q/20695918
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31081011
has text: Is using Guava's [BiMap](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/BiMap.html) an option?
comment on: http://stackoverflow.com/q/20742438
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/31246022
comment on: http://stackoverflow.com/q/20831925
score: 0
type: QuestionComment
type: Comment
has text: I get that, but how do I get it to return that object while passing in a db object (which I assume is necessary because my issue before wsd calling the database recursively)

http://stackoverflow.com/q/20725044
possible better answer: http://stackoverflow.com/a/20725070
has answer: http://stackoverflow.com/a/20725070
has title: "new" keyword with Comparator Interface
has comment: http://stackoverflow.com/comment/31049602
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I got a question in my interview that while sorting objects of generic class(lets say objects of an "Employee class" which contains variable "EmpId" and "EmpName")when I use comparator in my Collection.sort() mothod then I need to use "new" keyword along with the comparator. We all know that comparator is an interface and it can not be instantiated. So how and why are we using the "new" keyword with it? As I found this question very interesting I thought of sharing it with all of you. Any help is appreciated. Here is the portion of sample code I am posting:- ArrayList&lt;Employee&gt; emp= new ArrayLisy&lt;Employee&gt;(); Collection.sort(emp, new Comparator(){ public int compare(emp e1, emp e2) { if(e1.getId&gt;e2.getId) { return 1; } if(e1.getId&lt;e2.getId) { return -1; } else return 0; } }) My question is why are we using "new" keyword with Comparator interface here? Thanks
answer count: 2
has answer: http://stackoverflow.com/a/20725057
upvote count: 1
has comment: http://stackoverflow.com/comment/31049578
accepted answer: http://stackoverflow.com/a/20725057
linked to: http://stackoverflow.com/q/11069056
tagged with: java

http://stackoverflow.com/q/20805383
has comment: http://stackoverflow.com/comment/31192810
has comment: http://stackoverflow.com/comment/31192865
has body: I would like to make a copy of a string without having a string variable reference the previous string. Would the toString() method be the solution? In other words, does String.toString() return a copy of its characters rather than a reference to itself?
has comment: http://stackoverflow.com/comment/31193025
has comment: http://stackoverflow.com/comment/31192755
score: 0
has comment: http://stackoverflow.com/comment/31192792
has title: String toString() Method
accepted answer: http://stackoverflow.com/a/20805408
tagged with: string
has answer: http://stackoverflow.com/a/20805439
has answer: http://stackoverflow.com/a/20805416
favorite count: 0
has answer: http://stackoverflow.com/a/20805405
has comment: http://stackoverflow.com/comment/31192798
possible better answer: http://stackoverflow.com/a/20805416
answer count: 4
tagged with: reference
tagged with: tostring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/56991409
upvote count: 3
linked to: http://stackoverflow.com/q/3615721
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/20805408
type: Question

http://stackoverflow.com/a/20739648
has body: I think the problem is in working directory location. When you running startup.bat it tries to find a catalina.bat file in a directory where you started your Java class but not in a directory where Tomcat located. You can try modify your code with next manner public static void main(String args[]){ Runtime runtime = Runtime.getRuntime(); try { File workingDirectory = new File("D:\\Apache_Tomcat64\\bin"); Process p1 = runtime.exec("cmd /c start D:\\Apache_Tomcat64\\bin\\startup.bat", new String[0], workingDirectory); InputStream is = p1.getInputStream(); int i = 0; while( (i = is.read() ) != -1) { System.out.print((char)i); } } catch(IOException ioException) { System.out.println(ioException.getMessage() ); } }
answers question: http://stackoverflow.com/q/20739520
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/31034084
comment on: http://stackoverflow.com/q/20716454
type: Comment
type: QuestionComment
has text: You should also look at JavaFX which is touted to replace Swing.
score: 0

http://stackoverflow.com/comment/31217997
type: Comment
type: QuestionComment
has text: I don't understand what you are doing with the addresses. If the sever and client are on different boxes, "127.0.0.1", ie. localhost, is not going to work for sure.
score: 1
comment on: http://stackoverflow.com/q/20818487

http://stackoverflow.com/comment/31051406
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20726040
has text: @user3126466: In this case, there is no use. There are no overridden methods in your example.

http://stackoverflow.com/comment/31244969
type: Comment
comment on: http://stackoverflow.com/a/20831904
type: AnswerComment
score: 0
has text: Those classes/interfaces should all be provided by the application server. Why do you need to override them?

http://stackoverflow.com/q/20772811
tagged with: matrix
has title: Can a JRadioButton be in several ButtonGroups?
has comment: http://stackoverflow.com/comment/31135036
has comment: http://stackoverflow.com/comment/31134958
favorite count: 0
has comment: http://stackoverflow.com/comment/31135249
downvote count: 0
has comment: http://stackoverflow.com/comment/31135114
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20773012
tagged with: jradiobutton
tagged with: swing
has comment: http://stackoverflow.com/comment/31135074
has answer: http://stackoverflow.com/a/20775836
score: 2
has comment: http://stackoverflow.com/comment/31135096
tagged with: java
tagged with: buttongroup
type: Question
has comment: http://stackoverflow.com/comment/31135101
upvote count: 2
has body: I'm trying to set up a JRadioButton-Matrix, so that in each column and in each row, only one Button can be selected at a time. I have the following code: JRadioButton[][] button = new JRadioButton[names.length][names.length]; ButtonGroup[] r = new ButtonGroup[names.length]; ButtonGroup[] c = new ButtonGroup[names.length]; for (int i = 0; i &lt; names.length; i++) { r[i] = new ButtonGroup(); c[i] = new ButtonGroup(); } for (int i = 0; i &lt; names.length; i++) { for (int j = 0; j &lt; names.length; j++) { button[i][j] = new JRadioButton(); r[i].add(button[i][j]); c[j].add(button[i][j]); } } But when I execute it, only the columns behave properly (i.e. the Buttons in the groups of c). When I comment the parts with c, however, the rows do behave properly. To clear things a bit up (thanks to peeskillet): Lets say I have this 4 x 4 matrix of JRadioButtons: O O O O O O O O O O O O O O O O And I want to make it possible to make choices like these: X O O O X O O O O X O O O X O O O O X O X O O O O O X O O X O O O O O X O O O X O O O X O O X O In the above, each column only has one and each row only has one. The following examples would NOT be possible: X X O O X O O O O O O O O X O O O O X O O X O O O O O X O O O X However, the problem is, I CAN choose like in the above left matrix, but not the right. If I comment the following parts: ButtonGroup[] c = new ButtonGroup[names.length]; c[i] = new ButtonGroup(); c[j].add(button[i][j]); then the matrix on the above right is possible, but not the left.
has comment: http://stackoverflow.com/comment/31134877
has answer: http://stackoverflow.com/a/20773130
has comment: http://stackoverflow.com/comment/31135047
has comment: http://stackoverflow.com/comment/31135237
answer count: 3

http://stackoverflow.com/comment/31194182
has text: As @JimGarrison said, you cannot expect to union every pair of intervals. If there is a gap then you need an extra type to represent a collection of non-contiguous intervals. This type does not exist in JodaTime, also no corresponding union-method which delivers an array or a collection or similar.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20806032

http://stackoverflow.com/comment/31274961
comment on: http://stackoverflow.com/q/20849263
type: QuestionComment
has text: What do you mean returning false? I see nothing that returns a boolean.
score: 1
type: Comment

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/20837579
type: Tag

http://stackoverflow.com/q/20700793
has comment: http://stackoverflow.com/comment/31004526
favorite count: 0
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31636325
has body: I want to get a Locale from a String and i ask myself what is the best choice between use the native API Locale.forLanguageTag and LocaleUtils.toLocale from Commons lang. Thanks in advance for your opinion
tagged with: java
has answer: http://stackoverflow.com/a/20700912
has title: Java get Locale from String
score: -1
accepted answer: http://stackoverflow.com/a/20700912
upvote count: 0
answer count: 1

http://stackoverflow.com/q/20752756
has comment: http://stackoverflow.com/comment/31101287
type: Question
has body: Looking at JDK 1.7 API. I cannot seem to be able to set a connection timeout on an AsynchonousSocketChannel. Is there any way I can set up a connection timeout on such a channel?
has comment: http://stackoverflow.com/comment/31100293
tagged with: java
has title: How to set Java NIO AsynchronousSocketChannel connect timeout
tagged with: nio
linked to: http://stackoverflow.com/q/2597608
has answer: http://stackoverflow.com/a/20753518
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31101382
favorite count: 0
upvote count: 8
tagged with: sockets
has comment: http://stackoverflow.com/comment/31102953
tagged with: asynchronous
score: 8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20753518
has comment: http://stackoverflow.com/comment/31100411
has comment: http://stackoverflow.com/comment/31102490

http://stackoverflow.com/a/20766513
score: 0
has comment: http://stackoverflow.com/comment/31124145
has body: ThreadPoolExecutor expects a BlockingQueue&lt;Runnable&gt;, which ReplicatedBlockingQueue isn't, since it is a BlockingQueue&lt;E extends Serializable&gt;. You need to declare ReplicatedBlockingQueue&lt;E extends Serializable &amp; Runnable&gt; to make E extend Runnable and be usable as a return type for the methods inherited from BlockingQueue, and you must parametrize BlockingQueue with Runnable, as it is the explicitly expected type for ThreadPoolExecutor. public class ReplicatedBlockingQueue&lt;E extends Serializable &amp; Runnable&gt; implements BlockingQueue&lt;Runnable&gt; { @Override public E remove() { } ...
type: Answer
has comment: http://stackoverflow.com/comment/31124203
answers question: http://stackoverflow.com/q/20766324
has comment: http://stackoverflow.com/comment/31143679

http://stackoverflow.com/comment/30975252
has text: i need to use the list values in the jsp page and then read the file and send it with my required values
type: QuestionComment
comment on: http://stackoverflow.com/q/20684428
score: 0
type: Comment

http://stackoverflow.com/comment/31244632
type: QuestionComment
comment on: http://stackoverflow.com/q/20832857
score: 0
has text: How can i detect the subclass using abstract method?Can you give me a little example?Thanks
type: Comment

http://stackoverflow.com/q/20680842
has comment: http://stackoverflow.com/comment/30978844
favorite count: 0
has answer: http://stackoverflow.com/a/20712749
downvote count: 0
has answer: http://stackoverflow.com/a/20693722
accepted answer: http://stackoverflow.com/a/20693722
type: AnsweredQuestion
has title: Google Wallet Online API
tagged with: android-pay
score: 1
tagged with: java
has body: After a long research of almost two days I found myself helpless and now putting a question here. I need to implement Google Wallet into my website. My web app is offering few online services and to use them a user has to pay. I have successfully integrated PayPal into my web app. Google wallet is my second target , what I figure out is to use Instant Buy API but I only need a java code for both server and client side which is not available, then I came across Google Wallet Online API (java)but unable to understand how to use the API. Again searched a lot for samples of the same but unable to find, any help or reference to any implementation of the above API is appreciated.
type: Question
possible better answer: http://stackoverflow.com/a/20712749
has comment: http://stackoverflow.com/comment/71242273
answer count: 2
upvote count: 1
tagged with: google-api-java-client

http://stackoverflow.com/comment/31210334
type: QuestionComment
has text: Why vote to close? I already referred in lot of places but didn't found this kind of scenario.
comment on: http://stackoverflow.com/q/20814314
score: 0
type: Comment

http://stackoverflow.com/a/20759832
score: 2
upvote count: 2
has body: new ImageAdapter(this) Needs a constructor that takes context as the param. Change this public void ImageAdapater(Context c) { //remove void for constructor to public ImageAdapater(Context c) { More info http://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
accepted answer of: http://stackoverflow.com/q/20759819
answers question: http://stackoverflow.com/q/20759819
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31115531
type: Answer

http://stackoverflow.com/comment/31121737
type: Comment
has text: min SDK is : 8 is it OK ? I mean the device's cpu is low that it isn't upgraded to 2.3.6 then doesn't this code reduce the program's running speed ?
comment on: http://stackoverflow.com/a/20763591
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31111035
has text: @Ketan I got error on 12-24 17:36:34.510: E/AndroidRuntime(5973): java.lang.RuntimeException: Content has view with id attribute 'android.R.id.list' that is not a ListView class did I use wrong extends or use the id attribute wrong?
comment on: http://stackoverflow.com/q/20757135
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/20803111
score: 56
has comment: http://stackoverflow.com/comment/35437916
accepted answer of: http://stackoverflow.com/q/20773850
upvote count: 60
has body: The syntax you are proposing is invalid. The following new TypeToken&lt;ArrayList&lt;Class.forName(MyClass)&gt;&gt; is invalid because you're trying to pass a method invocation where a type name is expected. The following new TypeToken&lt;ArrayList&lt;T&gt;&gt;() is not possible because of how generics (type erasure) and reflection works. The whole TypeToken hack works because Class#getGenericSuperclass() does the following 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. In other words, if it sees ArrayList&lt;T&gt;, that's the ParameterizedType it will return and you won't be able to extract the compile time value that the type variable T would have had. Type and ParameterizedType are both interfaces. You can provide an instance of your own implementation (define a class that implements either interface and overrides its methods) or use one of the helpful factory methods that TypeToken provides in its latest versions. For example, private Type setModelAndGetCorrespondingList2(Class&lt;?&gt; typeArgument) { return TypeToken.getParameterized(ArrayList.class, typeArgument).getType(); }
downvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35437614
type: Answer
answers question: http://stackoverflow.com/q/20773850
has comment: http://stackoverflow.com/comment/35437877

http://stackoverflow.com/comment/31124582
score: 0
type: AnswerComment
has text: It should probably be a field on the containing class. If you want advice on how to refactor your program you should look at http://codereview.stackexchange.com where it's more on-topic. SO is intended for solving more specific problems. Also with your update, I don't understand what your rules are intended to be. What you've changed it to isn't the same as what I've suggested. Now `guess` is incremented for every character that's not the `userEnteredChar` so the user could "die" if they make a guess that's correct.
type: Comment
comment on: http://stackoverflow.com/a/20766264

http://stackoverflow.com/comment/31260530
has text: This code doesn't make any sense. You have a method that tries to be a constructor, and a constructor that's trying to assign variables that don't exist.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20841805

http://stackoverflow.com/a/20837111
score: 0
answers question: http://stackoverflow.com/q/20836400
has comment: http://stackoverflow.com/comment/31253302
has comment: http://stackoverflow.com/comment/31252147
has comment: http://stackoverflow.com/comment/31252798
type: Answer
has comment: http://stackoverflow.com/comment/31252272
has comment: http://stackoverflow.com/comment/31252912
has body: As its name suggests Text.setText sets the text displayed in the control and discards any previous text. So you need to construct a string containing all the data you want to show in the control and call setText with this. You could use a StringBuilder for this, something like: StringBuilder buff = new StringBuilder(); for (Object element : al) { buff.append(element).append("\n"); } text.setText(buff.toString()); You will need to create the control specifying the SWT.MULTI style and make sure it is sized to show multiple lines.

http://stackoverflow.com/a/20814331
score: 4
has comment: http://stackoverflow.com/comment/36140929
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31209735
answers question: http://stackoverflow.com/q/20814288
type: Answer
has body: Read the documentation on matches. The "match" requires the entire string to match, and so your table1.matches("\\d") fails -- "table1" is not 'one digit only'. Use table1.matches(".*\\d.*") instead. Note the double backslash! You might not be aware they need escaping in a String constant.
has comment: http://stackoverflow.com/comment/31209712
upvote count: 4
accepted answer of: http://stackoverflow.com/q/20814288

http://stackoverflow.com/comment/31002048
score: 0
type: AnswerComment
type: Comment
has text: Thank you, but once I tried `/*`, I can't even access index.jsp(which is accessible before) and get 404.
comment on: http://stackoverflow.com/a/20699108

http://stackoverflow.com/a/20774986
answers question: http://stackoverflow.com/q/20774930
score: 3
has comment: http://stackoverflow.com/comment/31139089
downvote count: 0
has body: With JPA you can add locking mechanisms, Since version 2.0 you have support for optimistic and pessimistic locking, In the optimistic version you can add a version column that allows to check if the correct version of the entity is changing, in the other hand pessimistic lock use database locking sentences. In your case you can set a block in the query with Query.setLockMode. In this article you can have more information
type: Answer
upvote count: 3

http://stackoverflow.com/comment/31224799
type: Comment
has text: I see.. It might be silly question to ask but I assume my understanding is correct. But still asking.. if somebody ask you to implement asynchronous method, then we should return future back to them? Correct? And customer who is calling can take care of adding further timeouts as needed in there call to our client code?
comment on: http://stackoverflow.com/a/20822221
score: 0
type: AnswerComment

http://stackoverflow.com/q/20733472
score: 3
downvote count: 0
tagged with: java
tagged with: date
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31064831
accepted answer: http://stackoverflow.com/a/20733507
duplicate of: http://stackoverflow.com/q/3758982
upvote count: 3
has title: Why Calendar.before() and Calendar.after() accept object value?
has comment: http://stackoverflow.com/comment/31064750
tagged with: datetime
has answer: http://stackoverflow.com/a/20733507
favorite count: 0
has body: I was having a problem because I was trying to pass a Date to Calendar.before() and Calendar.after() instead of passing a Calendar. If a date is passed these methods always return false.
possible better answer: http://stackoverflow.com/a/20733534
linked to: http://stackoverflow.com/q/3758982
has answer: http://stackoverflow.com/a/20733534
type: AnsweredQuestion

http://stackoverflow.com/a/20725794
type: AcceptedAnswer
score: 0
type: Answer
has body: Try this out. I think you want to use key bindings and not a KeyListener. See the code beloww. I've binded the four arrow keys to different actions. Take a look at How to use Key Bindings import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; public class KeyBindings extends JPanel { public KeyBindings(){ Action upAction = new AbstractAction(){ @Override public void actionPerformed(ActionEvent e) { System.out.println("Down Arrow Pressed"); } }; Action downAction = new AbstractAction(){ @Override public void actionPerformed(ActionEvent e) { System.out.println("Down Arrow Pressed"); } }; Action leftAction = new AbstractAction(){ @Override public void actionPerformed(ActionEvent e) { System.out.println("Left Arrow Pressed"); } }; Action rightAction = new AbstractAction(){ @Override public void actionPerformed(ActionEvent e) { System.out.println("Right Arrow Pressed"); } }; getInputMap().put(KeyStroke.getKeyStroke("UP"), "upAction"); getActionMap().put("upAction", upAction); getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "downAction"); getActionMap().put("downAction", downAction); getInputMap().put(KeyStroke.getKeyStroke("LEFT"), "leftAction"); getActionMap().put("leftAction", leftAction); getInputMap().put(KeyStroke.getKeyStroke("RIGHT"), "rightAction"); getActionMap().put("rightAction", rightAction); } public Dimension getPreferredSize(){ return new Dimension(300, 300); } public static void createAndShowGui(){ JFrame frame = new JFrame(); frame.add(new KeyBindings()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ createAndShowGui(); } }); } }
accepted answer of: http://stackoverflow.com/q/20725621
answers question: http://stackoverflow.com/q/20725621

http://stackoverflow.com/comment/31168871
score: 0
comment on: http://stackoverflow.com/a/20791109
type: Comment
has text: The general opinion is that Java generics (erasure) leave some to be desired but they're still immensely useful. The upside to erasure is that reification is cumbersome to implement.
type: AnswerComment

http://stackoverflow.com/comment/31309281
comment on: http://stackoverflow.com/a/20860765
type: AnswerComment
score: 0
type: Comment
has text: Thanks Chris White. Now they are the same content :)

http://stackoverflow.com/q/20842904
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20843061
has body: I capture song in real-time with TargetDataLine: line.read(buffer, 0, buffer.length); But this buffer have to be byte array. I need capture to buffer which is long array or float array. I try to convert from byte to long or float but these data are not correct. How Can I capture with another type or covert byte to float/long in correct way?
tagged with: audio
type: AnsweredQuestion
tagged with: capture
tagged with: java
has comment: http://stackoverflow.com/comment/31262651
type: Question
accepted answer: http://stackoverflow.com/a/20843061
has comment: http://stackoverflow.com/comment/31262696
has title: Java capture sound real-time

http://stackoverflow.com/q/20703300
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I'm trying to create a custom sonar plugin that consists of a widget on the global dashboard. I want this to display a "global" metric. So for example, a metric showing the number of lines across all projects. Is this possible, if so how can I go about this? I can only find example projects that run project specific metrics. They output them in the ruby template like this: format_measure('random'). I am guessing this format measure only works in project context. The documentation is extremely light on this whole process. So if anyone knows of any good documentation or guides that would also be useful, currently trying to piece together what I want to do from about 10 other plugins. The only documentation I have found is here: http://docs.sonarqube.org/display/SONAR/Developing+Plugins
type: Question
score: 1
tagged with: java
has title: Sonar Plugin Development - Create a global metric
has answer: http://stackoverflow.com/a/25842907
tagged with: sonarqube
has answer: http://stackoverflow.com/a/20704846

http://stackoverflow.com/a/20785507
answers question: http://stackoverflow.com/q/20785332
has body: the Handler is a perfect candidate for such tasks (dont try to combine TimerTask + runOnUiThread - it is useless as it uses a Handler under the hood)
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/20763611
has answer: http://stackoverflow.com/a/20763705
tagged with: c++
score: 1
tagged with: java
upvote count: 1
has title: Catch a signal in C program run through ProcessBuilder
type: Question
type: AnsweredQuestion
has body: I want to run a c program, on eclipse, through JAVA ProcessBuilder, now at some place I want to send termination signal to the program, the program is supposed to catch that signal and perform task that is required then terminates. Now I know how to handle signals, but how can i send signals from ProcessBuilder to my program. Any help will be appreciated!
tagged with: signals
accepted answer: http://stackoverflow.com/a/20763705
answer count: 1
downvote count: 0
tagged with: exec
favorite count: 0
tagged with: processbuilder

http://stackoverflow.com/a/20821552
has body: Database If you are using a good database with sophisticated date-time handling, such as Postgres, the database server may be able to help you by performing queries. Perhaps you are not using such a database, as you mention that date and time are separate fields. In a sophisticated database those would be a single date-time type. Time Zone Your question fails to address the issue of time zones. Generally best to specify a time zone rather than rely on defaults. For my example code below, I arbitrarily chose Kolkata India (formerly Calcutta) time zone with an offset of 5:30 ahead of UTC/GMT. Use Joda-Time If you want to do the work in Java, you definitely should avoid using the bundled java.util.Date/Calendar classes. Either use the Joda-Time library, or in Java 8, the new java.time.* classes (inspired by Joda-Time). Joda-Time offers classes with handy methods for your very purpose: Interval, Duration, and Period. Java 8's java.time.* offers similar. The Interval class holds a span of time defined by a pair of start-stop DateTime objects. The class offers a overlaps method to tell you if one interval coincides with another. Example code // © 2013 Basil Bourque. This source code may be used freely forever by anyone taking full responsibility for doing so. // import org.joda.time.*; // import org.joda.time.format.*; DateTimeZone timeZone = DateTimeZone.forID( "Asia/Kolkata" ); Interval i1 = new Interval( new DateTime( "2013-12-10T10:00:00", timeZone ), new DateTime( "2013-12-12T15:00:00", timeZone ) ); Interval i2 = new Interval( new DateTime( "2013-12-16T09:00:00", timeZone ), new DateTime( "2013-12-16T12:00:00", timeZone ) ); Interval i3 = new Interval( new DateTime( "2013-12-16T12:15:00", timeZone ), new DateTime( "2013-12-16T16:00:00", timeZone ) ); Interval test1 = new Interval( new DateTime( "2011-01-01T10:00:00", timeZone ), new DateTime( "2011-01-07T10:00:00", timeZone ) ); // Note the year: 2011. Interval test2 = new Interval( new DateTime( "2013-12-10T11:00:0…
type: Answer
score: 0
answers question: http://stackoverflow.com/q/20819872

http://stackoverflow.com/comment/31267262
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20845239
has text: @HotLicks I added the exception messages.
score: 0

http://stackoverflow.com/a/20767802
upvote count: 5
has body: I would get the value this way - public static boolean hasRetinaDisplay() { Object obj = Toolkit.getDefaultToolkit() .getDesktopProperty( "apple.awt.contentScaleFactor"); if (obj instanceof Float) { Float f = (Float) obj; int scale = f.intValue(); return (scale == 2); // 1 indicates a regular mac display. } return false; }
accepted answer of: http://stackoverflow.com/q/20767708
has comment: http://stackoverflow.com/comment/31126374
has comment: http://stackoverflow.com/comment/38903336
answers question: http://stackoverflow.com/q/20767708
score: 3
has comment: http://stackoverflow.com/comment/31126357
has comment: http://stackoverflow.com/comment/43805848
has comment: http://stackoverflow.com/comment/108633690
downvote count: 2
has comment: http://stackoverflow.com/comment/31126421
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/68049801
has comment: http://stackoverflow.com/comment/112142893
type: Answer
has comment: http://stackoverflow.com/comment/108632664

http://stackoverflow.com/a/20814926
has body: Your syntax is wrong there's no active[] &lt;byte&gt; = 1; in Java If you want to assign it a value You can do it in this way active[0] = 1; inactive[0] = 0; But there's no need for array to use it as a boolean you can just define it as a byte byte active= 1; byte inactive= 0;
has comment: http://stackoverflow.com/comment/31210770
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31210663
has comment: http://stackoverflow.com/comment/31210577
has comment: http://stackoverflow.com/comment/31210711
upvote count: 2
answers question: http://stackoverflow.com/q/20814903
has comment: http://stackoverflow.com/comment/31210616
type: Answer

http://stackoverflow.com/a/20761885
has comment: http://stackoverflow.com/comment/31115701
type: Answer
answers question: http://stackoverflow.com/q/20761757
has body: The jar file is required to be on classpath when the project is deployed which should contain the mentioned in the error class. To make sure the file is deployed you can place it in web-inf/lib as a temporary measure. You can also assemble a file to the war archive to be deployed at whole. The library file I'm talking about is freemarker-2.3.19.jar If you are using maven then the following dependencies required in your pom.xml org.apache.struts struts2-core 2.3.16 org.freemarker freemarker 2.3.19
score: 0

http://stackoverflow.com/comment/31202177
score: 0
comment on: http://stackoverflow.com/a/20810320
type: AnswerComment
type: Comment
has text: Volatile is not what you want (you don't want the null pointer right?) and it's suprisingly slow nowadays. Avoid at all costs. Final is better, but wont protect you if another thread tries to read the variable.

http://stackoverflow.com/q/20762356
tagged with: junit
has answer: http://stackoverflow.com/a/20765061
upvote count: 2
type: UnansweredQuestion
tagged with: jetty
tagged with: maven
has body: I'm gonna create integration tests for REST API. So, I'd like to run Jetty before tests and stop it after tests. I've got Connection Refused Error for each Tests. My POM.XML's build section is written below: org.mortbay.jetty maven-jetty-plugin 0 foo 9999 8010 60000 /performance-parser-service start-jetty pre-integration-test run 0 true stop-jetty post-integration-test stop org.apache.maven.plugins maven-surefire-plugin 2.16 performance-parser-service-it integration-test test false Could you help me for solving this issue? Best Regards,
score: 2
has title: Running Jetty using Maven before Integration Test
has comment: http://stackoverflow.com/comment/31117122
has answer: http://stackoverflow.com/a/27157842
tagged with: java
tagged with: integration-testing
type: Question
has answer: http://stackoverflow.com/a/21270762
has comment: http://stackoverflow.com/comment/31116422
downvote count: 0
favorite count: 0
answer count: 3

http://stackoverflow.com/comment/31166992
score: 0
type: Comment
has text: You just need to declare the person_id within the DomainObject class but within the mapping file you need to declare it for all classes which derive from DomainInfo. The declaration (mapping) must be identical within all mappings. The generator also. If you choose this strazegy then a DomainTsble must exist and can be creazed automatically by hibrrnate if not present.
type: AnswerComment
comment on: http://stackoverflow.com/a/20710343

http://stackoverflow.com/a/20704372
answers question: http://stackoverflow.com/q/20704339
type: Answer
has comment: http://stackoverflow.com/comment/31073490
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31038556
upvote count: 1
has body: you have to iterate over the array and do it for every string, because substring() is a method of the string class and not of the array class. The errormessage Cannot invoke substring(int, int) on the array type String[] tell you that you try do build a substring of an Stringarray. change: result.append(arr.substring(0,7)); to: result.append(arr[0].substring(0,7)); and put in in a for-loop: for(int i = 0; i&lt;arr.length(); i++) result.append(arr[i].substring(0,7));
has comment: http://stackoverflow.com/comment/31012595

http://stackoverflow.com/q/20800360
linked to: http://stackoverflow.com/q/17546101
has answer: http://stackoverflow.com/a/20800416
accepted answer: http://stackoverflow.com/a/20800416
type: AnsweredQuestion
tagged with: java
has title: Android - startActivityForResult for getting file's path
tagged with: file
has body: I'm writing a simple image viewer for Android. My app have the "Open file from Gallery" button. So, when I've choosed the image from Gallery, it must return the path to file into my app, but it return a strange Uri, which looks like content://media/storage/2ch/30128. How I can get an absolute file path from this Uri? Here's some code for launching Gallery: Intent i = new Intent(); i.setType("image/*"); i.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(i, "Выберите файл"), PICTURE_REQUEST_CODE); P.S. Excuse for my English
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/20800408
answer count: 3
has answer: http://stackoverflow.com/a/20800408
tagged with: uri
has answer: http://stackoverflow.com/a/20800538
has comment: http://stackoverflow.com/comment/31183685
tagged with: android

http://stackoverflow.com/q/20699068
tagged with: tomcat7
accepted answer: http://stackoverflow.com/a/20733893
has body: I run Tomcat7 using JDK7 on Centos6. I enable JMX using the following options: CATALINA_OPTS="${CATALINA_OPTS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9123 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=true" Unfortunately, when I check what ports are opened I discover 2 additional random ports: netstat -plunt | grep java Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 :::60555 :::* LISTEN 22752/java tcp 0 0 ::ffff:127.0.0.1:8080 :::* LISTEN 22752/java tcp 0 0 :::9123 :::* LISTEN 22752/java tcp 0 0 :::40867 :::* LISTEN 22752/java I guess that JMX should open one additional port JMX enabled Java application appears to open a random high order port when JMX client connects Why JMX in Tomcat opens 2 additional ports? How can I configure these ports? If I configure -Dcom.sun.management.jmxremote.local.only=true means additional ports also can be accessed using local access only? How can I configure ::ffff:127.0.0.1 will appear before all ports opened by JMX?
type: Question
score: 3
tagged with: security
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20733893
tagged with: port
tagged with: jmx
has title: Tomcat7 with enabled JMX opens 2 additional random listening ports
linked to: http://stackoverflow.com/q/7163173
type: AnsweredQuestion
upvote count: 3
tagged with: java

http://stackoverflow.com/a/20760839
score: 0
type: Answer
has body: ((Button)findViewById(R.id.btnData)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub NAMESPACE = "http://tempuri.org/"; URL = "http://YOURURL/Service.asmx"; SOAP_ACTION = "http://tempuri.org/SetLoginData"; METHOD_NAME = "SetLoginData"; EditText uname = (EditText) findViewById(R.id.editText1); EditText pwd = (EditText) findViewById(R.id.editText2); String dataToSend="[{'UserID':uname.getText().toString() ,'Password':pwd.getText().toString() }]"; SendData(dataToSend); } }); } public void SendData(String data){ Log.d(TAG, "SendData"); Log.d(TAG, "URL : "+URL); Log.d(TAG, "ACTION: "+SOAP_ACTION); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); Log.d(TAG, "Create"); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); String dataToSend=data; Log.d(TAG, "dataToSend: "+dataToSend); PropertyInfo FromCurrency = new PropertyInfo(); FromCurrency.setName("strInputData"); FromCurrency.setValue(dataToSend); FromCurrency.setType(String.class); request.addProperty(FromCurrency); Log.d(TAG, "envelope"); // Create the envelop.Envelop will be used to send the request SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.implicitTypes=true; envelope.setAddAdornments(false); envelope.setOutputSoapObject(request); // Says that the soap webservice is a .Net service envelope.dotNet = true; Log.d(TAG, "URL"); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { Log.d(TAG, "call"); androidHttpTransport.call(SOAP_ACTION, envelope); Log.d(TAG, "call1"); SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); Log.d(TAG,"response:"+ response.toString()); TextView v = (TextView) findViewById(R.id.currency); v.setText("Retururn Responce" + "= " + response.toString() ); } catch (Exception e){ e.printStackTrace(); } } This webservice will take json data that's why i had passe…
answers question: http://stackoverflow.com/q/20757728

http://stackoverflow.com/a/20779906
answers question: http://stackoverflow.com/q/20778881
has body: The problem isn't that your Book is static, the problem is more simply that it's the same object every time you change it during the loop. This does happen because you've declared it as a static field but you are on the wrong track thinking the way you are about it. Let's simplify the problem and instead of a Book, use this to illustrate: class AnObject { int aValue; } And instead of IO, just loop some times and add it to a list: class PersistenceOfChangesDemo { static List&lt;AnObject&gt; theList = new ArrayList&lt;AnObject&gt;(); public static void main(String[] args) { AnObject theObject = new AnObject(); for(int i = 1; i &lt;= 3; i++) { /* reassign the object's value */ theObject.aValue = i; /* adds the same object each time */ theList.add(theObject); } /* theList is now of size 3 * but all its elements refer to the same object (theObject) */ for(AnObject anObject : theList) { /* prints '3' every time * because that was the last value assigned */ System.out.println(anObject.aValue); /* prints 'true' every time */ System.out.println(anObject == theObject); } } } The solution is that you need to create a new object each time you want a new one: class PersistenceOfChangesDemo { static List&lt;AnObject&gt; theList = new ArrayList&lt;AnObject&gt;(); public static void main(String[] args) { for(int i = 1; i &lt;= 3; i++) { /* make a new object each time */ AnObject anObject = new AnObject(); anObject.aValue = i; theList.add(anObject); } /* theList now has references to 3 different objects */ for(AnObject anObject : theList) { /* prints 1, 2, 3 */ System.out.println(anObject.aValue); } } } Per your comment, make sure you are creating the new instance for each time you put it in to the map: for (int i = 1; i &lt;= Integer.parseInt(splitOut[1]); i++) { Book newBook = new Book(); newBook.setName(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)]); newBook.setAuthorFirstname(loan_CurrentLoans[((Integer.parseInt (splitOut[1])-1)*4)+1]); newBook.setAuthorSurname(loan_…
type: Answer
has comment: http://stackoverflow.com/comment/31164739
has comment: http://stackoverflow.com/comment/31158735
score: 0

http://stackoverflow.com/comment/31035537
has text: Oh surely would wait for 4 mins..:-)
comment on: http://stackoverflow.com/a/20717520
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/20815659
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/20815620
downvote count: 0
has comment: http://stackoverflow.com/comment/31211886
has comment: http://stackoverflow.com/comment/31211911
type: Answer
has comment: http://stackoverflow.com/comment/31211956
has comment: http://stackoverflow.com/comment/31211898
has comment: http://stackoverflow.com/comment/31211879
has body: Instead of adding the triangles without any concern, first check if it fits. If not, skip it and create another one. This would be possible with a do-while. Rectangle r; do { r = createRandomRect(); } while (overlaps(r)) add(r); Note: This is going to be very slow if the amount of rectangles keeps increasing and the available space gets smaller and smaller. Also make sure that rectangles are not occupying the whole area. This algorithm may fail if there literally all space is used, but this is unlikely, since you work with floats, I think.

http://stackoverflow.com/q/20733572
tagged with: adt
upvote count: 11
tagged with: android
has body: I am using the eclipse ADT-bundle that Google lets you download directly from their site. I am in Ubuntu 13.10 and is using Oracle Java 7. My problem is that Eclipse crashes (freezes) as soon as the autocomplete popup is shown. It seems to be a reported bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=377367 but I cannot find any solution to my problem. Right now I can't develop at all. Anyone who solved this problem?
answer count: 1
favorite count: 0
score: 11
has answer: http://stackoverflow.com/a/20733587
accepted answer: http://stackoverflow.com/a/20733587
type: AnsweredQuestion
has title: Eclipse ADT crash when autocomplete popup
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
tagged with: autocomplete

http://stackoverflow.com/comment/31310320
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20758218
has text: Do you load the textures in the main thread or do you have a custom thread for that? I wrote a custom thread to load the textures and they appeared broken, but nothing like this happened. Any concurrent loading might be the reason though.

http://stackoverflow.com/comment/30986347
comment on: http://stackoverflow.com/a/20690186
score: 0
type: AnswerComment
type: Comment
has text: I don't have "Eclipse", that's the problem... Must I download it ?

http://stackoverflow.com/q/20844756
type: AnsweredQuestion
tagged with: reflection
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31266373
answer count: 1
has title: Proxying objects in a deep object graph (Java)
has comment: http://stackoverflow.com/comment/31266072
tagged with: proxy
score: 0
has answer: http://stackoverflow.com/a/20864438
has body: public class ObjectToProxy { List&lt;ObjectToProxy&gt; potentiallyCircularReference; } public class SubClass { private ObjectToProxy aField; Set&lt;ObjectToProxy&gt; aSetOfObjectsToProxy; } public class CrazyObject { Map&lt;Integer, ObjectToProxy&gt; proxiedObjects; List&lt;SubClass&gt; manySubClasses; } public class ComplexObject { List&lt;CrazyObject&gt; crazyObjects; private final ObjectToProxy storedAsAField; } I have a complex object graph. Lets say it looks a little like the one above (even though it is much deeper in the real system). I would like, after being given ComplexObject, to be able to traverse the object graph and replace all ObjectToProxys with a proxying object. Is this doable? The reason for this is that we have some pretty big nasty objects which we partially load on the servers side (legacy, you're my friend!). We have a semi-working solution that uses proxying on the client side to go through and loads the full object when needed. edit I would like to replace every instance of ObjectProxy connected to a ComplexObject.
has comment: http://stackoverflow.com/comment/31266018
has comment: http://stackoverflow.com/comment/31265943
accepted answer: http://stackoverflow.com/a/20864438

http://stackoverflow.com/q/20824892
tagged with: androidhttpclient
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20824912
has comment: http://stackoverflow.com/comment/31229395
has title: How to read HTTP response using AsyncTask?
score: 1
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/20825423
type: Question
upvote count: 2
answer count: 2
tagged with: android
has body: I am having difficulty trying to get the body of the HTTP response from the string. So according to my code, I should have response from the PHP page in the string called "responseString" however because this is in an ASynchTask, I can not access that string anywhere else, so how can I receive the string? For example, I would like to shoot this string into a text view for testing purposes, how can I do that? Am I reading the code incorrectly? Is the response I am getting not being put into that string? Here is my code: class RequestTask extends AsyncTask&lt;String, String, String&gt;{ @Override protected String doInBackground(String... uri) { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; String responseString = null; try { response = httpclient.execute(new HttpGet(uri[0])); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK){ ByteArrayOutputStream out = new ByteArrayOutputStream(); response.getEntity().writeTo(out); out.close(); responseString = out.toString(); } else{ //Closes the connection. response.getEntity().getContent().close(); throw new IOException(statusLine.getReasonPhrase()); } } catch (ClientProtocolException e) { //TODO Handle problems.. } catch (IOException e) { //TODO Handle problems.. } return responseString; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); } } I am using the following to execute: new RequestTask().execute("http://www.mywebsite.com/android/registercheck.php?first=" + first2 + "&amp;last=" + last2 + "&amp;dispname=" + display2 + "&amp;email=" + email2 + "&amp;password=" + password2 );
downvote count: 1
has comment: http://stackoverflow.com/comment/31229091
tagged with: java
tagged with: httprequest

http://stackoverflow.com/comment/31225263
type: Comment
comment on: http://stackoverflow.com/a/20822755
type: AnswerComment
has text: is the 10 shuffled numbers were buttons
score: 0

http://stackoverflow.com/a/31591803
answers question: http://stackoverflow.com/q/20791178
score: 4
accepted answer of: http://stackoverflow.com/q/20791178
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/53728752
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/52054423
downvote count: 0
has body: What is the use of this attachment object? An attachment is an object that you can pass along to the completion handler; see it as an opportunity to provide context. You can use it for pretty much anything you can imagine, from logging to synchronising or just plain ignoring it. I am trying the AsynchronousFileChannel JAVA 7 API to write a file in an async manner, however I could not find an easy way to append to the file. Async is usually a little trickier, and appending to a file is an inherently serial process. That said, you can do it in parallel, but you'll have to do some bookkeeping about where to append the next buffer contents. I imagine it might look something like this (using the channel itself as the 'attachment'): class WriteOp implements CompletionHandler&lt;Integer, AsynchronousFileChannel&gt; { private final ByteBuffer buf; private long position; WriteOp(ByteBuffer buf, long position) { this.buf = buf; this.position = position; } public void completed(Integer result, AsynchronousFileChannel channel) { if ( buf.hasRemaining() ) { // incomplete write position += result; channel.write( buf, position, channel, this ); } } public void failed(Throwable ex, AsynchronousFileChannel channel) { // ? } } class AsyncAppender { private final AsynchronousFileChannel channel; /** Where new append operations are told to start writing. */ private final AtomicLong projectedSize; AsyncAppender(AsynchronousFileChannel channel) throws IOException { this.channel = channel; this.projectedSize = new AtomicLong(channel.size()); } public void append(ByteBuffer buf) { final int buflen = buf.remaining(); long size; do { size = projectedSize.get(); while ( !projectedSize.compareAndSet(size, size + buflen) ); channel.write( buf, position, channel, new WriteOp(buf, size) ); } }

http://stackoverflow.com/a/20792925
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/20792835
has comment: http://stackoverflow.com/comment/31170753
score: 2
upvote count: 2
has body: Looking at the source code of the In class, it looks like you silently swallowed an IOException. Could not open tinyW.txt This causes a NullPointerException down the line because the Scanner that In uses internally is not initialized. If I had to guess, the root cause of this exception is a FileNotFoundException. Instead of putting your file in the package of your class, put it at the root of the project directory. Eclipse usually runs your application from that directory, so all relative paths, like tinyW.txt are relative to that directory. Once you've solved this, know that using shell redirect operators as java arguments will not have the desired effect. Eclipse is running your application a little something like this java binarysearch.BinarySearch "tinyW.txt &lt; tinyT.txt" where you can obviously see that the &lt; is inside the quotes and is therefore not handled by the shell parser. Consider using anything other than the In class you've been provided. It's a terrible mess, swallowing exceptions and all.

http://stackoverflow.com/comment/120556976
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/68203641
has text: If you want to discuss other answers, please add a comment instead of posting a new answer. Furthermore, please add evidence.

windowbuilder
tags question: http://stackoverflow.com/q/20693141
tag name: windowbuilder
tags question: http://stackoverflow.com/q/20695570
tags question: http://stackoverflow.com/q/20811873
tags question: http://stackoverflow.com/q/20733938
tags question: http://stackoverflow.com/q/20849419
tags question: http://stackoverflow.com/q/20742337
type: Tag

http://stackoverflow.com/a/20702988
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20702750
type: Answer
has body: Relative paths do not start with /. /schoolmngt/FirstReport.jrxml is an absolute path. If the current drive is D: it will look for D:/schoolmngt/FirstReport.jrxml

http://stackoverflow.com/comment/31211640
has text: I resolved that problem. I reinstall INTELLIJ IDEA, than remove dependency from `pom.xml`. After that apprears `enable autoimport` dialog, I confirm and IDEA pull the jar by its own. Don't ask me what the problem was.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20758337
score: 0

http://stackoverflow.com/comment/31262445
type: Comment
type: QuestionComment
has text: `request.getParameter("uuid");`
comment on: http://stackoverflow.com/q/20842858
score: 5

http://stackoverflow.com/comment/31112848
type: Comment
score: 0
type: AnswerComment
has text: @newacct: The idea is that the artificial generic argument should be identical to the type itself. By adding the Parent bound I restrict the usage and reduce mistakes.
comment on: http://stackoverflow.com/a/20738712

http://stackoverflow.com/comment/31108951
type: Comment
comment on: http://stackoverflow.com/a/20757764
score: 0
type: AnswerComment
has text: done wat u told.. but still the same thing happening... am using ksoap2-j2se-full-2.1.2.jar for my project...

http://stackoverflow.com/a/20686511
has comment: http://stackoverflow.com/comment/31010579
type: Answer
has comment: http://stackoverflow.com/comment/31031180
has comment: http://stackoverflow.com/comment/43502745
accepted answer of: http://stackoverflow.com/q/20681563
has comment: http://stackoverflow.com/comment/30987458
has body: You can create a subclass of actor and draw text as you like in it's overridden draw method. Just don't forget to set alpha before drawing using setColor method. The value of alpha will be available as a parameter for draw. You then can fade it the way you want. Good luck.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/30988498
has comment: http://stackoverflow.com/comment/31010530
answers question: http://stackoverflow.com/q/20681563

http://stackoverflow.com/comment/31228637
type: AnswerComment
has text: For instance, if OP now tries to move the component using Swing Timer but put several subsequent `repaint()` call with changes of Bounds inside same action event , The effect which he might expect to see won't be intercepted but only the final updated GUI with *all those changes and repaint call* done inside that single action event. It is more like about Swing's rendering mechanism rather than the fact that EDT is busy That is why i said: For moving the answer is OK, but animation is more about doing things with custom painting. :) I hope you will understand me.
type: Comment
comment on: http://stackoverflow.com/a/20823520
score: 0

tomcat
tags question: http://stackoverflow.com/q/20786568
tags question: http://stackoverflow.com/q/20794864
tags question: http://stackoverflow.com/q/20743916
tags question: http://stackoverflow.com/q/20825462
tags question: http://stackoverflow.com/q/20748007
tags question: http://stackoverflow.com/q/20806498
tags question: http://stackoverflow.com/q/20756804
tags question: http://stackoverflow.com/q/20793509
tags question: http://stackoverflow.com/q/20797699
tags question: http://stackoverflow.com/q/20790721
tags question: http://stackoverflow.com/q/20785911
tags question: http://stackoverflow.com/q/20771701
tags question: http://stackoverflow.com/q/20686608
tags question: http://stackoverflow.com/q/20846196
tags question: http://stackoverflow.com/q/20791770
tags question: http://stackoverflow.com/q/20722285
tags question: http://stackoverflow.com/q/20779947
tags question: http://stackoverflow.com/q/20724774
tags question: http://stackoverflow.com/q/20758664
tags question: http://stackoverflow.com/q/20734502
tags question: http://stackoverflow.com/q/20742652
tags question: http://stackoverflow.com/q/20834889
tags question: http://stackoverflow.com/q/20842070
tags question: http://stackoverflow.com/q/20776600
tags question: http://stackoverflow.com/q/20826177
tags question: http://stackoverflow.com/q/20817425
tags question: http://stackoverflow.com/q/20815184
tags question: http://stackoverflow.com/q/20787858
tags question: http://stackoverflow.com/q/20681434
tags question: http://stackoverflow.com/q/20824190
tags question: http://stackoverflow.com/q/20745688
tags question: http://stackoverflow.com/q/20730752
tags question: http://stackoverflow.com/q/20704395
tags question: http://stackoverflow.com/q/20718566
tags question: http://stackoverflow.com/q/20804043
tags question: http://stackoverflow.com/q/20779554
tags question: http://stackoverflow.com/q/20712612
tags question: http://stackoverflow.com/q/20822502
tags question: http://stackoverflow.com/q/20780621
tag name: tomcat
tags question: http://stackoverflow.com/q/20838507
tags question: http://stackoverflow.com/q/20725961
tags question: http://stackoverflow.com/q/20723351
tags question: http://stackoverflow.com/q/20757684
tags question: http://stackoverflow.com/q/20842729
tags question: http://stackoverflow.com/q/20828452
tags question: http://stackoverflow.com/q/20827118
tags question: http://stackoverflow.com/q/20703897
tags question: http://stackoverflow.com/q/20789673
tags question: http://stackoverflow.com/q/20696626
tags question: http://stackoverflow.com/q/20781934
tags question: http://stackoverflow.com/q/20740867
tags question: http://stackoverflow.com/q/20735205
tags question: http://stackoverflow.com/q/20813052
tags question: http://stackoverflow.com/q/20817057
tags question: http://stackoverflow.com/q/20843273
tags question: http://stackoverflow.com/q/20819155
tags question: http://stackoverflow.com/q/20808344
tags question: http://stackoverflow.com/q/20732214
tags question: http://stackoverflow.com/q/20785977
tags question: http://stackoverflow.com/q/20821513
tags question: http://stackoverflow.com/q/20686465
tags question: http://stackoverflow.com/q/20810957
type: Tag
tags question: http://stackoverflow.com/q/20704917
tags question: http://stackoverflow.com/q/20807126
tags question: http://stackoverflow.com/q/20704741
tags question: http://stackoverflow.com/q/20819240
tags question: http://stackoverflow.com/q/20704684
tags question: http://stackoverflow.com/q/20688802
tags question: http://stackoverflow.com/q/20762707
tags question: http://stackoverflow.com/q/20825271
tags question: http://stackoverflow.com/q/20813496
tags question: http://stackoverflow.com/q/20829526
tags question: http://stackoverflow.com/q/20685286
tags question: http://stackoverflow.com/q/20698522
tags question: http://stackoverflow.com/q/20718191
tags question: http://stackoverflow.com/q/20772734
tags question: http://stackoverflow.com/q/20801961
tags question: http://stackoverflow.com/q/20799515

http://stackoverflow.com/comment/31111369
type: Comment
has text: @AlexPoole Yes thats true, but the case is I am using BC4J framework and in that ViewObject is used to pass data to database, so the code from where I am setting data doesn't throw `SqlException` hence I can not put it in `try..catch`.
comment on: http://stackoverflow.com/q/20759428
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31248644
comment on: http://stackoverflow.com/q/20835173
has text: JLabel is transparent by default. Consider disabling a buttons content and birder instead...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31259557
score: 0
type: AnswerComment
type: Comment
has text: Your code doesn't works properly. It returns ALL symbols count and ALL lines count, but I need to get cursor position at one line, not on all lines.
comment on: http://stackoverflow.com/a/20840767

http://stackoverflow.com/q/20802509
has answer: http://stackoverflow.com/a/20802614
accepted answer: http://stackoverflow.com/a/20802614
tagged with: 2d-games
possible better answer: http://stackoverflow.com/a/20806074
has comment: http://stackoverflow.com/comment/31188059
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31190830
tagged with: java
has title: Java for-loops: How to check for winner in connect 4 program
type: Question
has comment: http://stackoverflow.com/comment/31191305
answer count: 2
tagged with: algorithm
has body: I am trying to make a connect 4 program in java and I am stuck on the winner check. I know that I could make a very long list of if and else if's but I think loops would work better. I'm open to any other way of solving this problem but on what I've been looking at makes it seem the best. I have an idea of what to do with the rows and columns but I don't even know where to start with the diagonals. This is what I have so far: edit: int p1counter = 0; int p2counter = 0; int r = 1;//x int c = 1;//y for(r = 1; r &lt;= 6; r++) { while(c &lt;= 7) { if(grid[r][c].equals("_")) { c++; p1counter = 0; p2counter = 0; } else if(grid[r][c].equals("1"))//player 1 counter { c++; p1counter++; } else if(grid[r][c].equals("2"))//player 2 counter { c++; p2counter++; } } if(p1counter &gt;= 4) { JOptionPane.showMessageDialog(null, "Player 1 is the winner!"); done = true; } else if(p2counter &gt;= 4) { JOptionPane.showMessageDialog(null, "Player 2 is the winner!"); done = true; } return done; }
has answer: http://stackoverflow.com/a/20806074
score: 0
has comment: http://stackoverflow.com/comment/31200930
has comment: http://stackoverflow.com/comment/31188905

http://stackoverflow.com/q/20729825
accepted answer: http://stackoverflow.com/a/20729899
tagged with: static
has answer: http://stackoverflow.com/a/20729836
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20730030
has body: As I understand static, it is that static methods can be called without an instance of the object needing to exist. So instead of making an object and calling the method on that object, you can just call the method on the class. Now, I have a class Main that has the following object: public ScribbleCanvas myCanvas;. In the ScribbleCanvas class I would like to access a method of the Main-class. Now, since there is already an instance of Main (since this called the ScribbleCanvas), how can I access a non-static method of this class? Or perhaps the better question - where is the error in my reasoning?
tagged with: java
has title: Confusion about static methods in Java
type: Question
has comment: http://stackoverflow.com/comment/31057909
has comment: http://stackoverflow.com/comment/31058001
has answer: http://stackoverflow.com/a/20729901
has comment: http://stackoverflow.com/comment/31057911
has comment: http://stackoverflow.com/comment/31057943
possible better answer: http://stackoverflow.com/a/20729836
score: 0
has answer: http://stackoverflow.com/a/20729899

http://stackoverflow.com/a/23536073
type: Answer
answers question: http://stackoverflow.com/q/20735723
score: 0
has body: I think the issue here is that the activity is not ready. I would not recommend you following harikris's solution even though it works. It's usually bad practice to put code (onClick() which handles the click event) in your XML file. For example, it will be very difficult to hunt that piece of code down to review/ change it in the future yourself, not to mention another developer in your team. I'd suggest to listen to the event the activity is ready i.e. onActivityCreated() within your Fragment class. Override the implementation of the same method and call something in your activity e.g. onFragmentReady() like in the example below. Fragment class: public class About extends Fragment { Intent intent; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.about, container, false); intent = new Intent(getActivity(), Contact_Developer.class); final Button button = (Button) rootView.findViewById(R.id.btnContactDev); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(intent); } }); return rootView; } @Override public void onActivityCreated (Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ((MyActivity) this.getActivity()).onFragmentReady(); } } Activity class: public class MyActivity extends FragmentActivity { private void onFragmentReady() { Log.i(TAG, "testing"); intent = new Intent(getActivity(), Contact_Developer.class); final Button button = (Button) rootView.findViewById(R.id.btnContactDev); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(intent); } }); } public class About extends Fragment { ... } }

http://stackoverflow.com/comment/31337381
comment on: http://stackoverflow.com/q/20808901
has text: @MarkAdler: I added the hex values.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20730858
has body: I've been trying to set up nginx as proxy to jetty. I want to do something as explained in this answer but for Jetty not ring. I've created a .war and I placed it in ~/jetty/jetty-dist/webapps/web_test-0.1.0-SNAPSHOT-standalone.war Say, I want to use the domain example.com with ip address 198.51.100.0. I've also copied /etc/nginx/sites-available/default into the file example.com and I have it in the same directory. Can you help me configure nginx as proxy to jetty in my case? I know there are many references online about how to do this but they are all different and I got confused. What specific changes do I need to make in nginx? What changes do I need to make in jetty.xml? Do I need to make any other changes? Will my app be served at example.com/index.html? Current state of nginx is copied below: upstream jetty { server 127.0.0.1:8080 fail_timeout=0 } server { listen 80 default_server; #listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; server_name localhost; location / { proxy_pass http://jetty try_files $uri $uri/ =404; } EDIT I was wondering if I need to use Jetty at all. In this setup he just uses ring, which seems super easy? What do I gain by using jetty?
tagged with: ring
upvote count: 12
tagged with: nginx
accepted answer: http://stackoverflow.com/a/20746082
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/20632987
favorite count: 0
type: Question
has title: How do I configure nginx as proxy to jetty?
tagged with: jetty
has answer: http://stackoverflow.com/a/20746082
score: 12
tagged with: java
answer count: 1

fractions
type: Tag
tags question: http://stackoverflow.com/q/20727396
tag name: fractions

http://stackoverflow.com/comment/30967664
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20680076
score: 1
has text: Did you make your test classes public?

http://stackoverflow.com/q/20824884
type: Question
has answer: http://stackoverflow.com/a/20824940
accepted answer: http://stackoverflow.com/a/20824940
has comment: http://stackoverflow.com/comment/31229258
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20824937
possible better answer: http://stackoverflow.com/a/20824914
has comment: http://stackoverflow.com/comment/31229061
tagged with: java
has body: My program will run exept on this Exception: Here's example: case 3: //display contact cList.displayContacts(); public void displayContacts(){ int i; for(i=0; i &lt; myContacts.length; i++){ Contact c = myContacts[i]; System.out.println("Name: " + c.getName()); System.out.println("Number: " + c.getNumber()); System.out.println("Email: " + c.getEmail()); System.out.println("------------------------------------"); } } Exception atlog: Exception in thread "main" java.lang.NullPointerException at ContactList.displayContacts(ContactList.java:45) at ContactListDriver.main(ContactListDriver.java:67)
has comment: http://stackoverflow.com/comment/31229068
has comment: http://stackoverflow.com/comment/31229120
has title: Java - I get NullPointerException in my program
downvote count: 4
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/31229380
has comment: http://stackoverflow.com/comment/31229309
favorite count: 0
tagged with: nullpointerexception
tagged with: exception
has answer: http://stackoverflow.com/a/20824914
score: -4
has comment: http://stackoverflow.com/comment/31229087

http://stackoverflow.com/comment/31276495
comment on: http://stackoverflow.com/a/20848063
type: Comment
score: 0
has text: The Ruby client consumes the payload without issue when I put a `JsonNode` object. I don't understand exactly what gets put on the queue when I use `JsonNode`, but from a blackbox perspective it seems to be a JSON representation of my pojo (instead of a JSON representation of a `JsonNode` object itself) so that works for me.
type: AnswerComment

http://stackoverflow.com/q/20682969
tagged with: gwt
tagged with: clone
has title: What replaced the method clone(Serializable)
score: 1
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/20683093
favorite count: 0
has answer: http://stackoverflow.com/a/20683093
type: AnsweredQuestion
downvote count: 0
has body: I would like to know and understand what exacly replaced the metod BaseService.clone(Serializable). I Have this code: if (type == 1) { evenement = (Evenemen) clone(evenement); evenement.setCdtype(TypeEvenement.toString()); } Here evenement is a class with strings, integers and arrays. and eclipse tell me that warning: The method clone(Serializable) from the type BaseService is deprecated So my question is what replaced the clone method? I have tried searchig for a solution but everywhere, I just read to put a @SuppressWarnings("deprecation"), I dont want to do that.
type: Question

http://stackoverflow.com/a/20799356
answers question: http://stackoverflow.com/q/20799131
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31182327
has comment: http://stackoverflow.com/comment/31182157
upvote count: 2
type: Answer
has body: JButton#isEnabled changes the user interactivity of a component, that is, whether a user is able to interact with it (press it) or not. When a JButton is pressed, it fires a actionPerformed event. You are receiving Add button is pressed when you press the confirm button because the add button is enabled. As stated, it has nothing to do with the pressed start of the button. Based on you code, if you tried to check the "pressed" start of the add button within the confirm button's ActionListener it would always be false, as the button will only be in the pressed state while the add button's ActionListeners are being called. Based on all this information, I would suggest you might want to consider using a JCheckBox which you can then use JCheckBox#isSelected to determine if it has being checked or not. Take a closer look at How to Use Buttons for more details

http://stackoverflow.com/comment/31235793
comment on: http://stackoverflow.com/a/20828376
type: AnswerComment
score: 0
type: Comment
has text: @Moynzy Not for kicking a ball specifically, but the key topic you'll need for that is collision checking. Have a look at this tutorial (http://www.greenfoot.org/doc/tut-3) which covers that - the other tutorials would be worth working through also, if you haven't already.

http://stackoverflow.com/comment/31131493
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20765061
type: Comment
has text: Yeah, I tried the way that you said and it works; however, i'm looking for Maven solution for that... Anyway, Thanks for your solution.

http://stackoverflow.com/a/20732260
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20732175
has body: I think you misunderstand your output. With this Node warnLevel = doc.getElementsByTagName("root").item(0); you get the single root tag in your xml. The toString() of that object is the name of the tag and the node's value, but apparently it always returns null for element nodes. What you want is to get the attribute level. Node warnLevel = doc.getElementsByTagName("root").item(0).getAttributes().getNamedItem("level"); System.out.println("The warn level is: " + warnLevel); which prints level="DEBUG"
answers question: http://stackoverflow.com/q/20732175
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/31005853
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20701161
has text: When in doubt, ask comments before jumping in with an answer.
score: 0

http://stackoverflow.com/a/20719084
answers question: http://stackoverflow.com/q/20719005
type: Answer
has body: Use a Swing Timer instead of Thread.sleep (which blocks EDT). Something like this ActionListener listener = new ActionListener(){ public void actionPerformed(ActionEvent e){ System.out.println("Hello"); } } int delay = 5000; Timer timer = new Timer(delay, listener); timer.setRepeats(false); timer.start(); Timer javadoc | Timer tutorial
upvote count: 1
score: 1
downvote count: 0

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/20839819
tag name: ksoap2
tags question: http://stackoverflow.com/q/20722652

http://stackoverflow.com/comment/31151310
comment on: http://stackoverflow.com/q/20744945
score: 0
type: Comment
type: QuestionComment
has text: @IvanZuzak Using the authorizations API. I use Spring Social to build a URL for the request `final OAuth2Operations operations = connectionFactory.getOAuthOperations();` and `operations.buildAuthorizeUrl(GrantType.IMPLICIT_GRANT, params)`. The `params` var contains `user` and `public_repo` scopes.

http://stackoverflow.com/a/20723665
has body: This should work although I've not tested it. //btn action private void toggleVisible(){ String btnVal = btnSearch.getText(); if(btnVal.equals("Search")){ searchTxtField.setVisible(true); // or however you are showing search field btnSearch.setText("Hide"); }else{ searchTxtField.setVisible(false); btnSearch.setText("Search"); } }
downvote count: 0
answers question: http://stackoverflow.com/q/20723581
type: Answer
has comment: http://stackoverflow.com/comment/31046772
upvote count: 4
score: 4

http://stackoverflow.com/comment/31056886
has text: Driver name: SQLiteJDBC Driver version: native
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20724080
score: 0

mouselistener
tags question: http://stackoverflow.com/q/20842291
tags question: http://stackoverflow.com/q/20748763
tags question: http://stackoverflow.com/q/20753873
tags question: http://stackoverflow.com/q/20718322
tags question: http://stackoverflow.com/q/20721091
tags question: http://stackoverflow.com/q/20840762
tags question: http://stackoverflow.com/q/20792947
tags question: http://stackoverflow.com/q/20835173
type: Tag
tag name: mouselistener
tags question: http://stackoverflow.com/q/20682526
tags question: http://stackoverflow.com/q/20702013
tags question: http://stackoverflow.com/q/20823511

http://stackoverflow.com/q/20799027
has body: Recently, our system need to store millions record per day. Each record is very simple, the userid and the clicked weburl. After that we use some machine learning algorithms on the data logs. We tried neo4j, but the query time is very slow. For example : get all pair userid view same weburl. So any suggestion?
type: Question
answer count: 2
tagged with: database
score: 0
tagged with: neo4j
has answer: http://stackoverflow.com/a/20894935
has title: How to store user logging
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20799636
tagged with: nosql
tagged with: java

http://stackoverflow.com/comment/31095567
comment on: http://stackoverflow.com/q/20750020
score: 0
type: Comment
type: QuestionComment
has text: @JoshuaTaylor Yes, it's a local accessor, thank you for the qualification. Also, I will make sure to improve the readability of my posts.

http://stackoverflow.com/a/20695083
score: 13
accepted answer of: http://stackoverflow.com/q/20694045
answers question: http://stackoverflow.com/q/20694045
type: AcceptedAnswer
downvote count: 0
has body: It appears that your url is invalid still in both cases when attempting to set the timeout property. If you're trying to have a failover URL, which it looks like you are since it is getting in to the Failover code then you're probably looking for initialReconnectDelay (and possibly maxReconnectAttempts which would throw an exception if the server is still down after the number of attempts is reached). ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover://(tcp://localhost:61616)?initialReconnectDelay=2000&amp;maxReconnectAttempts=2");
type: Answer
upvote count: 13

http://stackoverflow.com/comment/31257172
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20836018
has text: If you tried my jsonObjectString's value and my code, you should not get an error. I've tried it and it is working.

http://stackoverflow.com/a/20779800
has body: I'm the author of the la4j library. I do see several places of improvement in your code. Here is my advice: Calling getRow (as well as setRow) is always a bad idea (especially for sparse matrices), since it launches a full-copying of the matrix row. I would suggest you to avoid such calls. Thus, w/o getRow/setRow code should looks like: SparseMatrix t = new CRSMatrix(n, n); double uniformWeight = (double) 1 / n; // used when the rowSum is zero for (int i = 0; i &lt; n; i++) { double rowSum = t.foldRow(i, Matrices.asSumAccumulator(0.0)); if (rowSum &gt; 0.0) { MatrixFunction divider = Matrices.asDivFunction(rowSum); for (int j = 0; j &lt; n; j++) { // TODO: I should probably think about `updateRow` method // in order to avoid this loop t.update(i, j, divider); } } else { for (int j = 0; j &lt; n; j++) { t.set(i, j, uniformWeight); } } } Please, try this. I didn't compile it, but it should work. Update Using a boolean array in order to keep track of the same rows is a fantastic idea. The main bottle-neck here is the loop: for (int j = 0; j &lt; n; j++) { t.set(i, j, uniformWeight); } Here we're completely ruining the performance/footprint of the sparse matrice since assigning the entire row to the same value. So, I would say, combining these two ideas together: avoid getRow/setRow + extra array with flags (I would use BitSet instead, it is much efficien in terms of footprint) should give you an awesome performance. Thank you for using the la4j library, and please, report any issues with performance/functional to mail-list, or GitHub page. All references are available here: http://la4j.org.
downvote count: 0
answers question: http://stackoverflow.com/q/20767397
has comment: http://stackoverflow.com/comment/31395394
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31148513
score: 1

http://stackoverflow.com/a/20799236
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/20796970
has body: public class Activity extends Sherlockfragment { static EditText mdob; static String dob_string; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.update_profile, container, false); mdob = (EditText)view. findViewById(R.id.dob); mdob.setOnClickListener(new View.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(View v) { // TODO Auto-generated method stub DialogFragment newFragment = new DatePickerFragment(); newFragment.show(getActivity().getSupportFragmentManager(), "datePicker"); }}); return view; } // *********************************CLASS**************************************************************************** public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { int year = 2013, month = 10, day = 1, dayofmonth = 1; public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); } public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { // Do something with the date chosen by the user year = selectedYear; month = selectedMonth + 1; day = selectedDay; Calendar cal = Calendar.getInstance(); cal.set(selectedYear, selectedMonth, selectedDay); DateFormatSymbols dfs = new DateFormatSymbols(Locale.getDefault()); String weekdays[] = dfs.getWeekdays(); int daykk = cal.get(Calendar.DAY_OF_WEEK); String dayof = weekdays[daykk]; Activity.mdob.setText(day + "-" + month + "-" + year + dayof); Activity.mdob_string = day + "-" + month + "-" + year; } } }
has comment: http://stackoverflow.com/comment/31181704
score: 4
type: Answer

http://stackoverflow.com/a/20700791
score: 0
has body: You can select your nodes directly with xpath: //ul[@id = 't1-travListing']/li/a Using it with findElements, it will return a list of all a-Tags within li-tags. Selenium's getText should get you the displayed text, doing the "skipping" of the empty span-Tags by itself: List&lt;WebElement&gt; allElements = driver.findElements(By.xpath("//ul[@id = 't1-travListing']/li/a")); for (WebElement element: allElements) { System.out.println(element.getText()); } You could also try an expression like this to select not the elements, but the text in them: //ul[@id = 't1-travListing']/li/a/text()
answers question: http://stackoverflow.com/q/20700423
type: Answer

http://stackoverflow.com/q/20836489
has comment: http://stackoverflow.com/comment/31251085
score: 2
has answer: http://stackoverflow.com/a/20836548
has comment: http://stackoverflow.com/comment/31326439
type: Question
possible better answer: http://stackoverflow.com/a/20836665
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14511834
tagged with: java
has answer: http://stackoverflow.com/a/20836600
accepted answer: http://stackoverflow.com/a/20837811
tagged with: eclipse
has answer: http://stackoverflow.com/a/29842339
tagged with: r.java-file
downvote count: 1
has body: I had 2 errors that i could not resolve, so i "cleaned my project" which erased my R.java file, and did not auto-generate. after much trial and error, i found that commenting out every single error (which meant 80% of my project), then cleaning again, did work to regenerate R.java. but now instead of "R is not a field" errors, all of my variables connected to the "R.something" code in my project is now not being recognized as a field. yet i looked in R.java and they all have id #s. so i tried to refresh my project, and tried closing/opening eclipse, but nothing has worked. anyone know how to get these variables to be recognized again? thank you so much for your help.
has answer: http://stackoverflow.com/a/20837811
favorite count: 0
has answer: http://stackoverflow.com/a/20836665
upvote count: 3
has title: After R.java regeneration, many fields not recognized
tagged with: field
answer count: 5
tagged with: android

http://stackoverflow.com/a/20778856
score: 1
upvote count: 1
has body: I think that you should use % instead of Math.IEEEremainder: adjustedTime = adjustedTime - (adjustedTime % resolution);
downvote count: 0
answers question: http://stackoverflow.com/q/20778795
has comment: http://stackoverflow.com/comment/31146147
type: Answer

http://stackoverflow.com/comment/30998921
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20696790
has text: Thanks @Makoto, it definitely helped. I can't think of any way to do this faster than O(nm) time because we have go through all of them to add them up. If you think we can do this faster, let me know.

http://stackoverflow.com/comment/31122187
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20765203
type: AnswerComment
has text: @sai_ana: You'll likely need to use a language that allows inline assembly like C or C++ if you want to learn to reimplement a system call like file API without any of the nice wrapper functions. I haven't checked OpenJDK source code, but it probably just uses the nice wrapper functions in C++ standard library or OS API rather than reimplementing it from scratch. But if that is what you want, it's worth it to check out the source code for glibc. A system call is an entirely different beast than a pure function like strlen().

http://stackoverflow.com/a/20786746
has comment: http://stackoverflow.com/comment/31159350
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31159246
has comment: http://stackoverflow.com/comment/31159268
has body: Look, I made a SSCCE reproducing this behavior. It is a really good question. public class ThreadRacing implements Runnable { public boolean started = false; public static void main(String[] args) { new ThreadRacing().test(); } public void test() { new Thread(this).start(); try { Thread.sleep(1000); } catch (Exception e) { } started = true; System.out.println("I did my job"); } @Override public void run() { while (true) { //System.out.print(""); if (started) { System.out.println("I started!!"); } } } } This prints: "I did my job". Nothing more. Adding a volatile keyword actually fixes the problem. To me, it looks like the second Thread gets not notified about the update to started because he is too bussy.
answers question: http://stackoverflow.com/q/20786483
has comment: http://stackoverflow.com/comment/31159310
has comment: http://stackoverflow.com/comment/31159160
has comment: http://stackoverflow.com/comment/31159131
upvote count: 2
has comment: http://stackoverflow.com/comment/31159465
has comment: http://stackoverflow.com/comment/31159903
has comment: http://stackoverflow.com/comment/31159099
type: Answer

http://stackoverflow.com/comment/31206807
has text: Sorry, I thought it would be more clear
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20812767
score: 0

http://stackoverflow.com/q/20712672
has comment: http://stackoverflow.com/comment/31026708
tagged with: swing
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20712861
has comment: http://stackoverflow.com/comment/31026875
type: Question
tagged with: graphics
answer count: 1
has comment: http://stackoverflow.com/comment/31026866
tagged with: awt
has comment: http://stackoverflow.com/comment/31026817
linked to: http://stackoverflow.com/q/20547542
score: 0
has answer: http://stackoverflow.com/a/20712861
has title: Why Won't the Screen Change Color?
has body: I've been trying to fix but it never changes the screen. I'm trying to used the Graphics as seen in the render() method. Tell me if something is wrong inside the render method so I can relax, because I can't seem to find the problem. import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.*; import javax.swing.JFrame; public class Game extends Canvas implements Runnable { private static final long serialVersionUID = 1L; public static int width = 300; public static int height = width / 16*9; public static int scale = 3; private Thread thread; private boolean running = false; private JFrame frame; public synchronized void start() { thread = new Thread(); thread.start(); running = true; } public synchronized void stop() { running = false; try{ thread.join(); }catch(InterruptedException e) { e.printStackTrace(); } } public Game() { Dimension size = new Dimension(width * scale, height * scale); setPreferredSize(size); frame = new JFrame(); } public void run() { while(running) { tick(); render(); } } void tick() {} public void render() { BufferStrategy bs = getBufferStrategy(); if(bs==null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); bs.dispose(); bs.show(); } public static void main(String[] args) { Game game = new Game(); game.frame.setResizable(false); game.frame.setTitle("Rain"); game.frame.add(game); game.frame.pack(); game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); game.frame.setLocationRelativeTo(null); game.frame.setVisible(true); game.start(); } }
tagged with: jframe

http://stackoverflow.com/comment/31076814
type: Comment
type: QuestionComment
has text: @payeli I have UAC disabled in my system.
comment on: http://stackoverflow.com/q/20739732
score: 0

http://stackoverflow.com/q/20831715
score: -1
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I have no errors (x's) in my project in eclipse yet when I try to run my project I get this error in the console: [2013-12-29 19:24:30 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/ads/Ad; [2013-12-29 19:24:30 - AlertCall] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/ads/Ad; Does anyone know what's wrong? EDIT: I fixed the problem by doing this: Untick the admob jar file in the "order and export" part of the "configure build path".
tagged with: android
has answer: http://stackoverflow.com/a/20831742
tagged with: java
downvote count: 1
type: Question
has title: Why am I getting this dex error [Android Application]?

http://stackoverflow.com/comment/31075633
type: AnswerComment
comment on: http://stackoverflow.com/a/20739610
score: 0
type: Comment
has text: @mikeyaworski I don't think that matters. You could take a look at http://developer.android.com/reference/java/util/Set.html. It clearly specifies LinkedHashSet as one of the sub-classes.

http://stackoverflow.com/comment/31151094
score: 0
comment on: http://stackoverflow.com/a/20781811
has text: By this way if I enter "1" program must loop 1 times but if I use "i<=noOfSP", program will loop 2 times. Thanks .
type: Comment
type: AnswerComment

http://stackoverflow.com/a/20795838
has comment: http://stackoverflow.com/comment/31175990
answers question: http://stackoverflow.com/q/20795040
type: Answer
has body: Try something like this to sort according to your string s Comparator&lt;String&gt; comparator = new Comparator&lt;String&gt;() { @Override public int compare(String key1, String key2) { int returned = sequence.indexOf(key1) - sequence.indexOf(key2); //.indexOf(key1) returns the index of the first character of the String if(returned &lt; 0){ // then it is sorted; returned 1; } else{ returned = -1;} return returned; } }; Map&lt;String,Double&gt; lhm = new TreeMap&lt;String,Double&gt;(comparator); This is not the solution for your problem but you can go by this way.
has comment: http://stackoverflow.com/comment/31176150
has comment: http://stackoverflow.com/comment/31176294
score: 0

http://stackoverflow.com/comment/31221762
type: Comment
comment on: http://stackoverflow.com/a/20820732
has text: could you have a look at the edited question please?
type: AnswerComment
score: 0

http://stackoverflow.com/q/20752601
has answer: http://stackoverflow.com/a/20754368
type: AnsweredQuestion
tagged with: apache-poi
accepted answer: http://stackoverflow.com/a/20753598
tagged with: jsf
possible better answer: http://stackoverflow.com/a/20754368
type: Question
tagged with: primefaces
has body: I am developing JSF with extender primefaces happens I'm moficando excel I generated default report, I only need to apply the style in the generated cells in detail, I could only style the header. private void columnsCustomers() { this.setColumnCustomer(new ArrayList&lt;ValidColumnKey&gt;()); this.getColumnCustomer().add(new ValidColumnKey(1, "Codigo", "code")); this.getColumnCustomer().add(new ValidColumnKey(2, "Nombre", "name")); this.getColumnCustomer().add(new ValidColumnKey(3, "Nombre Comercial", "comercialName")); this.getColumnCustomer().add(new ValidColumnKey(4, "Estado", "isActive")); } public void postProcessXLS(Object document) { HSSFWorkbook wb = (HSSFWorkbook) document; HSSFSheet sheet = wb.getSheetAt(0); //HSSFSheet sheet = wb.createSheet(getCustomer().getName()); HSSFRow header = sheet.getRow(0); HSSFRow rowUser0 = sheet.createRow((short) 0); HSSFCellStyle styleHeader = (HSSFCellStyle) wb.createCellStyle(); styleHeader.setAlignment(HSSFCellStyle.ALIGN_CENTER); HSSFFont fontHeader = (HSSFFont) wb.createFont(); fontHeader.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); fontHeader.setColor(HSSFColor.WHITE.index); styleHeader.setFillForegroundColor(HSSFColor.DARK_BLUE.index); styleHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); styleHeader.setFont(fontHeader); styleHeader.setBorderBottom((short) 1); styleHeader.setBorderLeft((short) 1); styleHeader.setBorderRight((short) 1); styleHeader.setBorderTop((short) 1); HSSFCell indice = rowUser0.createCell((short) 0); indice.setCellValue("N°"); indice.setCellStyle(styleHeader); int nro = 1; for(ValidColumnKey column : this.getColumnCustomer()){ HSSFCell hnro = rowUser0.createCell((short) nro); hnro.setCellValue(column.getDescripcion()); hnro.setCellStyle(styleHeader); nro++; } HSSFCellStyle styleCellWhite = (HSSFCellStyle) wb.createCellStyle(); HSSFFont fontCellWhite = (HSSFFont) wb.createFont(); fontCellWhite.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); styleCellWhite.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND)…
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20753598
has title: Apply css with cells generated with POI with the method getPhysicalNumberOfCells?
has comment: http://stackoverflow.com/comment/31101073
has comment: http://stackoverflow.com/comment/31099422

http://stackoverflow.com/q/20829110
type: UnansweredQuestion
has body: I have created jasper report and it woks perfectly on netbean but when i build war file and deploy it on apache server then it not works.... I Tried So hard on this problem spend whole day but didn't find any solution please help me out to solve this Here is My Code String loc = "C:\\Program Files\\report\\ public void CustBillPrint(String BillNo) { String path = loc + "customer-bill-1.jasper"; Map param = new HashMap(); param.put("billno", BillNo); try { JasperPrint jasperPrint = JasperFillManager.fillReport(path, param, con); JasperViewer.viewReport(jasperPrint, false); } catch (JRException e) { System.out.println(e); } } I already tried many ways are as follows: InputStream path = this.getClass().getResourceAsStream("report/farmpati-1.jasper"); InputStream path = new FileInputStream(new File("web/report/farmpati-1.jasper")); InputStream path = new FileInputStream(new File("").getAbsolutePath() + "/reports/logReport.jrxml"); String path = System.getProperty("user.dir") + "\\report\\"; String path = new File(".").getCanonicalPath() + "/web/report/"; And All This Alternative Work in NetBan But not working on apache when deploy as war
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/20829182
has answer: http://stackoverflow.com/a/34219263
tagged with: apache
tagged with: jsp
has title: Jasper Report Not Working When Deploy war file on apache server
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/4364205
favorite count: 0

http://stackoverflow.com/a/20828230
has body: The following uses BigInteger with a radix to do the actual arithmetic and outputs the result in both decimal and binary form. String s1 = "01100010 00110110 ..."; String s2 = "01100011"; s1 = s1.replaceAll(" ", ""); s2 = s2.replaceAll(" ", ""); BigInteger i1 = new BigInteger(s1, 2); BigInteger i2 = new BigInteger(s2, 2); BigInteger res = i1.multiply(i2); System.out.println(res); System.out.println(res.toString(2));
answers question: http://stackoverflow.com/q/20828143
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/43379519
type: AnswerComment
type: Comment
has text: When you send a 5xx error you should probably also send a descriptive string; so
comment on: http://stackoverflow.com/a/20772864
score: 0

http://stackoverflow.com/comment/31269356
comment on: http://stackoverflow.com/q/20844613
score: 0
has text: @iPot It's best to separate these into different questions, as [so]'s format doesn't really support these being in the same question well - each question can have 1 'accepted' answer, which indicates the answer that solved the asker's problem best. If each question deals with multiple issues, there won't necessarily be an answer that addresses everything, thus there can't really be 1 accepted answer.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20728634
answer count: 1
has body: I am trying to import node from one doc to another: DocumentBuilder db = dbf.newDocumentBuilder(); DocumentBuilder db2 = dbf2.newDocumentBuilder(); Document doc1 =parser.buildDoc(message.getBytes("UTF-8")); Document doc2 = db2.parse(new FileInputStream(new File("C:\\Temp\\workspace2\\Resource2Q\\xml_template.xml"))); NodeList list = doc1.getElementsByTagName("Form"); for(int i=0; i&lt;list.getLength(); i++) { Element element = (Element) list.item(i); Node copiedNode = doc1.importNode(element, true); doc2.getDocumentElement().appendChild(copiedNode); ... The last line of code gives me: "WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it". Why is this happening? i am importing the node.
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20728185
has comment: http://stackoverflow.com/comment/31058382
tagged with: java
tagged with: dom
has title: Import node DOM
type: Question
has comment: http://stackoverflow.com/comment/31058688
score: 0
has answer: http://stackoverflow.com/a/20730072
accepted answer: http://stackoverflow.com/a/20730072

http://stackoverflow.com/q/20727731
score: 0
type: UnansweredQuestion
has title: Use variable out of scope in java
has body: hello I want to use a variable and catch some data in another inner scope and use it for other place in main scope but my problem is when I setup my variable in inner scope, it will be forget out of scope. public class ...{ static TextView txt1; static String i="Z0"; static Handler UIupdater = new Handler() { @Override public void handleMessage(Message msg) { //some data i ="Z1"; } }; txt1 = (TextView) findViewById(R.id.txt1); txt1.setText(i+"");//still get "Z0" } I want to see "Z1", but it shows "Z0". what is the solution?
has answer: http://stackoverflow.com/a/20727933
has comment: http://stackoverflow.com/comment/31054549
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31054565
answer count: 2
has comment: http://stackoverflow.com/comment/31054367
tagged with: handler
has answer: http://stackoverflow.com/a/20727952
tagged with: scope

http://stackoverflow.com/q/20695148
downvote count: 0
possible better answer: http://stackoverflow.com/a/34487594
has comment: http://stackoverflow.com/comment/31022407
has answer: http://stackoverflow.com/a/42109614
answer count: 3
tagged with: android
has body: I have the method below in AppEngine: @ApiMethod(name = "authed", path = "greeting/authed") public HelloGreeting authedGreeting(User user) { ... } My doInBackground method in Android AsyncTask: HelloGreeting hg = null; try { hg = service.authed().execute(); } catch (IOException e) { Log.d("error", e.getMessage(), e); } return hg; I encountered the ff error: /_ah/api/.../v1/greeting/authed: java.io.EOFException In logcat: Problem accessing /_ah/api/.../v1/greeting/authed. Reason: INTERNAL_SERVER_ERROR at java.util.zip.GZIPInputStream.readUByte at java.util.zip.GZIPInputStream.readUShort at java.util.zip.GZIPInputStream.readUShort It only work when calling non-auth method. How to fix it? Im using the local server.
favorite count: 0
tagged with: google-cloud-endpoints
has title: Google Cloud Endpoints EOFException
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/20874119
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20874119
tagged with: gzip
tagged with: java
has answer: http://stackoverflow.com/a/34487594
type: Question
score: 5
upvote count: 5

http://stackoverflow.com/a/20695323
has body: Well considering, you'd have to turn the string into an integer to do the math, you could do this: try { int number = Ineger.parseInt(inField.getText()); } catch (NumberFormatException e) { //SHOW WARNING }
answers question: http://stackoverflow.com/q/20695228
score: 0
type: Answer

http://stackoverflow.com/a/20756120
upvote count: 1
has comment: http://stackoverflow.com/comment/31105734
downvote count: 0
has body: You seem to be on the right track. Only thing is listFiles() returns a File[] not a String[] Maybe try something like this File file = new File(filename); File[] files = new File[0]; // initialize if (file.isDirectory()){ files = file.listFiles(); // populate } int fileIndex = new Random().nextInt(files.length); // get random index Image img = new ImageIcon(files[fileIndex]).getImage(); // create image Though the above may work, It's recommended using URL for embedded resources and not Files. Something like this String[] filenames = file.list(); // list returns String int fileIndex = new Random().nextInt(filenames.length); Image img = null; java.net.URL url = MyClass.class.getResource(filenames[fileIndex]); if (url != null){ img = new ImageIcon(url).getImage(); } else { img = null; } When using the class.gerResource(). The file will be searched for in the location of the class files. You can can also change the path a little bit, for example if you want a file structure like this ProjectRoot bin MyClass.class images image1.png image2.png src Then you can use this code java.net.URL url = MyClass.class.getResource("images/" + filenames[fileIndex]);
type: Answer
answers question: http://stackoverflow.com/q/20756006
score: 1

http://stackoverflow.com/q/20685585
answer count: 2
upvote count: 1
favorite count: 0
has title: My objective is to create an application that uses getter and setter methods to add or subtract 2 numbers, I have hit a brick wall
type: UnansweredQuestion
has body: I keep receiving an error when compiling (./Calculator Java32 &amp;36 missing return statement) I am having difficulty seeing where my code is broken, Im new to java(that goes without saying im sure) any help would be appreciated. Thank You. import javax.swing.JOptionPane; public class CalculatorTestDrive { public static void main(String[] args) { int user = Integer.parseInt(JOptionPane.showInputDialog(null, "If you would like to Add enter 1 or if you would like to Subtract enter 2")); while((user == 1)||(user == 2)) { int a = Integer.parseInt(JOptionPane.showInputDialog(null, "Please Enter Your First Number")); int b = Integer.parseInt(JOptionPane.showInputDialog(null, "Please Enter Your Second Number")); Calculator one = new Calculator(); one.setFirstnumber(a); one.setSecondnumber(b); } } } public class Calculator { private int x; private int y; private int z; int userImput1; int userImput2; int add = 1; int subtract = 2; int user; public void add() { z = x + y; } public void subtract() { z = x - y; } public int getFirstnumber() { return x; } public int getSecondnumber() { return y; } public int setFirstnumber(int userImput1) { x = userImput1; } public int setSecondnumber(int userImput2) { y = userImput2; } }
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/20685656
type: Question
has answer: http://stackoverflow.com/a/20685660
has comment: http://stackoverflow.com/comment/30977201

http://stackoverflow.com/comment/31147261
has text: Thanks this works. If possible, could you please explain the need for this approach, why it didn't directly recognize the string
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20778817
type: Comment

http://stackoverflow.com/comment/30981257
type: QuestionComment
has text: This will happen if an app has an active session open, and a previously referenced package was called, and in the meantime, someone re-compiled the package. Are you doing a lot of re-compiles?
type: Comment
comment on: http://stackoverflow.com/q/20687051
score: 2

http://stackoverflow.com/comment/31011658
has text: @SotiriosDelimanolis MainAction is a strutsaction class. the execute method gets invoked. I didn't know how to use mainAction bean or what you mean by using mainAction bean. pls correct me If I am wrong anywhere
comment on: http://stackoverflow.com/q/20703822
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20766633
has comment: http://stackoverflow.com/comment/31126249
type: Question
answer count: 2
tagged with: padding
score: 0
tagged with: resolution
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20766793
has answer: http://stackoverflow.com/a/20766777
has body: I'm designing an app that changes the padding of the linear layouts according to the resolution of the phone... I've designed the XML file for a resolution of 480*800 Here is one linear layout...I have 5 in 1 page... &lt;LinearLayout android:id="@+id/layout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="78dp" android:paddingLeft="120dp" &gt; &lt;Button android:textSize="30dp" android:id="@+id/page" android:textColor="@android:color/transparent" android:background="@android:color/transparent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Pages" /&gt; &lt;/LinearLayout&gt; Now I've used this code in JAVA file:: l3=(LinearLayout)findViewById(R.id.layout3); size = new Point(); WindowManager w = getWindowManager(); if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB_MR2) { w.getDefaultDisplay().getSize(size); width = size.x; height = size.y; } else { d = w.getDefaultDisplay(); width = d.getWidth(); height = d.getHeight(); } height1=(height/800)*113; width1=(width/480)*14; l3.setPadding(width1, height1, 0, 0); But the variables width and height are having fixed values 480 and 800. So the code to get width and height pixels is not working...please help!!!! My target API is 8,10 and 17. Please help me with the code to find resolution(pixels) of the screen.
has title: Android : Get Phone Resolution using JAVA
tagged with: java

http://stackoverflow.com/comment/31202931
type: Comment
comment on: http://stackoverflow.com/q/20810280
type: QuestionComment
has text: OK I updated my answer on how to do that
score: 0

http://stackoverflow.com/a/21970793
score: 0
answers question: http://stackoverflow.com/q/20812711
type: Answer
has body: Have you trace your code on which line you got null value??? Try this code instead of yours. public boolean insert (String name,String email,String age,String dob){ PreparedStatement preparedStatement; try{ preparedStatement = con.prepareStatement("insert into info(name, email, age, dob) values(?,?,?,?)"); preparedStatement.setString(1,name); preparedStatement.setString(2,email); preparedStatement.setString(3,age); preparedStatement.setString(4,dob); preparedStatement.executeUpdate(); } catch (Exception e) { return false; } return true; }

http://stackoverflow.com/a/20731704
accepted answer of: http://stackoverflow.com/q/20731557
type: Answer
answers question: http://stackoverflow.com/q/20731557
upvote count: 0
has body: Hlo. Buddy.. try this code int y = Integer.parseInt(jTextField1.getText()); for (x = 0,z=0; x &lt;= (y+y-1); x++) { if(x&lt;=y){ z++; }else{ z--; } for(int i=0;i&lt;=z;i++){ jTextField2.setText(jTextField2.getText() + "*"); } jTextArea1.append(jTextField2.getText() + "\n"); } This will print the complete pattern
score: -1
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/q/20793777
has body: In my program I dynamically add a TableRow that has 2 TextViews and a Button in each row. When the button is click I want to delete that row. This is the code that I used to dynamically make the TableRows and add them to the TableLayout: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_delete); // Show the Up button in the action bar. setupActionBar(); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); ArrayList &lt;Item&gt; items = (ArrayList &lt;Item&gt;) bundle.getSerializable("array"); TableLayout layout = (TableLayout) findViewById(R.id.tl); for(int i=0; i&lt;items.size(); i++) { Item item = items.get(i); TextView name = new TextView(this); TextView price = new TextView(this); Button delete = new Button(this); delete.setText("Delete"); delete.setOnClickListener(click); row = new TableRow(this); TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT); row.setLayoutParams(lp); name.setText(item.getName()); price.setText(Double.toString(item.getPrice())); row.addView(name); row.addView(price); row.addView(delete); layout.addView(row, i); } } How do I implement the OnClickListener so that I can delete the corresponding row in which the delete button lies?
type: Question
has answer: http://stackoverflow.com/a/20794032
answer count: 2
has comment: http://stackoverflow.com/comment/31172397
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/20794032
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20793949
tagged with: java
has comment: http://stackoverflow.com/comment/31172652
has title: How to dynamically remove a TableRow in android
has answer: http://stackoverflow.com/a/20793949

http://stackoverflow.com/q/20818036
has comment: http://stackoverflow.com/comment/31246592
has body: displaypic is base64 encoded image but imageio.read(displaypic) returns null.No exception arises byte[] imageBytes = Base64.decodeBase64(DisplayPic); ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes); try { BufferedImage image = ImageIO.read(bis); File dpPath = new File(DisplayPicturePath); if(!dpPath.exists()) dpPath.createNewFile(); ImageIO.write(image, "jpeg",dpPath); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
has title: Java- unable to read image using ImageIO
score: 0
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31216597
has comment: http://stackoverflow.com/comment/31216952
answer count: 0
has comment: http://stackoverflow.com/comment/31217032
type: Question

http://stackoverflow.com/comment/31242902
score: 1
comment on: http://stackoverflow.com/q/20831931
type: Comment
type: QuestionComment
has text: The first way tells anybody looking at your code that you'll only be using methods from the `Icon` class - that is, the fact that this `Icon` happens to be an `ImageIcon` is irrelevant to the code. This is a maintainability boon. It also means you can do refactorings into methods that are more widely useful - ones where you pass in an `Icon` instead of an `ImageIcon`.

http://stackoverflow.com/comment/31010241
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20704023
has text: Which framework you are using ? Don't reinvent the wheel.
type: Comment

http://stackoverflow.com/a/20752047
answers question: http://stackoverflow.com/q/20735147
has body: Here is answer of my own question. I now realised mongo have hidden powers :P $m = new MongoClient(); $c = $m-&gt;selectDB("test")-&gt;selectCollection("users"); $ops = array( array( '$project' =&gt; array( "unm" =&gt; 1, "act" =&gt; 1 ) ), array('$unwind' =&gt; '$act'), array('$match' =&gt; array('act.sta' =&gt; 1)), // if you want some extra queries. In my case I am checking if status of activity is 1 array('$sort' =&gt; array('act.cat' =&gt; -1 )), // sort by created time array('$skip' =&gt; $page), // skip int variable array('$limit' =&gt;$config['per_page']), // limit int variable ); $results = $c-&gt;aggregate($ops); print_r($results);
score: 0
type: Answer

http://stackoverflow.com/q/20808673
answer count: 1
accepted answer: http://stackoverflow.com/a/20808762
tagged with: arraylist
type: AnsweredQuestion
has title: Finding the Mode of an ArrayList Java
has answer: http://stackoverflow.com/a/20808762
type: Question
tagged with: mode
has body: For the past few hours or so I've been trying to find the mode out of an ArrayList. In the program, you find the max, min, median, and mean as well. I've figured out all of those but I haven't been able to do the mode. I keep getting an IndexOutOfBoundsException. Here is my code so far: public String getMode(){ int mode = 0; int count = 0; for ( int i : file1 ){ int x = file1.get(i); int tempCount = 1; for(int e : file1){ int x2 = file1.get(e); if( x == x2) tempCount++; if( tempCount &gt; count){ count = tempCount; mode = x; } } } return ("The mode is " + mode); } The error I'm getting is: java.lang.IndexOutOfBoundsException: Index: 181, Size: 108 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at FunNumber2.getMode(FunNumber2.java:75) at FunNumber2Tester.main(FunNumber2Tester.java:46) 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 edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272)
score: 0
tagged with: java

http://stackoverflow.com/comment/30996904
score: 0
comment on: http://stackoverflow.com/q/20696001
type: QuestionComment
has text: I mean to true. Sorry.
type: Comment

http://stackoverflow.com/q/20738500
has body: I'm getting a new error: log4j:WARN No appenders could be found for logger (net.sf.jasperreports.engine.xml.JRXmlDigesterFactory). log4j:WARN Please initialize the log4j system properly. I'm using NetBeans 7.0.0. I want to develop reports. I'm already set the Log4j.jar in my classpath, but still see the error. Can you explain? Code snippet: try { System.out.println("Compiling report..."); JasperReport report =JasperCompileManager.compileReport("D:\\Schoolmngt\\src\\schoolmngt\\FirstReport.jrxml"); JasperFillManager.fillReportToFile("FirstReport.jasper",new HashMap(), new JREmptyDataSource()); JasperRunManager.runReportToPdfFile("FirstReport.jasper",new HashMap(),new JREmptyDataSource()); System.out.println("Done!"); } catch(Exception e) {e.printStackTrace(); }
score: -1
has answer: http://stackoverflow.com/a/20738598
upvote count: 0
answer count: 1
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has title: Getting a log4j:warn in simple program
linked to: http://stackoverflow.com/q/20736858
tagged with: java
linked to: http://stackoverflow.com/q/12532339
downvote count: 1
type: Question
tagged with: jasper-reports
duplicate of: http://stackoverflow.com/q/12532339

http://stackoverflow.com/q/20768893
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31128492
has answer: http://stackoverflow.com/a/20768927
favorite count: 0
tagged with: android
tagged with: sqlite
has title: Unable to add username / password to sqlite
type: UnansweredQuestion
tagged with: android-sqlite
downvote count: 1
has body: I'm attempting to add a username and password (uname and pword) to an sqlite database however I am unable to do so. I've called my DatabaseConnector class using the following: Activity1.java public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.ui1); addListenerOnButton(); DatabaseConnector dConnector = new DatabaseConnector(this); dConnector.addUser(null, null); Then I try to add a new username and password here using the addUser method: DatabaseConnector.java public class DatabaseConnector extends SQLiteOpenHelper { private static final int Version =1; private static final String firstName="FIRST_NAME"; private static final String lastName="LAST_NAME"; private static final String email="EMAIL"; private static final String phoneNumber="PHONE_NUMBER"; private static final String username="USERNAME"; private static final String password="PASSWORD"; private static final String databaseName="FORM"; private static final String tableName="USER_RECORDS"; private static final String id = "ID"; public DatabaseConnector(Context context) { super(context, databaseName, null, Version); } @Override public void onCreate(SQLiteDatabase database) { String createTableSQL = "CREATE TABLE " + tableName + " (" + id +" INTEGER NOT NULL PRIMARY KEY, " + firstName +" TEXT, " + lastName + " TEXT, " +email + " TEXT, " + phoneNumber + " TEXT, " + username + " TEXT, " + password + " TEXT)"; Log.d("onCreate()", createTableSQL); database.execSQL(createTableSQL); } @Override public void onUpgrade(SQLiteDatabase database, int arg1, int arg2) { } public void addUser(String uname, String pword ) { String insertSQL = "INSERT INTO " + tableName + " (" + username + " ," + password + ") " + "VALUES" + " ('" + uname + "', '" + pword + "')" ; Log.d("addRecord()", insertSQL); SQLiteDatabase dataBase = this.getWritableDatabase(); dataBase.execSQL…

http://stackoverflow.com/a/20829969
downvote count: 0
has comment: http://stackoverflow.com/comment/31239295
has body: You need to try and let go of the Java mindset. You see, the beauty of STL, is that it separates algorithms from containers through iterators. Long story short: Pass around iterators to your algorithms. Don't inherit. Here are all the containers: http://en.cppreference.com/w/cpp/container And here are all the algorithms: http://en.cppreference.com/w/cpp/algorithm There may be two reasons why you may want to inherit: You want to reuse implementation (bad idea) Reuse existing algorithms by making a behavior available (e.g. inheriting from a base class like AbstractSet) To briefly touch upon the first point, if you need to store an array of things (say an array of objects in a game scene), do exactly that, have an array of these objects as a member to the Scene object. There is no need to subclass to fully utilize the container. In other words, prefer composition over inheritance. This has been done to death already, and is accepted in the Java world as doing "The Right Thing". See discussion here, it's in the GoF book! Same thing applies to C++. Example: To address the second point let's consider a scenario. You are making a 2D sidescroller game, and you have a Scene object, with an array of GameObjects. These GameObjects have positions, and you'd like to sort them by position, and do binary search to find the closest object, as an example. In the C++ mindset, the storage of elements and manipulation of containers are two separate things. The container classes provide the bare minimum functionality, for creation/insertion/removal. Anything interesting above that is relegated to Algorithms. And the bridge between them are iterators. The idea is that whether you use std::vector&lt;GameObject&gt; (equivalent to Java's ArrayList I think), or your own implementation is irrelevant as long as access to elements is the same. Here is a contrived example: struct GameObject { float x, y; // compare just by x position operator &lt; (GameObject const&amp; other) { return x &lt; ot…
has comment: http://stackoverflow.com/comment/31239232
score: 9
has comment: http://stackoverflow.com/comment/31239435
type: Answer
has comment: http://stackoverflow.com/comment/31239448
has comment: http://stackoverflow.com/comment/31239024
has comment: http://stackoverflow.com/comment/31239758
has comment: http://stackoverflow.com/comment/31239900
upvote count: 9
has comment: http://stackoverflow.com/comment/31906076
has comment: http://stackoverflow.com/comment/31239486
answers question: http://stackoverflow.com/q/20829860
has comment: http://stackoverflow.com/comment/31239314

http://stackoverflow.com/q/20683926
upvote count: 2
has body: I'm using Ant to build my Java application and to generate the MANIFEST.MF file automatically so it includes all the jars in my lib directory. This seems to work but the problem is that instead of writing them as lib/some.jar, it includes my Eclipse project's name: MyProject/lib/some.jar. This is ofcourse incorrect and causes none of the jars to be found when run as a standalone app. Build.xml (important part is at the end): <?xml version="1.0"?> <include name="*.jar"/> <mkdir dir="_deliverables/lib"/> <include name="**/*.jar"/> <classpath refid="jarlib" /> <mkdir dir="bin"/> <classpath refid="compile.classpath"/> <attribute name="Class-Path" value="${lib.list}"/> Example of how my Manifest looks: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.4 Class-Path: MyProject/lib/All-MB.jar MyProject/lib/activation.jar MyProject/lib/aspectjrt.jar Any idea on how to fix this so it just shows xxx.jar instead of MyProject/lib/xxx.jar (so without "MyProject/lib/")? Cheers, Bart
favorite count: 0
has answer: http://stackoverflow.com/a/20684622
type: AnsweredQuestion
score: 2
tagged with: build
downvote count: 0
tagged with: java
has title: Ant build creates incorrect relative paths to jars when generating manifest
tagged with: classpath
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20684622
tagged with: ant
has answer: http://stackoverflow.com/a/20685186
accepted answer: http://stackoverflow.com/a/20685186
tagged with: manifest

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/20783789
type: Tag

http://stackoverflow.com/q/20723117
upvote count: 3
tagged with: java
has title: BufferUnderflowException exception while doing getLong when buffer is allocated 14 bytes
has answer: http://stackoverflow.com/a/20723475
type: Question
possible better answer: http://stackoverflow.com/a/20723475
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20723253
accepted answer: http://stackoverflow.com/a/20723253
has body: Very small piece of code but i am completely surprised with the behavior. I have a 14 byte key which is in a byte array.I put this byte array into a ByteBuffer then doing a getLong gives me a BufferUnderflowException. Can't understand why? byte key[] = new byte[14]; key[13] = (byte) 3; key[12] = (byte) 21; key[11] = (byte) 1; key[10] = (byte) 15; key[9] = (byte) 66; key[8] = (byte) 64; key[7] = (byte) 3; key[6] = (byte) 65; key[5] = (byte) -10; key[4] = (byte) -65; key[3] = (byte) 3; key[2] = (byte) 65; key[1] = (byte) -10; key[0] = (byte) -65; ByteBuffer b = ByteBuffer.allocate(14); b.put(key); long l = b.getLong();
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/31258206
comment on: http://stackoverflow.com/q/20840153
type: QuestionComment
type: Comment
has text: There is definitely a chapter dedicated to this topic (*scoped beans inside singletons*) in Spring guide - I will try to find a link. In short - you should do this only for interface based dependencies as they will be proxied. For standard classes you would need some inheritance (CGLIB) *magic*.
score: 1

http://stackoverflow.com/q/20723050
has comment: http://stackoverflow.com/comment/31045486
has answer: http://stackoverflow.com/a/20723193
score: 2
type: AnsweredQuestion
has title: Information from the exception object via java.util.logging
favorite count: 0
type: Question
upvote count: 2
has body: I want to make logging during my java application development. I want the information from the exception object during exception handling. Which information inquiry from the object is preferred? Using the .getMessage() method, or the .toString() method? My .getMessage() code snippet: try { //my code } catch( Exception ex ) { log.log( Level.SEVERE, ex.getMessage(), ex ); } My .toString() code snippet: try { //my code } catch( Exception ex ) { log.log( Level.SEVERE, ex.toString(), ex ); }
answer count: 1
tagged with: logging
accepted answer: http://stackoverflow.com/a/20723193
tagged with: java
tagged with: java.util.logging
downvote count: 0

http://stackoverflow.com/comment/31069802
type: Comment
has text: @OrelBitton: Make sure you are using an identity matrix for projection and modelview if you want that to work. If you do that, the quad will fill your entire screen because you will be drawing in Normalized Device Coordiantes. Otherwise, those points could be literally anywhere after projection.
comment on: http://stackoverflow.com/a/20733625
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31222372
type: Comment
type: QuestionComment
has text: There's **no way** to directly access **local** variable from another method.
comment on: http://stackoverflow.com/q/20821111
score: 0

http://stackoverflow.com/q/20703822
has comment: http://stackoverflow.com/comment/31010488
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31011658
has answer: http://stackoverflow.com/a/20705074
tagged with: struts2
has title: NullPointerException while using a setter injection of SessionFactory bean
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: I am getting null pointer exception. The setter injection is not working I guess. I tried to look into server logs but not being able to find the root cause. 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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <import resource="DataSource.xml"/> <import resource="HibernateSessionFactory.xml"/> <import resource="UsersBean.xml"/> DataSource.xml: UsersBean.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config/> ModelClass: package com.riteshsangwan.integration; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class ModelClass implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long mid; private String name; private String email; public long getMid() { return mid; } public void setMid(long mid) { this.mid = mid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public S…
accepted answer: http://stackoverflow.com/a/20705074
has comment: http://stackoverflow.com/comment/31011955
tagged with: spring
has comment: http://stackoverflow.com/comment/31011615
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/31010667
has comment: http://stackoverflow.com/comment/31010572
tagged with: mysql
has comment: http://stackoverflow.com/comment/31010273
type: Question
has comment: http://stackoverflow.com/comment/31011395

http://stackoverflow.com/q/20791536
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/31175270
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31178946
has body: I am building my new project. When I was deploying my project in to Google App Engine, sometimes for all the ajax calls 500 internal server error is coming. If I deploy the same version 2 to 3 times then that error will not occur. Project will run with out any errors. What is the reason that is occurring this error? LOGS:: Uncaught exception from servlet java.lang.ExceptionInInitializerError at com.acti.service.TranscriptServiceHelper.transcriptsdataNew(TranscriptServiceHelper.java:89) at com.acti.controller.AdminQueueGae.getTransctriptFromGAENEW(AdminQueueGae.java:53) 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:45) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:774) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) …
score: 0
has comment: http://stackoverflow.com/comment/31170045
has title: 500 internal server error after GAE Deployment

http://stackoverflow.com/q/20811180
has title: Chess - console to GUI
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31205305
type: Question
has comment: http://stackoverflow.com/comment/33651383
upvote count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31203777
tagged with: console
favorite count: 0
has comment: http://stackoverflow.com/comment/31216764
has body: I'm attempting to move my console-based chess game to a GUI. I'm currently referencing the this chess tutorial to help get me started. I'm currently setting only one white rook on the board for testing purposes. In my console chess program, I have a Rook Class that determines how the Rook can move, what color it is, and so on. In the tutorial code, they add a piece to the board like so: // Add a few pieces to the board JLabel piece = new JLabel("rl.png"); JPanel panel = (JPanel) chessBoard.getComponent(0); panel.add(piece); // my Attempt ---------------------------------------------------// // String rook = "Rook"; // ImageIcon image4 = new ImageIcon("rl.png"); // Rook firstRook = new Rook(rook, image4); // // piece = new JLabelfirstRook); // panel = (JPanel) chessBoard.getComponent(0); // panel.add(piece); The rook can then be moved all over the board as it does not have any move rules applying to it. I want to hook up my rook class to the JLabel piece, so that the rook is bound by the move rules. Thus, my question: How can I hook up my console Rook Class to the Rook on the board? And is there is a better way of doing this? Any help is appreciated, I've already scoured the internet for help on this and haven't been successful. Thanks! My Rook Class: public class RookTest extends ChessPiece { String name; ImageIcon visualRep; //= new ImageIcon("rl.png"); public RookTest(String name, ImageIcon visualRep) { this.name = name; this.visualRep = visualRep; } public String setInBoard() { return "| " + name + " |"; } public String getName() { return name; } public String getColor() { String pieceColor = null; if (name.equals("r")) { pieceColor = "d"; } else if (name.equals("R")) { pieceColor = "l"; } return pieceColor; } public String toString() { //something to find the color in here return "Rook"; } //legal moves //-------------------------------------------------------------------------------------------------------// public boolean legalMove(ChessPiece[][] chess, int st…
has comment: http://stackoverflow.com/comment/31203832
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: chess
has comment: http://stackoverflow.com/comment/31205442

http://stackoverflow.com/q/20751773
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20751802
upvote count: 1
has title: GetParameter in Java returns error
tagged with: java
has answer: http://stackoverflow.com/a/20751809
type: Question
answer count: 2
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31097953
has comment: http://stackoverflow.com/comment/31097956
favorite count: 0
has body: I am editing source code with very limited knowledge of java (I use php/AS and I need this as well unfortunately). Anyway, I am reading params from an HTML file. In one of the classes of the source it reads parameters just fine, but when I try to do it from another class it isn't working String tmp; tmp = getParameter("playername"); Here's the error message I get... C:\java\applet\source2\BufferView.java:432: error: cannot find symbol tmp = getParameter("playername"); ^ symbol: method getParameter(String) location: class BufferView 1 error

http://stackoverflow.com/comment/31258126
has text: It's not an answer to the requirement (which is to make the IDE report it), but I give it a +1 just for being a really cool and useful answer. I didn't even know you could do this!
comment on: http://stackoverflow.com/a/20840510
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20707218
favorite count: 0
has answer: http://stackoverflow.com/a/20707280
tagged with: cycle
possible better answer: http://stackoverflow.com/a/20707297
has comment: http://stackoverflow.com/comment/31016257
has comment: http://stackoverflow.com/comment/31016148
accepted answer: http://stackoverflow.com/a/20707280
has answer: http://stackoverflow.com/a/20707611
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31016207
tagged with: java
tagged with: loops
downvote count: 1
type: Question
tagged with: for-loop
upvote count: 0
has comment: http://stackoverflow.com/comment/31016179
has title: Java For Loop Problems
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/31016232
has body: JButton nupp0 = new JButton(); // Teen nupu objektid, rida 54 JButton nupp1 = new JButton(); JButton nupp2 = new JButton(); JButton nupp3 = new JButton(); JButton nupp4 = new JButton(); JButton nupp5 = new JButton(); JButton nupp6 = new JButton(); JButton nupp7 = new JButton(); public JButton nupud[] = { nupp0, nupp1, nupp2, nupp3, nupp4, nupp5, nupp6, nupp7 }; I was told to create this pieace of code in for loop, Ive tried many ways, but I cant get it to work. Any Ideas? These are my 2 tries: for (int i =0 ; i &lt; nupud.length ; i++) { JButton nupud[i] = new JButton; } for (int i = 0 ; i &lt; nupud.length ; i++) { nupud[i] = new JButton(); }
has answer: http://stackoverflow.com/a/20707297

http://stackoverflow.com/comment/34704809
type: Comment
has text: I added `JAVA_HOME="/usr/lib/jvm/java-6-openjdk-i386"` in new line of etc/envirnment. Problem solved.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20726690

http://stackoverflow.com/a/20711072
has comment: http://stackoverflow.com/comment/31024832
has body: As long as your repos are outside of your workspace, it doesn't matter where they are relative to the workspace. In your example root_dir contains the workspace and your projects, and I wanted to point out that the workspace could be at /some/random/path and your projects could be /at/totally/different/path, it shouldn't matter where they are relative to each other. I keep my local repos in ~/dev/git/ in unix and /c/dev/git in Windows. I keep my workspaces wherever Eclipse wants me to keep them, which is the first directory it pops up for me, sometimes ~/Documents/workspace, or %USERDIR%\workspace. Usually I don't even know where my workspace is, and it doesn't really matter, because the important and interesting part is where my code is.
answers question: http://stackoverflow.com/q/20709787
type: Answer
has comment: http://stackoverflow.com/comment/31024037
has comment: http://stackoverflow.com/comment/31023942
has comment: http://stackoverflow.com/comment/31024223
score: 0
has comment: http://stackoverflow.com/comment/31023797

http://stackoverflow.com/q/20833433
has answer: http://stackoverflow.com/a/20833731
has comment: http://stackoverflow.com/comment/31245786
has body: All objects in Java have intrinsic locks and these locks are used for synchronization. This concept prevents objects from being manipulated by different threads at the same time, or helps control execution of specific blocks of code. What will happen if the locks themselves get contended upon - i.e. 2 threads asking for the lock at the exact microsecond. Who gets it, and how does it get resolved?
downvote count: 0
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/20833674
has comment: http://stackoverflow.com/comment/31245689
upvote count: 8
has comment: http://stackoverflow.com/comment/31245599
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/20833731
has answer: http://stackoverflow.com/a/20833821
has comment: http://stackoverflow.com/comment/31245744
answer count: 4
has comment: http://stackoverflow.com/comment/31245605
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31245667
type: Question
tagged with: locking
possible better answer: http://stackoverflow.com/a/20833667
has comment: http://stackoverflow.com/comment/31245653
has comment: http://stackoverflow.com/comment/31245635
has title: What will happen if the locks themselves get contended upon?
has answer: http://stackoverflow.com/a/20833667

http://stackoverflow.com/comment/114821931
type: Comment
comment on: http://stackoverflow.com/a/20749656
has text: In my code, I have actually identified several different ways we're told about closed channels. 1) Trying to initiate operation on a closed channel immediately completes with `ClosedChannelException`. 2) The specialized subclass `AsynchronousCloseException` is when a pending operation aborts. 3) Trying to initiate when the associated group is closed will get you a `ShutdownChannelGroupException`. 4) Any IOException which has _a cause_ set to a `ShutdownChannelGroupException` is a rare breed but means the operation initialization was accepted but failed afterwards because the group shutdown.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31121480
score: 0
comment on: http://stackoverflow.com/a/20764808
type: AnswerComment
has text: //averageTxt.setText(array1.findAverageFromArray()+""); that code is just an example made up by my friend. I've tried your code but averageTxt at the beginning gives me an red cross error. Not sure what exactly is going on but the end result should be the Average button in my GUI linked to the average method.
type: Comment

http://stackoverflow.com/q/20682309
has comment: http://stackoverflow.com/comment/30972030
tagged with: java
tagged with: http://stackoverflow.com/tag/tar
has comment: http://stackoverflow.com/comment/30971847
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/20682903
answer count: 1
has comment: http://stackoverflow.com/comment/30971685
has comment: http://stackoverflow.com/comment/30971934
has answer: http://stackoverflow.com/a/20682903
has body: Suppose I have 3 different locations /1/data_files/ /2/user/data/ /3/temp/files/ What I wish to do here is tar the files under 'data_files', 'data' and 'files' in one tgz bundle on say master node. Stream it to slave node and untar on same locations on slave node. I'm not asking for streaming logic. All I wanna know is how to tar and untar in such scenario in JAVA. Thanks
has title: How to tar from different locations and untar on same locations in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/30972113
has comment: http://stackoverflow.com/comment/30971806

http://stackoverflow.com/comment/31173298
type: QuestionComment
has text: use `BuffetOfferings_MainFragmentActivity extends FragmentActivity`.
comment on: http://stackoverflow.com/q/20794305
score: 0
type: Comment

http://stackoverflow.com/q/20849418
type: Question
answer count: 2
tagged with: automation
has body: Trying to select a button from a collapsible area of a web page using Selenium WebDriver. I'm very new to WebDriver, and am having issues figuring out how to get this particular little monster. &lt;a href="#" class="btn new-fields-button" data-fields="&amp;lt;div class='contributor-form form-inline form-nested'&amp;gt; &amp;lt;select id=&amp;quot;video_item_contributors_attributes_39041920_role&amp;quot; name=&amp;quot;video_item[contributors_attributes] [39041920][role]&amp;quot;&amp;gt;&amp;lt;option value=&amp;quot;Actor&amp;quot;&amp;gt;Actor&amp;lt;/option&amp;gt; &amp;lt;option value=&amp;quot;Director&amp;quot;&amp;gt;Director&amp;lt;/option&amp;gt; &amp;lt;option value=&amp;quot;Writer&amp;quot;&amp;gt;Writer&amp;lt;/option&amp;gt; &amp;lt;option value=&amp;quot;Producer&amp;quot;&amp;gt;Producer&amp;lt;/option&amp;gt;&amp;lt;/select&amp;gt; &amp;lt;input class=&amp;quot;input-small&amp;quot; id=&amp;quot;video_item_contributors_attributes_39041920_name&amp;quot; name=&amp;quot;video_item[contributors_attributes][39041920][name]&amp;quot; placeholder=&amp;quot;Name&amp;quot; size=&amp;quot;30&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt; &amp;lt;a class='btn btn-danger delete-nested' data-destroy-id='destroy-contributor-toggle-'&amp;gt; &amp;lt;i class='ss-trash'&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/div&amp;gt; " data-id="39041920"&gt;&lt;i class="ss-plus"&gt;&lt;/i&gt; Add Contributor&lt;/a&gt; That's the section of code (tried to break it up to be readable here) that describes the button that neds to be clicked, copied directly from Chrome's "Inspect Element" view. Any ideas?
has answer: http://stackoverflow.com/a/20851253
score: 0
accepted answer: http://stackoverflow.com/a/20851253
has answer: http://stackoverflow.com/a/20849543
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20849543
tagged with: java
tagged with: selenium
has title: Unable to select a button using Selenium WebDriver in Java

http://stackoverflow.com/q/20802945
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31188384
has comment: http://stackoverflow.com/comment/31188452
has title: Array is in list error
has comment: http://stackoverflow.com/comment/31188643
answer count: 3
tagged with: arrays
has answer: http://stackoverflow.com/a/20803012
has comment: http://stackoverflow.com/comment/31188409
has comment: http://stackoverflow.com/comment/31188411
has answer: http://stackoverflow.com/a/20803166
has comment: http://stackoverflow.com/comment/31188326
has comment: http://stackoverflow.com/comment/31188394
has answer: http://stackoverflow.com/a/20803045
has comment: http://stackoverflow.com/comment/31188438
has comment: http://stackoverflow.com/comment/31188552
score: 0
type: UnansweredQuestion
has body: I'm trying to test if an array contains a certain value and put its index in the variable p1CombFInd. int[] allowedNumbers = { 31, 32, 41, 42, 43, 51, 52, 53, 54, 61, 62, 63, 64, 65, 11, 22, 33, 44, 55, 66, 21, }; if (Arrays.asList(allowedNumbers).contains(txtNumber2.getText())){ p1CombFInd = Arrays.asList(allowedNumbers).indexOf(txtNumber1.getText()); } But I always get the error Cannot resolve symbol "allowedNumbers" Edit: Could my imports cause the problem, too? import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import java.util.Arrays; import java.util.List; import static com.pexldesign.mia.R.*;

http://stackoverflow.com/q/20813496
has answer: http://stackoverflow.com/a/75341931
has answer: http://stackoverflow.com/a/68376918
upvote count: 47
has answer: http://stackoverflow.com/a/64802199
has answer: http://stackoverflow.com/a/69533258
downvote count: 0
tagged with: netbeans-7
answer count: 16
has answer: http://stackoverflow.com/a/64527138
tagged with: tomcat
favorite count: 0
score: 47
has answer: http://stackoverflow.com/a/54520283
has comment: http://stackoverflow.com/comment/31231934
has body: While doing some operations in my application I got java.lang.IllegalStateException Cannot call sendError() When I reload the page again it work some time properly, but after some time again it shows the same exception. How can I overcome this exception? Below is the exception: HTTP Status 500 - Cannot call sendError() after the response has been committed type Exception report message Cannot call sendError() after the response has been committed description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.IllegalStateException: Cannot call sendError() after the response has been committed org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:451) org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:725) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.40 logs. Struts.xml /register.jsp list <interceptor-ref name="basicStackHibernate" /> /list.jsp
has answer: http://stackoverflow.com/a/44276269
has answer: http://stackoverflow.com/a/30565713
has title: Tomcat exception Cannot call sendError() after the response has been committed?
has answer: http://stackoverflow.com/a/77216251
has answer: http://stackoverflow.com/a/41503350
has answer: http://stackoverflow.com/a/24214003
has answer: http://stackoverflow.com/a/53628156
has comment: http://stackoverflow.com/comment/31208055
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31208332
has answer: http://stackoverflow.com/a/50528595
has answer: http://stackoverflow.com/a/47028958
has comment: http://stackoverflow.com/comment/31208940
has comment: http://stackoverflow.com/comment/31208130
has comment: http://stackoverflow.com/comment/86948515
has comment: http://stackoverflow.com/comment/88068697
tagged with: java
has answer: http://stackoverflow.com/a/70006795
has answer: http://stackoverflow.com/a/59699712
tagged with: struts2
type: Question

http://stackoverflow.com/q/20829220
tagged with: java
type: Question
has body: Here is my code import java.util.Scanner; public class NthSmallest{ public static void main (String [] args){ Scanner input = new Scanner(System.in); System.out.println("Please enter the size of the array"); final int N = 15; int n = input.nextInt(); int array[] = new int [N]; System.out.println("enter 15 number "); for (int i = 0 ; i &lt; array.length; i++ ) { array[i] = input.nextInt(); } System.out.println(findNthSmallest(array, n )); } public static int findNthSmallest( int array[], int n ){ int i, j,t=0; for(i = 0; i &lt; n; i++){ for(j = 1; j &lt; (n-i); j++){ if(array[j-1] &gt; array[j]){ t = array[j-1]; array[j-1]=array[j]; array[j]=t; } } } return array[n-1]; } } When I want to find fifthSmallestNumber and enter 5 as the first input, the program finds the number five not fifth smallest number. How can I fix it?
answer count: 2
downvote count: 2
score: -2
has title: Find the nth smallest number
possible better answer: http://stackoverflow.com/a/20829295
favorite count: 0
has answer: http://stackoverflow.com/a/20829295
has answer: http://stackoverflow.com/a/20829328
accepted answer: http://stackoverflow.com/a/20829328
has comment: http://stackoverflow.com/comment/31237625
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31237582

http://stackoverflow.com/q/20751618
has body: Is there a way in Java to check if a HashMap value belongs to a specific key? Example : if (Object.getId().equals(pairs.getKey()) &amp;&amp; pairs.getValue().BelongsToThisKey(pairs.getKey())==true) { // do whatever... } I know it is strange but this is the check I have to perform.. Any help will be appreciated.
has answer: http://stackoverflow.com/a/20751888
answer count: 3
has title: HashMap Key/Value reference
score: 0
accepted answer: http://stackoverflow.com/a/20751888
has answer: http://stackoverflow.com/a/20751663
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20751646
has comment: http://stackoverflow.com/comment/31097676
has answer: http://stackoverflow.com/a/20751646
tagged with: java
type: Question
tagged with: hashmap

http://stackoverflow.com/a/20830515
score: 2
accepted answer of: http://stackoverflow.com/q/20830382
answers question: http://stackoverflow.com/q/20830382
type: AcceptedAnswer
downvote count: 0
has body: Your problem arises from overriding paint in your OpeningScreen class. The background is not drawn because you never draw it! Call super.paint(g) to fix this. However, it is generally recommended to use paintComponent() instead of paint(). Just move your code to paintComponent. This method correctly draws a black background a red square: @Override public void paintComponent(Graphics g){ super.paintComponent(g); g.fillRect(100, 100, 100, 100); }
has comment: http://stackoverflow.com/comment/31240089
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/31240397

http://stackoverflow.com/q/20843741
has answer: http://stackoverflow.com/a/20844460
has body: I've my JavaFX app that calls some JNI code, uses a preloader jar and is compiled using jdk 1.7. Now when I run jar on another computer with JRE7, by: Double clicking jar: it starts but cannot load the JNI code containing libraries and therefore gets stuck. Running jar via terminal using "java -jar ": App runs completely normal! Now if I install jdk on this machine, it runs fine even with double click! Can somebody tell me what is difference in these 3 cases?
tagged with: jar
type: Question
has title: Why javaFX application jar runs on jdk but not on jre?
score: 0
tagged with: javafx
answer count: 2
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20843827

http://stackoverflow.com/comment/31128769
comment on: http://stackoverflow.com/a/20768976
score: 0
type: AnswerComment
type: Comment
has text: It is there. I can't imagine what happened..suddenly something happened. don't know how to explain.. every points I set a sout. can't find the place that error occur..

http://stackoverflow.com/q/20762345
tagged with: java
has title: ArrayAdapter requires the resource ID to be a TextView in DialogFragment
type: Question
tagged with: android-dialogfragment
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has body: I use an ArrayAdapter in a DialogFragment, that work on Android 4.0 and more but not in 2.3. @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialog, null); Spinner spReglement; spReglement = (Spinner)view.findViewById(R.id.listReglements); ArrayAdapter&lt;String&gt; adapterList = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1); adapterList.setDropDownViewResource(R.layout.customspinner); spReglement.setAdapter(adapterList); HashMap&lt;Integer, String&gt; mapReglement = new HashMap&lt;Integer, String&gt;(); mapReglement.put(-1, ""); adapterList.add(""); for(int i=0; i&lt;alReglement.size();i++){ String libelle = String.valueOf(alReglement.get(i).get("Libelle")); mapReglement.put(i, libelle); adapterList.add(libelle); } builder.setView(view) .setPositiveButton("Valider", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mListener.onDialogPositiveClick(DialogFSE.this); } }) .setNegativeButton("Annuler", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mListener.onDialogNegativeClick(DialogFSE.this); } }); return builder.create(); } My Layout "dialog" contains 3 EditText and 1 Spinner, my layout "customspinner" constains only a TextView. When I execute my app on Android 2.3 I have the following exception : FATAL EXCEPTION : com.mypackage.myapss.mainThread java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView ... Don't now if it's useful but I use the android support v4 library in my app.
has answer: http://stackoverflow.com/a/20762476
accepted answer: http://stackoverflow.com/a/20762476
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: android-arrayadapter

http://stackoverflow.com/comment/31014187
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/20704194
has text: I found that issue is path of my certificatefile.. because ClassLoader.class.getResourceAsStream("/WEB-INF/cert.p12") returns null.
type: Comment

http://stackoverflow.com/q/20822227
upvote count: 0
has answer: http://stackoverflow.com/a/20822328
accepted answer: http://stackoverflow.com/a/20822312
favorite count: 0
has comment: http://stackoverflow.com/comment/31224507
has comment: http://stackoverflow.com/comment/31224298
has comment: http://stackoverflow.com/comment/31224490
tagged with: buttonclick
tagged with: repaint
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31224464
downvote count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/20822312
type: Question
score: -2
tagged with: jpanel
answer count: 2
has title: How to stop JPanel content from shifting when button is pressed?
possible better answer: http://stackoverflow.com/a/20822328
has body: This concerns JAVA programming. I have a confusing question that I can't seem to figure out despite searching all over the internet. I am somewhat of a newer programmer, so this may be a relatively stupid thing to ask. Anyways, here is my question: I made a calculator GUI program (a simple one) that utilizes a JPanel with one text field, one JButton and one JTextArea. My issue is that when I press the JButton and the calculated result is displayed in the JTextArea, if it's long enough in digits, everything above it in the JPanel gets shifted to the right. How do I fix this such that the content does not shift upon the button click/refresh of the panel? Thanks, -Han

http://stackoverflow.com/q/20839099
has body: I'm trying to get rid of one troublesome exception. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.galleryphoto_fragment, null); ... This line leads to Binary XML file line #13: Error inflating class pl.XXX.app.utils.ImageViewZoom and this XML file looks like this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ProgressBar android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:visibility="gone" /&gt; &lt;pl.XXX.app.utils.ImageViewZoom &lt;!-- line #13 --&gt; android:id="@+id/mainPhoto" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="matrix" /&gt; &lt;/FrameLayout&gt; I've marked the 13th line for you. What have I tried? Well, originally I've thought it's the ImageViewZoom error not getting registered properly but it's working when called from another piece of code. Could someone point me in the right direction here please? update Here is the stack: android.view.InflateException: Binary XML file line #13: Error inflating class pl.XXX.app.utils.ImageViewZoom at android.view.LayoutInflater.createView(LayoutInflater.java:620) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at pl.XXX.app.fragments.GalleryPhotoFragment.onCreateView(GalleryPhotoFragment.java:41) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) at android.s…
has title: Error inflating class ... in onCreateView
has answer: http://stackoverflow.com/a/20840253
has comment: http://stackoverflow.com/comment/31256371
has comment: http://stackoverflow.com/comment/31255648
has comment: http://stackoverflow.com/comment/31257130
tagged with: android
has comment: http://stackoverflow.com/comment/31256116
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
upvote count: 1
type: AnsweredQuestion
tagged with: android-layout
has comment: http://stackoverflow.com/comment/31256056
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/20840253
type: Question
has comment: http://stackoverflow.com/comment/31255591
downvote count: 0

http://stackoverflow.com/q/20749225
has title: How to make one word in a TextView with a long text from a string clickable?
answer count: 4
has answer: http://stackoverflow.com/a/20749265
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/10696986
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/4474237
has answer: http://stackoverflow.com/a/20749270
possible better answer: http://stackoverflow.com/a/20749265
has answer: http://stackoverflow.com/a/20749271
accepted answer: http://stackoverflow.com/a/20749271
tagged with: textview
linked to: http://stackoverflow.com/q/8612652
tagged with: string
has body: I have a little question about coding in Java on Android. So, I have one TextView with a long text from a string. I want to make only one word of this long text clickable, that I can link it to an other Activity. By the way, I'm new to the Android development, so please don't explain your solution too complicated. Thanks! :) I have no idea, how I could do this. I also googled after a solution before but didn't find a clear way that worked well. Anyway, I would appreciate your help.
favorite count: 0
has answer: http://stackoverflow.com/a/20749329
tagged with: android

http://stackoverflow.com/q/20761229
has comment: http://stackoverflow.com/comment/31114115
type: Question
has comment: http://stackoverflow.com/comment/31114213
tagged with: java
tagged with: callable
tagged with: concurrency
has title: runnable calls notifyall to wake itself - java
score: 0
tagged with: runnable
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20761346
has body: I have a class that implements Callable , X , and a class that implements Runnable , Y. Y has a collection of X's , and when one of X's ends I want to wake Y , X has Y as a private field, can I just use Y.notifyAll() to wake it?

http://stackoverflow.com/a/20721525
score: 4
has body: If you are getting a NullPointerException in this line: con.log("this is a test"); The only thing that can be null is con. You are probably defining it, but not actually creating it. Logging con; and not Logging con = new Logging();
has comment: http://stackoverflow.com/comment/31135966
upvote count: 4
type: Answer
answers question: http://stackoverflow.com/q/20721301
downvote count: 0

http://stackoverflow.com/comment/31005227
comment on: http://stackoverflow.com/q/20701247
type: Comment
type: QuestionComment
score: 0
has text: how did you print the result to the console?

http://stackoverflow.com/comment/31065693
type: Comment
comment on: http://stackoverflow.com/q/20731886
score: 0
has text: Please include some of your code that is creating the button and attaching the texture to it.
type: QuestionComment

http://stackoverflow.com/a/20798355
answers question: http://stackoverflow.com/q/20797680
score: 0
has body: Check your manifest file: <?xml version="1.0" encoding="utf-8"?> <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" /> <permission android:name="com.example.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="com.example.MAPS_RECEIVE" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-library android:name="com.google.android.maps" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR KEY" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Check your layout file: <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.MapFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> Check your source file: GoogleMap googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
type: Answer
has comment: http://stackoverflow.com/comment/31183274

http://stackoverflow.com/comment/31075856
comment on: http://stackoverflow.com/a/20738712
has text: @MohdAdnan: If you want such a default behavior in your parent, then I see 2 choices: 1) Casting 2) Passing Class<T> in the constructor, and using it for creating the instance. This doesn't require a cast, but it requires the artificial constructor argument. Anyway, both solutions will fail if a subclass doesn't respect the convention, and assigns an incorrect type to T.
score: 0
type: AnswerComment
type: Comment

factory
tags question: http://stackoverflow.com/q/20848082
tag name: factory
type: Tag
tags question: http://stackoverflow.com/q/20751867
tags question: http://stackoverflow.com/q/20846891

http://stackoverflow.com/comment/31196154
type: Comment
has text: I don´t knowCheatEngine, but on it´s download site it says that it includes stuff like (dis-)assembler and decompiler. What you have are only some (data) bytes, what CheatEngine has (and understands) is the code part of the executable.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20806863

http://stackoverflow.com/q/20740553
upvote count: 1
type: AnsweredQuestion
tagged with: alloy
tagged with: java
has title: A4options.symmetry and signature instances permutattions in Alloy
accepted answer: http://stackoverflow.com/a/20749681
type: Question
tagged with: api
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20749681
has body: I have modeled a diagram transformation chain in Alloy. I am interested in any chain that results of the solving, but some of the chains are exactly the same. They are the same except permutation between signature instances, but the relations between instances form exactly the same graphs from one solution to an other. Is there a way to avoid these redundant solutions? I saw a symmetry option in the A4Option class but I didn't really understand how to configure it. /** This option specifies the amount of symmetry breaking to do (when symmetry breaking isn't explicitly disabled). * * &lt;p&gt; If a formula is unsatisfiable, then in general, the higher this value, * the faster you finish the solving. But if this value is too high, it will instead slow down the solving. * * &lt;p&gt; If a formula is satisfiable, then in general, the lower this value, the faster you finish the solving. * Setting this value to 0 usually gives the fastest solve. * * &lt;p&gt; Default value is 20. */ Does it mean if I put 0 it is disabled? if I put a higher value does it avoid symmetry? If you consider a set of atoms and relations between these atoms as a graph. Ans an adjacency matrix as the characterization the relation between atoms in a matrix. Does symmetry means 2 instances that have equivalent adjacency matrix? In order to reduce the solving complexity, is there a way to specify to the solver that we are not interested in some specific signature instances permutation or relation permutation but in their architecture configuration? Thanks in advance.
score: 1

http://stackoverflow.com/a/20696349
has body: Dx trouble writing output: already prepared [Dex Loader] Unable to execute dex: Multiple dex files define Lcom/esotericsoftware/jsonbeans/Json$FieldMetadata; [-android] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/esotericsoftware/jsonbeans/Json$FieldMetadata; As it says, there's duplicate references of the same package. You will need to figure out where exactly these packages are in the libraries that you are adding. And figure out a way to keep only one copy of it. I am guessing kyronet already has the jsonbeans included. May be try removing the jsonbeans library from your list of dependencies.
has comment: http://stackoverflow.com/comment/30999543
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/30999567
answers question: http://stackoverflow.com/q/20696194
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31106641
type: QuestionComment
has text: @Vishal in the suggested question I cant pass only time?
score: 0
comment on: http://stackoverflow.com/q/20756526
type: Comment

http://stackoverflow.com/comment/31221778
has text: @fvu I think that If I kill java, I would have killed all java programs including my IDEs. The program is for test and up to an hour ago I had never written a program using Derby, so thanks for error handling comment but they must be replaced with JOptionPane/System.exit(0) in the final code. The more important thing is when the user uses the program. S/he doesn't know that must kill that process in the task manager and I must do it for him/her.
comment on: http://stackoverflow.com/q/20820769
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20706171
type: Answer
answers question: http://stackoverflow.com/q/20705914
score: 2
upvote count: 2
has body: You need to add the dependency as dependency of the execution plugin, so the execution plugin can load the class you configured com.example.myclass: <plugins> org.codehaus.mojo exec-maven-plugin 1.2.1 [...] <dependencies> com.example.MyLibrary MyLibrary 1.0.0 jar
has comment: http://stackoverflow.com/comment/31014654
downvote count: 0

jframe
tags question: http://stackoverflow.com/q/20694226
tags question: http://stackoverflow.com/q/20687056
tags question: http://stackoverflow.com/q/20750049
tags question: http://stackoverflow.com/q/20828494
tags question: http://stackoverflow.com/q/20777500
tags question: http://stackoverflow.com/q/20719005
tags question: http://stackoverflow.com/q/20695570
tag name: jframe
tags question: http://stackoverflow.com/q/20829733
tags question: http://stackoverflow.com/q/20686316
tags question: http://stackoverflow.com/q/20741712
tags question: http://stackoverflow.com/q/20688329
tags question: http://stackoverflow.com/q/20843730
tags question: http://stackoverflow.com/q/20723127
tags question: http://stackoverflow.com/q/20732858
tags question: http://stackoverflow.com/q/20839667
tags question: http://stackoverflow.com/q/20708749
tags question: http://stackoverflow.com/q/20680060
tags question: http://stackoverflow.com/q/20722194
tags question: http://stackoverflow.com/q/20785044
tags question: http://stackoverflow.com/q/20813518
tags question: http://stackoverflow.com/q/20809451
tags question: http://stackoverflow.com/q/20682607
tags question: http://stackoverflow.com/q/20725180
tags question: http://stackoverflow.com/q/20846437
tags question: http://stackoverflow.com/q/20784478
tags question: http://stackoverflow.com/q/20751555
tags question: http://stackoverflow.com/q/20827880
tags question: http://stackoverflow.com/q/20731679
tags question: http://stackoverflow.com/q/20808652
tags question: http://stackoverflow.com/q/20833737
tags question: http://stackoverflow.com/q/20807047
tags question: http://stackoverflow.com/q/20799814
tags question: http://stackoverflow.com/q/20705316
tags question: http://stackoverflow.com/q/20831134
tags question: http://stackoverflow.com/q/20708389
tags question: http://stackoverflow.com/q/20790103
tags question: http://stackoverflow.com/q/20717928
tags question: http://stackoverflow.com/q/20818422
tags question: http://stackoverflow.com/q/20803432
tags question: http://stackoverflow.com/q/20733755
tags question: http://stackoverflow.com/q/20719255
tags question: http://stackoverflow.com/q/20806569
tags question: http://stackoverflow.com/q/20739192
tags question: http://stackoverflow.com/q/20738334
tags question: http://stackoverflow.com/q/20755063
tags question: http://stackoverflow.com/q/20814969
tags question: http://stackoverflow.com/q/20848839
tags question: http://stackoverflow.com/q/20694785
tags question: http://stackoverflow.com/q/20792515
tags question: http://stackoverflow.com/q/20816349
type: Tag
tags question: http://stackoverflow.com/q/20846385
tags question: http://stackoverflow.com/q/20827529
tags question: http://stackoverflow.com/q/20748677
tags question: http://stackoverflow.com/q/20775817
tags question: http://stackoverflow.com/q/20822738
tags question: http://stackoverflow.com/q/20747284
tags question: http://stackoverflow.com/q/20712672

http://stackoverflow.com/a/20771425
downvote count: 0
score: 1
has body: Iterator iterator=fields.keySet().iterator(); while(iterator.hasNext()) { iterator.next(); // logic here } Also you can iterate on value and key both like following way for (Map.Entry&lt;String, String[]&gt; entry : map.entrySet()) { System.out.println("Key : " + entry.getKey() + " Value : " + entry.getValue()); }
has comment: http://stackoverflow.com/comment/31132739
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/20771407

http://stackoverflow.com/a/20716894
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/20716547
answers question: http://stackoverflow.com/q/20716547
upvote count: 1
has body: This part of your Spring configuration is configuring the sessionFactory bean: com.contactmanager.model.Contact ${hibernate.dialect} ${hibernate.show_sql} ${hibernate.hbm2ddl.auto} You can read more about setting up the Hibernate session factory with Spring here This part of your DAO code is responsible for asking Spring to inject the session factory: @Autowired private SessionFactory sessionFactory; You can read more about autowiring in Spring here
type: AcceptedAnswer

http://stackoverflow.com/comment/31266867
type: Comment
type: QuestionComment
score: 2
has text: Please format your code. That's really unreadable.
comment on: http://stackoverflow.com/q/20845239

http://stackoverflow.com/comment/31064307
score: 0
comment on: http://stackoverflow.com/a/20733127
type: Comment
has text: Thanks Meno, i can try these codes in Netbeans. I am confused sometimes because Netbeans has Designer Gui as you know. I must entegration these codes to right place first.
type: AnswerComment

http://stackoverflow.com/a/20803995
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20786034
accepted answer of: http://stackoverflow.com/q/20786034
type: Answer
has comment: http://stackoverflow.com/comment/31191243
has body: Missing one default namespace in your code. Please try it! // SOAP Body SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("TCKimlikNoDogrula", "", "http://tckimlik.nvi.gov.tr/WS"); (...) I use empty string for default namespace. I tried your code with this modification and I get this response: Response SOAP Message = &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body&gt;&lt;TCKimlikNoDogrulaResponse xmlns="http://tckimlik.nvi.gov.tr/WS"&gt;&lt;TCKimlikNoDogrulaResult&gt;false&lt;/TCKimlikNoDogrulaResult&gt;&lt;/TCKimlikNoDogrulaResponse&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
score: 0

http://stackoverflow.com/comment/31067524
has text: Two points: the OP doesn't seem to be using LocalBroadcastManager, so should just use `Activity.unregisterReceiver(..)`; secondly (to the OP) it is good practise to register/unregister receivers in the matching pairs of methods in the Activity lifecycle (onCreate/onDestroy; onStart/onStop; or onResume/onPause).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20734613
type: AnswerComment

http://stackoverflow.com/a/20701693
has body: The System.out.println(t.i); statement should be within a block or method. For example, you can either place it within a block (static or non-static, nevermind). public class test1 { test t = new test(); static { //static can be omitted System.out.println(t.i); } } Or place is within a method public class test1 { test t = new test(); public static void printSomething() { //static can be omitted System.out.println(t.i); } } More info (thanks to @vidudaya): Why does System.out.println() have to be inside a method ?
has comment: http://stackoverflow.com/comment/31006198
type: Answer
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/31006173
answers question: http://stackoverflow.com/q/20701652
has comment: http://stackoverflow.com/comment/31006234
has comment: http://stackoverflow.com/comment/31006361
downvote count: 0

http://stackoverflow.com/comment/31115879
score: 0
type: AnswerComment
has text: Then you have to render HTML manually by grouping options in the action or on the client using JavaScript.
type: Comment
comment on: http://stackoverflow.com/a/20762102

http://stackoverflow.com/q/20773741
has answer: http://stackoverflow.com/a/20774228
tagged with: algorithm
possible better answer: http://stackoverflow.com/a/20773901
score: 0
has answer: http://stackoverflow.com/a/20773901
answer count: 3
accepted answer: http://stackoverflow.com/a/20774139
has answer: http://stackoverflow.com/a/20774139
has body: Suppose I have a set of objects, and the function I want to implement receives a list of update values to update my objects with. The update values can be used to update at most one object, but can be a result on their own. So, for example, my objects are: [a, b, c]. my update function is called with parameter [d, e]. What I would like to have is all combinations of updates of my objects (a, b, c) with the parameter values, where order does not matter (as in, only one of [abce] and [eabc] need and should occur). Some possible results: [a; b; c] [a e; b d; c] [a d; b; c e] [a; b; c e; d] [a; b; c; d; e] ... The simplest example is for both lists to be of size 1 (say, [a] and [d]): [a d] [a] [d] Neither the number of objects nor the number of update values is known in advance. How would I go about implementing this? Thanks! The background, for anyone curious, is tracking of multiple targets using multiple-hypothesis tracking. My objects are tracks, and update values are sensor events. Each sensor event either updates a single existing track, spawns a new track or is regarded noise. EDIT: Based on Jurgen's answer below, I implemented it like this: static LinkedList&lt;String&gt; update(List&lt;String&gt; trackLst, List&lt;String&gt; eventLst) { LinkedList&lt;String&gt; newTracks = new LinkedList&lt;String&gt;(); for ( int e = 0; e &lt; eventLst.size(); e++ ) { String evt = eventLst.get( e ); for ( int i = 0; i &lt; trackLst.size(); i++ ) { String trk = trackLst.get( i ); if ( trk == null ) trk = new String(""); trk = trk.concat( evt ); newTracks.add(trk); } // No update newTracks.add( eventLst.get(e) ); } return newTracks; } To expand a little on the performance question: In reality, one would test each association for usefulness in the form of a performance or coherence measure before including it in the final list of hypotheses. It is still a large number, but exhausting tests are necessary when objects often overlap and the sensor resolution is low, so that we can d…
type: AnsweredQuestion
tagged with: java
has title: Combining unknown number of objects with unknown number of input values
type: Question

apache
tag name: apache
tags question: http://stackoverflow.com/q/20829110
tags question: http://stackoverflow.com/q/20786568
tags question: http://stackoverflow.com/q/20713321
tags question: http://stackoverflow.com/q/20797699
tags question: http://stackoverflow.com/q/20693862
tags question: http://stackoverflow.com/q/20700964
tags question: http://stackoverflow.com/q/20801219
tags question: http://stackoverflow.com/q/20714194
tags question: http://stackoverflow.com/q/20831606
tags question: http://stackoverflow.com/q/20844631
tags question: http://stackoverflow.com/q/20779226
tags question: http://stackoverflow.com/q/20745439
tags question: http://stackoverflow.com/q/20735093
tags question: http://stackoverflow.com/q/20723351
tags question: http://stackoverflow.com/q/20822101
tags question: http://stackoverflow.com/q/20799735
tags question: http://stackoverflow.com/q/20827118
tags question: http://stackoverflow.com/q/20704395
tags question: http://stackoverflow.com/q/20832250
tags question: http://stackoverflow.com/q/20739520
type: Tag
tags question: http://stackoverflow.com/q/20704917
tags question: http://stackoverflow.com/q/20843911
tags question: http://stackoverflow.com/q/20685566
tags question: http://stackoverflow.com/q/20770119
tags question: http://stackoverflow.com/q/20693335

vbo
tags question: http://stackoverflow.com/q/20812031
type: Tag
tags question: http://stackoverflow.com/q/20824559
tag name: vbo

http://stackoverflow.com/a/20841997
has body: If you look through the stack trace you'll probably find a NetworkOnMainThreadException. You cannot run network operations on the same thread as the UI since Android 3.x and above. in summary, you'll need to use an ASyncTask Source: Android IllegalStateException: Could not execute method of the activity (I tested the code myself and followed the stack trace to discover this answer)
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31261045
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31275535
accepted answer of: http://stackoverflow.com/q/20841581
answers question: http://stackoverflow.com/q/20841581

http://stackoverflow.com/q/20762622
has body: I am catching a MalformedURLException and I would like the stack trace to include the malformed url. The methods getMessage() and getLocalisedMessage() don't show the entire URL, I cannot reference the url declared in the try block and if I initialise the variable outside the block I get an error pointing out that the URL might not ever get initialised. I am wondering if there is a way to pass the url from the try block to the handler.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20762756
score: 1
tagged with: java
tagged with: malformedurlexception
upvote count: 1
has comment: http://stackoverflow.com/comment/31116538
has title: Java Exceptions, pass data from try block to the handler
type: Question
has comment: http://stackoverflow.com/comment/31116752
accepted answer: http://stackoverflow.com/a/20762756
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/20762712
favorite count: 0
tagged with: exception
tagged with: android
possible better answer: http://stackoverflow.com/a/20762712

http://stackoverflow.com/q/20745580
score: -2
has body: I try to draw an image over a JDialog that contains a background. What I do is call the class which will draw this image. Here, the "paintComponent" is never called: // class Card public Card(BufferedImage faceUp, int value) { this.faceUp = faceUp; this.hide = false; this.value = value; setOpaque(false); setLayout(new FlowLayout()); this.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println(Card.this.getX()); System.out.println("click"); } }); repaint(); } @Override public void paintComponent(Graphics g) { System.out.println("here"); g.drawImage((this.hide) ? Cards.back : this.faceUp, Cards.CARD_WIDTH, Cards.CARD_HEIGHT, this); } And I call it in my main constructor: public Constructor() { initComponent(); Card c1 = new Card(Cards.cardsContainer.get(1), 1%14); //Image, value jPanel1.add(c1); c1.setVisible(true); c1.setPreferredSize(new Dimension(200, 100)); c1.revalidate(); c1.repaint(); repaint(); } @Override public void paint(Graphics g) { try { Graphics2D g2 = (Graphics2D) g; BufferedImage background_image; background_image = ImageIO.read(new File(this.background)); Graphics2D big = background_image.createGraphics(); Rectangle rectangle = new Rectangle(0, 0, 20, 20); g2.setPaint(new TexturePaint(background_image, rectangle)); Rectangle rect = new Rectangle(0, 0, this.getWidth(), this.getHeight()); g2.fill(rect); } catch (IOException ex) { Logger.getLogger(Bataille.class.getName()).log(Level.SEVERE, null, ex); } } Any idea why?
tagged with: java
has comment: http://stackoverflow.com/comment/31136763
has answer: http://stackoverflow.com/a/20785707
tagged with: image
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31086119
has comment: http://stackoverflow.com/comment/31086090
favorite count: 0
type: UnansweredQuestion
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/31089645
has comment: http://stackoverflow.com/comment/31116991
has answer: http://stackoverflow.com/a/20773903
downvote count: 2
has title: Image won't display but is click-able
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31105072

http://stackoverflow.com/a/20773330
upvote count: 2
downvote count: 0
type: Answer
score: 2
has body: Add the desired internal frame icons, seen here, to a container in an undecorated frame, illustrated here.
answers question: http://stackoverflow.com/q/20771260

http://stackoverflow.com/a/29578014
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20764957
has body: I managed to solve my problem. This is the final code: ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(bos); Files.copy(f.toPath(), gos); gos.finish(); out.println("Content-Type: "+Files.probeContentType(f.toPath())+"; charset=UTF-8\nContent-Encoding: gzip\nContent-Length:"+bos.toByteArray().length+"\n"); bos.writeTo(so.getOutputStream()); Thanks JB Nizet and Brant Unger

http://stackoverflow.com/q/20831078
linked to: http://stackoverflow.com/q/14225518
has comment: http://stackoverflow.com/comment/31241255
tagged with: drag-and-drop
tagged with: graphics2d
answer count: 0
type: UnansweredQuestion
score: 0
has body: How can I set a quite large drag icon made by transparent dragging component image. So the user sees what has selected for dragging while dragging. It'd better that the image has a graded transparent level so the bottom right of the component image will be 99% transparent and the top left of the componenet image will have 50% transparency. What I need is generating the image and converting it to an ImageIcon. The component can be any thing. Even a complex one. For example a JPanel with some other components inside.
has comment: http://stackoverflow.com/comment/31241330
tagged with: swing
has comment: http://stackoverflow.com/comment/31241286
linked to: http://stackoverflow.com/q/20556594
linked to: http://stackoverflow.com/q/17690275
tagged with: java
tagged with: image
type: Question
has title: Transparent dragging component image as the drag icon in Swing

http://stackoverflow.com/q/20733755
tagged with: java
has body: The folloing code is supposed to reset the frame gameFrame: private void reset() { moveCount = 0; gameFrame.setVisible(false); gameFrame.getContentPane().removeAll(); gameFrame.getContentPane().revalidate(); gameFrame.getContentPane().repaint(); board.newBoard(); createGameUI(board.getWidth(),board.getHeight()); gameFrame.setVisible(true); } However it only works by first setting visibility of gameFrame to false, removing all components, adding a fresh set of components, and then setting the gameFrame to visible. What is the proper way to do this? Thanks, Oli EDIT: I've tried doing: private void reset() { moveCount = 0; //gameFrame.setVisible(false); gameFrame.getContentPane().removeAll(); createGameUI(board.getWidth(),board.getHeight()); gameFrame.getContentPane().revalidate(); gameFrame.getContentPane().repaint(); //gameFrame.setVisible(true); } However this now just freezes the program when I press the reset button.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31067771
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: jframe
has title: JFrame getContentPane.removeAll() only working between a .setVisible(false) and .setVisible(true)
upvote count: 1
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/20733796

http://stackoverflow.com/a/20702651
upvote count: 3
has comment: http://stackoverflow.com/comment/31008038
has body: JAVA_HOME = C:\Program Files (x86)\Java\jdk1.5.0_16 JRE_HOME = C:\Program Files (x86)\Java\jre1.5.0_16 Your JAVA_HOME and JRE_HOME are set to the Java 1.5 installation hence 1.8 binaries (like javac) are not found. Set them to the Java 1.8 installation and you should be fine.
score: 3
has comment: http://stackoverflow.com/comment/31007971
downvote count: 0
has comment: http://stackoverflow.com/comment/31037950
answers question: http://stackoverflow.com/q/20702626
type: Answer

http://stackoverflow.com/comment/31255472
comment on: http://stackoverflow.com/q/20839020
has text: There is no need to add the major tag in the title.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31043041
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/20721787
type: Comment
has text: It'd be great if you gave us the error.

http://stackoverflow.com/comment/30982282
score: 1
has text: You could parse them as characters/strings. It's fairly easy and there are some threads on it here on SO
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20688281

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/20782722
tag name: restful-architecture

http://stackoverflow.com/q/20770344
has comment: http://stackoverflow.com/comment/31131221
has body: i've been testing and searching page after page but i cant seem to figure this out. when i use an "if" statement like the code below and check each individual poly it works but i would like to run just 1 "for" statement and be able to check. The problem is when i run a "for" statement, only the last index of poly becomes collidable... any help would be greatly appreciated. Also this is run in a thread at 30 fps. Working code: if(poly[0].intersects(gamePanel.player.leftBounds)|| poly[1].intersects(gamePanel.player.leftBounds)|| poly[2].intersects(gamePanel.player.leftBounds)) {gamePanel.player.leftCollide = true;} else{gamePanel.player.leftCollide = false;} if(poly[0].intersects(gamePanel.player.topBounds)|| poly[1].intersects(gamePanel.player.topBounds)|| poly[2].intersects(gamePanel.player.topBounds)) {gamePanel.player.topCollide = true;} else{gamePanel.player.topCollide = false;} if(poly[0].intersects(gamePanel.player.rightBounds)|| poly[1].intersects(gamePanel.player.rightBounds)|| poly[2].intersects(gamePanel.player.rightBounds)) {gamePanel.player.rightCollide = true;} else{gamePanel.player.rightCollide = false;} if(poly[0].intersects(gamePanel.player.bottomBounds)|| poly[1].intersects(gamePanel.player.bottomBounds)|| poly[2].intersects(gamePanel.player.bottomBounds)) {gamePanel.player.bottomCollide = true;} else{gamePanel.player.bottomCollide = false;} Not working code: for(int i = 0;i&gt;poly.length;i++){ if(poly[i].intersects(gamePanel.player.leftBounds)) {gamePanel.player.leftCollide = true;} else{gamePanel.player.leftCollide = false;} if(poly[i].intersects(gamePanel.player.topBounds)) {gamePanel.player.topCollide = true;} else{gamePanel.player.topCollide = false;} if(poly[i].intersects(gamePanel.player.rightBounds)) {gamePanel.player.rightCollide = true;} else{gamePanel.player.rightCollide = false;} if(poly[i].intersects(gamePanel.player.bottomBounds)) {gamePanel.player.bottomCollide = true;} else{gamePanel.player.bottomCollide = false;} }
has answer: http://stackoverflow.com/a/20770637
accepted answer: http://stackoverflow.com/a/20770637
has answer: http://stackoverflow.com/a/20770770
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31130963
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31130992
has comment: http://stackoverflow.com/comment/31131010
possible better answer: http://stackoverflow.com/a/20770454
type: Question
tagged with: for-loop
upvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/31130917
has answer: http://stackoverflow.com/a/20770454
favorite count: 0
has title: Java - For statement resetting Booleans when running through array
has comment: http://stackoverflow.com/comment/31131016
has answer: http://stackoverflow.com/a/20770542
answer count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31131098

http://stackoverflow.com/q/20684962
possible better answer: http://stackoverflow.com/a/20685092
tagged with: sql
tagged with: sqlite
has answer: http://stackoverflow.com/a/20685092
has title: Data Not Inserting into SQLite DB
has body: I have an issue where data is not being inserted into the DB because the error log says no such column called columntotal exists, which is true, but columntotal is a variable that I am trying to pass into a table called "purchases" in a column called "total". Do I have the insertion statement constructed wrong? public double calculateTotal() { double columntotal = 0; Cursor cursor1 = db.rawQuery( "SELECT SUM(price) FROM purchases", null); if(cursor1.moveToFirst()) { columntotal = cursor1.getDouble(0); } cursor1.close(); return columntotal; } public void insertTotal() { db.rawQuery("INSERT INTO purchases(total) VALUES(columntotal)", null); }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20685117
tagged with: java
has comment: http://stackoverflow.com/comment/30976329
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/20685117
answer count: 2

http://stackoverflow.com/q/20759886
has comment: http://stackoverflow.com/comment/31111941
has body: Is there any way to find all references to all the methods present in a single class and do that in a single go. Suppose I have 3 methods in class A void m1(),void m2(),void m3(), I can't do it via highlighting a method and then pressing ctrl+shift+G, on a single method. But is there a way to check references for all 3 methods at once?
has answer: http://stackoverflow.com/a/20760247
has comment: http://stackoverflow.com/comment/31112009
has comment: http://stackoverflow.com/comment/31112060
tagged with: java
has comment: http://stackoverflow.com/comment/31112056
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31112153
type: Question
score: 0
answer count: 1
has title: Locate method references in java simultaneously
type: UnansweredQuestion

http://stackoverflow.com/a/20725910
has comment: http://stackoverflow.com/comment/31051204
type: Answer
accepted answer of: http://stackoverflow.com/q/20725901
answers question: http://stackoverflow.com/q/20725901
upvote count: 24
has comment: http://stackoverflow.com/comment/67504049
has body: You seem to be missing the aspectjweaver library. You can get it here.
score: 24
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31239246
type: Comment
type: AnswerComment
has text: @Sotirios Delimanolis: the HandlerMethodReturnValueHandler should work the same way for spring 3.1 (but there was a change from 3.0 to 3.1)
score: 0
comment on: http://stackoverflow.com/a/20829342

http://stackoverflow.com/q/20735743
tagged with: class
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31069296
favorite count: 0
has comment: http://stackoverflow.com/comment/31069195
has comment: http://stackoverflow.com/comment/31069238
accepted answer: http://stackoverflow.com/a/20735850
type: Question
upvote count: 1
has body: public class MainClass { public void main(String[] args) { Grid.simulator(args); //static method that I can actually call Engine.main;//what I want to call } } The problem is: Engine.main cannot be static. This is why: class Engine { String command; public void main() { this.CommandLine(command); //Calls the Method which has the user input this.ProcessCommand(command); //Calls the Method that will process the input } } I understand that I can't call a non-static method, but I was thinking of a work-around: Would it work if I assign a something to CommandLine and ProcessCommand, as if it was a non-initialized variable in a static context. Like so: class SomeClass { public static void main(String[] args) { int number = null; number = System.Nextint; System.out.print(number); } } //In this code, either don't put it as static OR initialize 'number', even if as null. Would something similar work for this.Something ? If Yes, how so?
has comment: http://stackoverflow.com/comment/31069358
has title: Working-Around Class.Method call, for non-static Classes/Methods
tagged with: java
tagged with: methods
answer count: 1
has comment: http://stackoverflow.com/comment/31069345
has answer: http://stackoverflow.com/a/20735850
score: -3

static
tags question: http://stackoverflow.com/q/20751867
tags question: http://stackoverflow.com/q/20846891
tags question: http://stackoverflow.com/q/20770557
tags question: http://stackoverflow.com/q/20742257
tags question: http://stackoverflow.com/q/20685358
tags question: http://stackoverflow.com/q/20782301
tags question: http://stackoverflow.com/q/20729825
tags question: http://stackoverflow.com/q/20738703
tags question: http://stackoverflow.com/q/20749062
tags question: http://stackoverflow.com/q/20710140
tags question: http://stackoverflow.com/q/20778881
tags question: http://stackoverflow.com/q/20812331
tag name: static
tags question: http://stackoverflow.com/q/20714964
tags question: http://stackoverflow.com/q/20739611
tags question: http://stackoverflow.com/q/20827724
tags question: http://stackoverflow.com/q/20701070
tags question: http://stackoverflow.com/q/20832604
type: Tag
tags question: http://stackoverflow.com/q/20711084

jsf-2.2
tags question: http://stackoverflow.com/q/20784167
tags question: http://stackoverflow.com/q/20834889
tags question: http://stackoverflow.com/q/20826701
type: Tag
tag name: jsf-2.2

http://stackoverflow.com/q/20832250
possible better answer: http://stackoverflow.com/a/20832287
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20832287
has answer: http://stackoverflow.com/a/20832281
tagged with: apache
score: -1
tagged with: servlets
has title: org.apache.catalina.core.DefaultInstanceManager cannot be cast to java.lang.String
answer count: 2
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/20832281
type: AnsweredQuestion
tagged with: java
has body: I have following code in my servlet PrintWriter out = response.getWriter(); out.println("Getting Context scoped attributes&lt;br&gt;"); ServletContext sc = getServletConfig().getServletContext(); Enumeration contextAttribNames = sc.getAttributeNames(); while(contextAttribNames.hasMoreElements()){ String attribName = (String) contextAttribNames.nextElement(); String attribValue = (String) sc.getAttribute(attribName);//Line#21 out.println("&lt;b&gt;" + attribName + ":&lt;/b&gt; " + attribValue + "&lt;br&gt;"); } It just tries to get all the attributes associated with application/context scope and print their values. The code compiles fine, but fails when I invoke this servlet from an url pattern Following is the error I get "HTTP Status 500 - org.apache.catalina.core.DefaultInstanceManager cannot be cast to java.lang.String" java.lang.ClassCastException: org.apache.catalina.core.DefaultInstanceManager cannot be cast to java.lang.String com.servlet.scopes.GetContextScopeServlet.doGet(GetContextScopeServlet.java:21) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) As per the documentation, javax.servlet.ServletContext has a method to get attribute with following signature public Object getAttribute(String attribName) and this is the reason why I'm casting to String at Line#21 Please help me in understanding the problem and resolving the issue... Env Details : OS - Windows7 Server - Apache Tomcat 7.x JavaEE-6 specification
tagged with: tomcat7
downvote count: 1

http://stackoverflow.com/comment/31257637
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20838947
has text: jdbc:mysql://192.168.1.90:3307/esupport com.mysql.jdbc.Driver true <mapping class="com.Allied.dto.ActionView" /> <mapping class="com.Allied.dto.LeaveDto" /> <mapping class="com.Allied.dto.LeaveTypeDto" /> <mapping class="com.Allied.dto.RoleActionMap" /> <mapping class="com.Allied.dto.RoleView" /> <mapping class="com.Allied.dto.TimesheetTask" />

http://stackoverflow.com/q/20765148
has answer: http://stackoverflow.com/a/20765192
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20765366
has body: As a developer everybody in their careed must have faced the requirement where you need resizable collection where you can do add, remove, retrievale(FIFO). In every application i see using List(ArrayList) to satisy this requirement but my question why not developer go for Queue(probably ArrayDeque) . As per my current understanding i find both ArrayList(List) and ArrayDeque(Queue) equally good for the requirement i stated. But still i never spotted queue in my career , always find only List. So my question is why not Queue is preferred over List. I am sure there must be some reason but somehow i am missing that understanding? Update:- here is my clear requirements 1)Addition happens at end and should be fast.Probably O(1) 2)Iteration should be fast 3)lookup and removal of any specific element should be faster. Going by above requirement i think Arralist makes sense over ArrayDeque . Here are my pointwise reason 1)Both Arraylist and ArrayDeque will be O(1) . Right? 2)Iteration performance will be same for both as it will be based on index . For ArrayDeque index will be based on timestamp whereas for arraylist user can explicitly mention index. Right? 3)It will be O(1) for both as lookup will happen based om index
tagged with: queue
type: Question
tagged with: arraydeque
possible better answer: http://stackoverflow.com/a/20765341
has title: Why List is preferred over Queues?
has answer: http://stackoverflow.com/a/20765341
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/20765192
answer count: 3
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/6147618
has comment: http://stackoverflow.com/comment/31121446
type: AnsweredQuestion
score: 3
tagged with: list

http://stackoverflow.com/a/20801554
has body: I don't think these 2 lines are correct: arrayTwo[i] = arrayOne[i]; arrayTwo[j] = arrayOne[j]; Because arrayTwo[i] = arrayOne[i] will cause the if statement to always be true: if(arrayTwo[i][j].equals(findOut[x])) Shouldn't it be arrayTwo[i][j] = arrayOne[i][j];
answers question: http://stackoverflow.com/q/20801360
has comment: http://stackoverflow.com/comment/31185907
score: 0
type: Answer

http://stackoverflow.com/a/20684483
type: Answer
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/30975130
has comment: http://stackoverflow.com/comment/30975281
has comment: http://stackoverflow.com/comment/30975208
score: -1
answers question: http://stackoverflow.com/q/20684383
has body: That's because h is a local variable and is allocated on the stack, whereas the array is stored in the main memory, which is way slower to write to. Also note that, if this is really a high-performance application, you should put your main logic inside the for loop and avoid the overhead of calling a method. The instructions could be inlined for you, but you should not rely on it.
has comment: http://stackoverflow.com/comment/30975127

http://stackoverflow.com/comment/30988572
type: Comment
has text: For your JAR to run on his box he needs `JRE` (Java Runtime Environment) ver. 1.7. He does not need `JDK` (Java Development Kit) just to run the byte-code.
type: QuestionComment
comment on: http://stackoverflow.com/q/20691419
score: 0

http://stackoverflow.com/a/20747095
has body: 1) Is your WSO2 Server running against loclahost only or is it just running on his IP adres? Looks like you are not able to contact the server through this IP and/or port number. 2) Are there any proxies defined? If so, try to disable them.
has comment: http://stackoverflow.com/comment/31249294
has comment: http://stackoverflow.com/comment/31148356
score: 0
has comment: http://stackoverflow.com/comment/31168357
type: Answer
answers question: http://stackoverflow.com/q/20736350

http://stackoverflow.com/comment/31266208
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20844776
type: AnswerComment
has text: As per ScheduleAtFixedRate javadocs, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will occur in rapid succession to "catch up. what does that mean? To me it gives impression, if second task is due even first task is not completed, then timer will create new thread for due task. Is n't it?

http://stackoverflow.com/comment/31232269
comment on: http://stackoverflow.com/a/20820682
score: 0
type: AnswerComment
type: Comment
has text: Isn't this what synchronized achieves? I am new to this so I'm likely wrong. But surely synchronized means getting a lock on the Q object before continuing? If the reader sleeps, it may miss something being added to the head of the Q.

http://stackoverflow.com/comment/31194632
type: AnswerComment
score: 0
type: Comment
has text: It should be `EArrayList<T> extends ArrayList<T>`; that way, your parent class gets the generic type, and not just your base class.
comment on: http://stackoverflow.com/a/20792327

http://stackoverflow.com/q/20724938
upvote count: 2
type: UnansweredQuestion
score: 1
has title: JSch - Server "home" path is always "/" with FreeSSHd and can't change directory
downvote count: 1
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/33339311
has body: I set-up a server with FreeSSHd and am able to Putty it, including changing directories and listing files. I have some example .txt files and a folder in the home directory. I set the home directory on my server to "C:\SFTP" using FreeSSHd (as opposed to defining a HOME variable with the directory being "$HOME\"). Apparently, when using JSch, JSch jsch = new JSch(); session = jsch.getSession(username,host,port); jsch.addIdentity(key.getAbsolutePath()); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.setUserInfo(new MyUserInfo()); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp)channel; System.out.println("Home: "+channelSftp.getHome()); the last line prints just "Home: /". Any attempts (made immediately after above code) to use channelSftp.cd(WORKINGDIR); results in 2: No such file at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2833) at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2185) at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1295) at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1267) at test.SFTPTest.main(SFTPTest.java:71) I think if I got to the root of why JSch does not have the correct home path (or any?) this would work. Also, strangely enough I upload and download files no problem using put() and get(). I've heard all kinds of things where people look into the source and find it does strange things in resolving paths and something with a method called "_realPath()" and superfluous leading/trailing "/" but I don't even have it telling me the home directory is correct after connecting. Any ideas?
tagged with: jsch
has comment: http://stackoverflow.com/comment/31049805
favorite count: 0
tagged with: sftp
has answer: http://stackoverflow.com/a/48939291
has comment: http://stackoverflow.com/comment/31049520

http://stackoverflow.com/comment/31158343
score: 0
type: AnswerComment
has text: Just because there's no bytecode for load byte doesn't mean there can't be byte fields. The compiler knows the actual type of the field after all. Since object sizes are always aligned on 8 byte boundaries though it probably really doesn't make a difference here.
type: Comment
comment on: http://stackoverflow.com/a/20782361

http://stackoverflow.com/comment/31208907
comment on: http://stackoverflow.com/a/20809761
score: 0
type: AnswerComment
has text: @kvseelbach: no that would clearly be 0x0badc0de;
type: Comment

http://stackoverflow.com/a/20708714
has comment: http://stackoverflow.com/comment/31019130
answers question: http://stackoverflow.com/q/20708484
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31019606
upvote count: 2
has comment: http://stackoverflow.com/comment/31019396
has body: You have installed Jetty from some linux packaging product. Each linux distro puts jetty in different places. Sometimes in a single directory like /opt/jetty sometimes across multiple directories. Since you seem to be using a debian based / apt / dpkg based distribution, this should help you figure it out. $ dpkg -L jetty That will just list the contents of that specific package you just installed. From there you'll want to work your distribution specific documentation for jetty, as none of the standard documentation for jetty will apply to you.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20708484

http://stackoverflow.com/comment/31003759
comment on: http://stackoverflow.com/a/20700284
has text: When you say 'DI', do you mean Dependency Injection or Dependency Inversion? :)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/20846958
has comment: http://stackoverflow.com/comment/31271052
answer count: 2
possible better answer: http://stackoverflow.com/a/20847301
has comment: http://stackoverflow.com/comment/31270548
score: 0
accepted answer: http://stackoverflow.com/a/20847304
tagged with: jlist
has title: How to add an action Listener in DefaultListModel and not in JList
has body: I have the following code and i add elements to a JList. DefaultListModel listModel = new DefaultListModel(); listModel.addElement("element1"); listModel.addElement("element2"); listModel.addElement("element3"); list = new JList(listModel); list.addListSelectionListener(this); In another method of my code I remove all the elements of listModel(DefaultListModel) and I add the elements of a SortedSet: (listModel is a public static variable) listModel.removeAllElements(); SortedSet&lt;String&gt; keys = new TreeSet&lt;String&gt;(myHashMap.keySet()); Iterator&lt;String&gt; it = keys.iterator(); while (it.hasNext()) { String key = it.next(); listModel.addElement(key); //How can i add an addActionListener to every 'key element' //since the JList list variable is not global ?? } Since 'list' is not a public static variable, how can I add an Action Listener to each one of the list Items in the listModel? I tried to use an addListDataListener, but I don't think that is use for the purpose that I need.
tagged with: swing
has comment: http://stackoverflow.com/comment/31271101
type: Question
tagged with: actionlistener
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20847301
has answer: http://stackoverflow.com/a/20847304
tagged with: java

http://stackoverflow.com/q/20846099
type: UnansweredQuestion
tagged with: netbeans
tagged with: java
linked to: http://stackoverflow.com/q/13008241
tagged with: swing
type: Question
has body: I designed a JTable with Netbeans Builder and I created 5 columns, the 5th one is Boolean so I want to know how to highlight whole the row when the user selected.
has title: Edit JTable in Netbeans Builder
tagged with: jtable
score: 0
tagged with: matisse
answer count: 1
has answer: http://stackoverflow.com/a/20846317

http://stackoverflow.com/comment/43921747
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20766735
has text: Isn't rowIndex and rowEnd same numbers? Both are obtained with GridPane.getRowIndex(child).
type: AnswerComment

http://stackoverflow.com/a/49146860
downvote count: 0
score: 1
has body: Try also Transport.send(message, user, pass); I have found this in Transport class documentation Use the specified user name and password to authenticate to the mail server. public static void send(Message msg, String user, String password) throws MessagingException { msg.saveChanges(); send0(msg, msg.getAllRecipients(), user, password); } I am Using JavaMail v 1.6.1 and MailTrap SMTP Server
upvote count: 1
answers question: http://stackoverflow.com/q/20780495
type: Answer

http://stackoverflow.com/a/20729079
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/20729048
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20729048
has body: This is the ellipsis operator. It means you can pass an arbitrary number of arguments to your method/constructor when calling it. E.g.: new AcademGroup(student1); new AcademGroup(student1, student2); new AcademGroup(student1, student2, student3); etc. In the method/constructor's code it's treated as an array.

http://stackoverflow.com/q/20770045
tagged with: java
has body: I'm having an image in Database in bytearray format. I want to display on browser. I don't know how to write Image using OutputStream. Here is my code. byte[] imageInBytes = (byte[]) obj; // from Database InputStream in = new ByteArrayInputStream(imageInBytes); Image img = ImageIO.read(in).getScaledInstance(50, -1, Image.SCALE_SMOOTH); OutputStream o = resp.getOutputStream(); // HttpServletResponse o.write(imgByte);
type: Question
has title: Java: How To Convert Image to Byte[]
tagged with: awt
tagged with: image
has answer: http://stackoverflow.com/a/20770083
has comment: http://stackoverflow.com/comment/31130570
has comment: http://stackoverflow.com/comment/31130805
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31130434
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/20770091
score: 2
linked to: http://stackoverflow.com/q/11959758
has answer: http://stackoverflow.com/a/20770103

http://stackoverflow.com/comment/31006958
has text: Are you moving camera or board? Or have you tried both with same result? I sense the answer lies there.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20693020
score: 0

http://stackoverflow.com/q/20718913
score: 1
tagged with: java
has body: I'm stuck in this problem from 3 days and i don't find any solution. I'm developing a DM application with NetBeans 7.3 using the Weka developer edition (3.7.10). I'm trying to use the Snowball stemmer and I keep getting the same exception while I run my application at the moment I create the stemmer with: SnowballStemmer stemmer = new SnowballStemmer(); the exception I get is: Refreshing GOE props... ---Registering Weka Editors--- Exception in thread "AWT-EventQueue-0" java.lang.IncompatibleClassChangeError: class weka.classifiers.JythonClassifier has interface weka.classifiers.Classifier as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 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) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at weka.core.ClassDiscovery.find(ClassDiscovery.java:343) at weka.gui.GenericPropertiesCreator.generateOutputProperties(GenericPropertiesCreator.java:514) at weka.gui.GenericPropertiesCreator.execute(GenericPropertiesCreator.java:606) at weka.gui.GenericPropertiesCreator.execute(GenericPropertiesCreator.java:582) at weka.core.converters.ConverterUtils.initialize(ConverterUtils.java:730) at weka.core.converters.ConverterUtils.&lt;clinit&gt;(ConverterUtils.java:711) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at weka.core.Cla…
type: Question
tagged with: snowball
has title: IncompatibleClassChangeError using Snowball Stemmer
tagged with: stemming
tagged with: weka
has answer: http://stackoverflow.com/a/22018822
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: netbeans
downvote count: 0

http://stackoverflow.com/q/20757914
has body: I know how to get the RGB values of individual pixels of a bitmap. How can I get the average RGB value for all of the pixels of a bitmap?
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/20785902
has comment: http://stackoverflow.com/comment/31147994
accepted answer: http://stackoverflow.com/a/20785902
has answer: http://stackoverflow.com/a/28914155
favorite count: 0
upvote count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/31112480
type: AnsweredQuestion
score: 3
tagged with: java
has title: How to get average RGB value of Bitmap on Android?
possible better answer: http://stackoverflow.com/a/28914155
type: Question
has answer: http://stackoverflow.com/a/20758060
has comment: http://stackoverflow.com/comment/31112668

http://stackoverflow.com/comment/31075405
type: AnswerComment
has text: Yep you should instal rjava package.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20736869

http://stackoverflow.com/comment/31114305
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20758218
score: 0
has text: are you making textures or fonts static???

http://stackoverflow.com/q/20746788
has comment: http://stackoverflow.com/comment/31088360
score: -2
has title: how to negate conditional in Java?
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/20746861
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31088346
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31088441
has body: I have this statement: (in Android) if(marker.getTitle().indexOf("vous êtes ici")!=-1) I want the contrary of it, any idea please? I have tried: if(marker.getTitle().indexOf("vous êtes ici")!=1) but it does not work
answer count: 1
accepted answer: http://stackoverflow.com/a/20746861
favorite count: 0

http://stackoverflow.com/comment/31240543
comment on: http://stackoverflow.com/a/20830399
has text: The problem with this is that it won't translate user interactions, like mouse movements and clicks...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20702370
type: Question
has comment: http://stackoverflow.com/comment/31007437
answer count: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/31008168
has title: Request get in java for get source html
has comment: http://stackoverflow.com/comment/31007551
upvote count: 0
has comment: http://stackoverflow.com/comment/31013350
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31007460
tagged with: http://stackoverflow.com/tag/html
has body: I have this request in Java but in the response i haven't all source, and Json object fail.. HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet( "http://url?"+params); HttpResponse response = client.execute(request); BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } String str = result.toString(); Document doc = Jsoup.parse(str); JSONObject json = new JSONObject(); List&lt;JSONObject&gt; list = new ArrayList&lt;JSONObject&gt;(); Element elementsTable = doc.getElementById("shortlist"); this element shortlist can't find that..but if i go with my browser and get the source there is..where i'm wrong?
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/31007369
has comment: http://stackoverflow.com/comment/31008263
has comment: http://stackoverflow.com/comment/31008003
has answer: http://stackoverflow.com/a/20702972

http://stackoverflow.com/comment/31267671
type: Comment
score: 1
has text: @CiaranAshton I would suggest parsing rather than pattern matching. A parser can read one "current character" and one "next character" and then branch based on the combination - for example if the current character is `-` the parser can branch to the subtraction operator when the next character is a space and treat it as part of a number if the next character is a digit. It's a bit more complex since, if the character preceding `-` is a digit, then we probably want to always treat `-` as an operator so that `4-3` is a subtraction expression and not `4` and `-3` pushed onto the stack.
comment on: http://stackoverflow.com/q/20845243
type: QuestionComment

http://stackoverflow.com/comment/31041809
score: 0
type: Comment
type: QuestionComment
has text: Oh, pardon. There is no real description, but here is a curl request that works (when run directly from server): curl -i -H "Content-Type: application/json" -X POST -d '{"partId": 23, "carId": 34, "name": "chassis", "section": "frame"}' http://localhost:8000/api/v1/receiver/
comment on: http://stackoverflow.com/q/20720955

http://stackoverflow.com/q/20734265
has comment: http://stackoverflow.com/comment/31066355
has comment: http://stackoverflow.com/comment/31066367
has comment: http://stackoverflow.com/comment/31066347
has comment: http://stackoverflow.com/comment/31067336
answer count: 3
has comment: http://stackoverflow.com/comment/31066974
favorite count: 0
has answer: http://stackoverflow.com/a/20734366
has title: Reduce time complexity of a program (in Java)?
has comment: http://stackoverflow.com/comment/31067153
tagged with: complexity-theory
has answer: http://stackoverflow.com/a/20734551
score: 6
upvote count: 7
has body: This question is quite a long shot. It could take quite long, so if you haven't the time I understand. Let me start by explaining what I want to achieve: Me and some friends play this math game where we get 6 random numbers out of a pool of possible numbers: 1 to 10, 25, 50, 75 and 100. 6 numbers are chosen out of these and no duplicates are allowed. Then a goal number will be chosen in the range of [100, 999]. With the 6 aforementioned numbers, we can use only basic operations (addition, subtraction, multiplication and division) to reach the goal. Only integers are allowed and not all 6 integers are required to reach the solution. An example: We start with the numbers 4,8,6,9,25,100 and need to find 328. A possible solution would be: ((4 x 100) - (9 x 8)) = 400 - 72 = 328. With this, I have only used 4 out of the 6 initial numbers and none of the numbers have been used twice. This is a valid solution. We don't always find a solution on our own, that's why I figured a program would be useful. I have written a program (in Java) which has been tested a few times throughout and it had worked. It did not always give all the possible solutions, but it worked within its own limitations. Now I've tried to expand it so all the solutions would show. On to the main problem: The program that I am trying to execute is running incredibly long. As in, I would let it run for 15 minutes and it doesn't look like it's anywhere near completion. So I thought about it and the options are indeed quite endless. I start with 6 numbers, I compare the first with the other 5, then the second with the other 5 and so on until I've done this 6 times (and each comparison I compare with every operator, so 4 times again). Out of the original one single state of 6 numbers, I now have 5 times 6 times 4 = 120 states (with 5 numbers each). All of these have to undergo the same ritual, so it's no wonder it's taking so long. The program is actually too big to list here, so I will upload it for those inte…
possible better answer: http://stackoverflow.com/a/20734366
has comment: http://stackoverflow.com/comment/31066373
has comment: http://stackoverflow.com/comment/31066992
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/20734551
has answer: http://stackoverflow.com/a/20734469

http://stackoverflow.com/a/20812378
has body: I would create a method to sort rows, and then just iterate through the rows in the matrix and sort them one at a time. For example: public static int[] sortRow(int[] row) // selection sort { for (int i = 0; i &lt; row.length - 1; i++) { for (int j = i + 1; j &lt; row.length; j++) { if (row[i] &gt; row[j]) { int temp = row[i]; row[i] = row[j]; row[j] = temp; } } } return row; } public static void main(String args[]) { int[][] arr = {{5, 1, 3}, {7,6,4}, {9,8,2}}; for (int r = 0; r &lt; arr.length; r++) { // for every row in the matrix arr[r] = sortRow(arr[r]); // set the row to be the sorted row } // print out the array to the console for (int r[] : arr) { for (int c : r) System.out.print(c + " "); System.out.println(); } } Output: 1 3 5 4 6 7 2 8 9
type: Answer
answers question: http://stackoverflow.com/q/20812093
score: 0

http://stackoverflow.com/q/20780018
type: Question
tagged with: raspberry-pi
accepted answer: http://stackoverflow.com/a/20780083
answer count: 1
downvote count: 0
tagged with: xming
favorite count: 0
has title: fail to update jdk1.7.0_45 in raspberry pi
tagged with: linux
upvote count: 1
has answer: http://stackoverflow.com/a/20780083
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm developing the TV Scoreboard app with the use of window laptop and raspberry pi. I'm using the putty to have socket connection. Before that it request to state the X11 server variable, so I have installed the Xming server in my window laptop and fixed to localhost:0.0.0.0 But JFLauncher keep pop up the message to install the newest Java Runtime. So I think the latest and suitable one should be jre 1.7.0_45. I have download the ejre-7u45-fcs-b15-linux-arm-vfp-hflt-client_headless-26_sep_2013 mkdir java cd java tar zxvf *.gz after unpack, I remove the rar file. ./bin/java -version it show the latest version but if I just java -version it show the old version detail. what should I do to update it to the latest version? Any mistake for my steps?

http://stackoverflow.com/q/20750097
has body: I have three database (SQLServer) fields: startDate (Date) endDate (Date) Duration (text). I am calculating date and time difference by using java following code. public static void main(String[] args) { DateTimeUtils obj = new DateTimeUtils(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/M/yyyy hh:mm:ss"); try { Date date1 = simpleDateFormat.parse("10/10/2013 11:30:10"); Date date2 = simpleDateFormat.parse("13/10/2013 20:55:55"); obj.printDifference(date1, date2); } catch (ParseException e) { e.printStackTrace(); } } public void printDifference(Date startDate, Date endDate){ //milliseconds long different = endDate.getTime() - startDate.getTime(); String diff = ""; System.out.println("startDate : " + startDate); System.out.println("endDate : "+ endDate); System.out.println("different : " + different); diff = String.format("%d:%d", TimeUnit.MILLISECONDS.toHours(different), TimeUnit.MILLISECONDS.toMinutes(different) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(different))); And It returns “HH:MM” and updates the Duration field as String in my database. This works great. Now there will be multiple duration, what I want to do is once I have Duration, I would like to do add up multiple duration and it should return totalDuration: For Example: In my table # 1 I have, Id | Duration 1001 | 05:04 1001 | 12:19 1001 | 02:16 Table # 2 Id | totalDuration 1001 | 19:39 My Question is: How do I convert HH:Mm to Date and add multiple records together to get totalDuration. Total duration should be text and return the same format “HH:MM
has title: Calculate Date And Time Difference In Java
has comment: http://stackoverflow.com/comment/31094786
has answer: http://stackoverflow.com/a/20753108
tagged with: date
has comment: http://stackoverflow.com/comment/31099387
has answer: http://stackoverflow.com/a/20750184
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31099429
type: UnansweredQuestion
tagged with: datetime
has answer: http://stackoverflow.com/a/20750170
has comment: http://stackoverflow.com/comment/31094740
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31099653
type: Question

http://stackoverflow.com/q/20692586
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/20692820
answer count: 2
tagged with: deserialization
accepted answer: http://stackoverflow.com/a/20692651
has comment: http://stackoverflow.com/comment/30991080
tagged with: serialization
has answer: http://stackoverflow.com/a/20692820
has answer: http://stackoverflow.com/a/20692651
has title: My global variable value is not being preserved after deserialization
type: AnsweredQuestion
has body: I serialized a class called GreenhouseControls like this: public class GreenhouseControls extends Controller implements Serializable{ ...... public void saveState() { try{ // Serialize data object to a file ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("dump.out")); out.writeObject(GreenhouseControls.this); System.out.println(GreenhouseControls.errorcode); // Prints 1 out.close(); } catch (IOException e) { } } ...... } When the GreenhouseControls object was serialized, the global static variable 'errorcode' was set to 1. I then deserialized the GreenhouseControls class like this: public class GreenhouseControls extends Controller implements Serializable{ ...... public class Restore extends Event { ..... @Override public void action() { try { FileInputStream fis = new FileInputStream(eventsFile); ObjectInputStream ois = new ObjectInputStream(fis); GreenhouseControls gc = (GreenhouseControls) ois.readObject(); System.out.println("Saved errorcode: " + gc.errorcode); // Prints 0 (the default value) ois.close(); }catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } } } ...... } When I printed the 'errorcode' to console after deserialization I was expecting a 1 value but instead a 0, the default value for the variable, was printed. Should the static variable's value when it is serialized be preserved after deserialization?
linked to: http://stackoverflow.com/q/13336727
tagged with: java

http://stackoverflow.com/q/20833878
type: Question
has answer: http://stackoverflow.com/a/20834068
linked to: http://stackoverflow.com/q/4955198
possible better answer: http://stackoverflow.com/a/20833906
tagged with: algorithm
has answer: http://stackoverflow.com/a/20833906
has title: Why another branch is unreachable in my code?
score: 0
accepted answer: http://stackoverflow.com/a/20834041
answer count: 5
has comment: http://stackoverflow.com/comment/139142201
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20833918
tagged with: java
has answer: http://stackoverflow.com/a/20833921
has body: Why the output of the following code is always suck. How to get happy as the output? Why the happy branch is unreachable? public class HowToMakeStackoverflowBetter { private static final int HUMAN_PATIENCE = 10; private List&lt;Member&gt; members = new ArrayList&lt;&gt;(); private int atmosphere = -10; private Random r = new Random(); public HowToMakeStackoverflowBetter(int size) { for (int i = 0; i &lt; size; i++) { members.add(new Member()); } } public Member pick() { return members.get(r.nextInt(members.size())); } public class Member { private int patience = HUMAN_PATIENCE; private Question question = null; public Member() { patience = r.nextInt(patience+1) + atmosphere; } public void vote(Question q) { if (patience &gt;= 0) { voteUp(q); } else { voteDown(q); } } public void ask() { question = new Question(); for (Member member : members) { member.vote(question); } } private void voteUp(Question q) { ++q.vote; } private void voteDown(Question q) { --q.vote; } public String toString() { return (question.vote &gt;= 0)? "Happy!" : "Suck!"; } } public class Question { private int vote; } public static void main(String[] args) { HowToMakeStackoverflowBetter stackoverflow = new HowToMakeStackoverflowBetter(100); Member me = stackoverflow.pick(); me.ask(); System.out.println(me); } } After a 1000 times loop, it gives us 1000 sucks. I remember 2 or 3 years ago, this was not the case. Something changed.
tagged with: design-patterns
has answer: http://stackoverflow.com/a/20834041

http://stackoverflow.com/comment/31208711
type: QuestionComment
has text: @A.J. maybe you're right. I'll just sit here an watch the paint dry while we await an actual question
comment on: http://stackoverflow.com/q/20813848
score: 0
type: Comment

http://stackoverflow.com/a/20731440
score: 2
has body: From your text alone it sounds that the option wasn't exactly buggy to begin with: it had some minor issues, unlikely to occur in any one specific setting. For a long time, the Concurrent Mark and Sweep collector has been a very common choice for the Old Generation. By default, it works with the ParNewGC collector in the young generation. If there were any problems with it in the early days, they have been fixed a long time ago.
accepted answer of: http://stackoverflow.com/q/20731298
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/20731298

http://stackoverflow.com/a/20758429
has body: final int clicks = 0 Final varaible value can not be change so make your varaible as public or private its depend upon your need private int clicks =0
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20758250

http://stackoverflow.com/a/39331747
has body: well, there is no problem in the basic logic. Maybe a little change in formulation of dp[i][j] might help. Instead of computing dp[i][j] inside the for-loop try finding maximum length of path i.e max over all 8 possibilities and then equatin that with dp[i][j]. snippet from my code in c++ might help: int dfs(int i,int j) { if(dp[i][j]!=0) { return dp[i][j]; } int val=1; for(int k=0;k&lt;8;k++) { int i1=i+x[k]; int j1=j+y[k]; if(i1&gt;=0&amp;&amp;i1&lt;h&amp;&amp;j1&gt;=0&amp;&amp;j1&lt;w) { if((mat[i1][j1]==mat[i][j]+1 )&amp;&amp; visit[i1][j1]==0) { //path++; //important don't do this in recursive functions with for loops visit[i1][j1]=1; //return(dp[i][j]=max(path ,dfs(i1,j1,path+1)));//this is causing problem here val=max(val ,1+dfs(i1,j1)); } } } return(dp[i][j]=val); }
type: Answer
downvote count: 2
answers question: http://stackoverflow.com/q/20683106
upvote count: 0
score: -2

http://stackoverflow.com/a/20725664
score: 0
answers question: http://stackoverflow.com/q/20724180
type: Answer
has body: Could it be as simple as the name of your library folder. Make sure it is named "libs". Then put the twitter4j jar there.
has comment: http://stackoverflow.com/comment/31051016

http://stackoverflow.com/comment/31215200
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20817383
has text: Please post the exception stack trace and the initialization and type of `rssUrl`.
score: 0

http://stackoverflow.com/q/20821372
accepted answer: http://stackoverflow.com/a/20828376
has body: Hello guys I am new to GreenFoot Java, however with ActionScript 3 I'm okay. Now I hear that AS3 and Java are very similar. In Green Foot application can I use public void act() { if (e.keycode == 39) {this.x +=4}; } Or does this only apply for ActionScript 3? Sorry if the experts find this question stupid.
type: AnsweredQuestion
has title: Greenfoot Application - Movement
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20828376
tagged with: greenfoot
score: -1
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/46346122
score: 2
type: AnswerComment
has text: For example, `Charge.create()` is both public, and part of the published stripe API, while [`ChargeRefundCollectionDeserializer.deserialize()`](https://github.com/stripe/stripe-java/blob/master/src/main/java/com/stripe/model/ChargeRefundCollectionDeserializer.java#L17) is public, but not published. Developers using the Stripe library in their projects should not be using the deserializer directly, so Stripe should be able to change the signature of deserialize without breaking programs using the library.
comment on: http://stackoverflow.com/a/20832553
type: Comment

http://stackoverflow.com/comment/31160958
comment on: http://stackoverflow.com/q/20787718
score: 1
has text: I don't see anything about javascript here.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20699035
accepted answer: http://stackoverflow.com/a/20701265
tagged with: performance
score: 0
tagged with: java
has title: Thread Handling after exception
has body: used thread.sleep when exception occurs in my application if any thing exception occured in any one of the thread it should wait for some time and have to try again what i am facing the issue means for 100 request if exception occurs for 50 means that should be wait for some time and after try again if any exception occurs means it should also wait till success am feeling this going to affect the performance and system usage. Please let me know your suggestions. Is it better to create new thread if any exception occurs? Or Any other way?
has answer: http://stackoverflow.com/a/20701265
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31001624
has comment: http://stackoverflow.com/comment/31003090
possible better answer: http://stackoverflow.com/a/20699137
has answer: http://stackoverflow.com/a/20699137
type: Question
answer count: 2
tagged with: multithreading

http://stackoverflow.com/q/20812767
score: 0
has title: How to correctly describe sessionFactory()?
upvote count: 1
has comment: http://stackoverflow.com/comment/31207021
has answer: http://stackoverflow.com/a/20812819
downvote count: 1
has comment: http://stackoverflow.com/comment/31206813
answer count: 1
favorite count: 0
has body: I am working with final hibernate version (4.3.0) &amp; trying to create sessionFactory() instance, but it seems that everything is deprecated. I try this: And it shows, that cannot find a symbol like "buildServiceRegistry()". Also ServiceRegistryBuilder() is Deprecated. So, frankly how to instantiate it? CODE HERE: http://pastebin.com/EkqfRxkB
has comment: http://stackoverflow.com/comment/31206892
tagged with: sessionfactory
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31206832
type: Question
has comment: http://stackoverflow.com/comment/31206807
has comment: http://stackoverflow.com/comment/31206844
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/20812819
has comment: http://stackoverflow.com/comment/31206795

http://stackoverflow.com/comment/31123708
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20766313
score: 0
has text: tintinmj - I got it when trying int[][] intGraph; insted of int[][] intGraph = new int[500][4];

grails
tags question: http://stackoverflow.com/q/20781518
tags question: http://stackoverflow.com/q/20716295
type: Tag
tags question: http://stackoverflow.com/q/20794931
tags question: http://stackoverflow.com/q/20704910
tags question: http://stackoverflow.com/q/20699128
tags question: http://stackoverflow.com/q/20834897
tag name: grails

http://stackoverflow.com/comment/31241457
comment on: http://stackoverflow.com/q/20830535
has text: It just sets value of a member variable. For now the value is left unused. However, I think the problem may be lying somewhere else. My latest wild guess is that the `value` may be left unitialized instead of being null in some cases, which would trigger the crash.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20807239
score: 40
has comment: http://stackoverflow.com/comment/31220366
downvote count: 0
has comment: http://stackoverflow.com/comment/92705427
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20807148
has body: You can't define a constructor for an anonymous class (part of the language specification), but you can control which super constructor is called by simply providing arguments to the new call: MyBob my = new MyBob("foo") { // super(String) is called // you can add fields, methods, instance blocks, etc, but not constructors }
accepted answer of: http://stackoverflow.com/q/20807148
type: Answer
upvote count: 40

http://stackoverflow.com/q/20692945
has comment: http://stackoverflow.com/comment/30991541
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/20693144
has title: How to implement infrequent method/interface in list of classes?
type: Question
tagged with: inheritance
score: 0
has body: Let's say I have a class called Element which is a superclass for all kinds of elements; Wall, Door, Pickup, Table, etc. Now suppose, some of these subclasses can be interacted with by an instance of Player via a use() method, but others can not. Only 1-5% of all the elements will be usable. How would I implement this in an object-orientated fashion? I have considered the following options: Element can contain an overridable use() method, which can be overriden by each subclass. This is easy to implement but requires the player to check the use() method from a lot of objects when interacting with the world. Some subclasses can implement an Usable interface, which defines the use() method. This requires the program to keep track of at least two lists, one for Element's and one for Usable's. Use one list for Elements and use the instanceof operator to check for usability. Really? Does anyone have a better solution?
tagged with: java-7
answer count: 1
has answer: http://stackoverflow.com/a/20693144
tagged with: interface

http://stackoverflow.com/comment/31266052
type: QuestionComment
comment on: http://stackoverflow.com/q/20844734
has text: this option is not available now !
score: 0
type: Comment

http://stackoverflow.com/comment/31213284
comment on: http://stackoverflow.com/a/20816158
score: 0
type: AnswerComment
type: Comment
has text: I'm not etirely sure, but I think it should go inside your showSplash method. Just replace the the try catch

http://stackoverflow.com/comment/31146518
comment on: http://stackoverflow.com/q/20760608
has text: Please add to your question, what error you're getting.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31184727
has text: there is no need for setting the dataType to json unless the server responds with json.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20800953
type: Comment

http://stackoverflow.com/comment/31033908
score: 0
has text: Basically your solution is to create a new DefaultTableMode with the rows and columns vector. Worth a try, though your code (formatting) leaves a bit to desire, _Welcome to StackOverflow._
type: Comment
comment on: http://stackoverflow.com/a/20716634
type: AnswerComment

http://stackoverflow.com/a/20762939
has comment: http://stackoverflow.com/comment/31117232
has comment: http://stackoverflow.com/comment/31117223
has comment: http://stackoverflow.com/comment/31117259
answers question: http://stackoverflow.com/q/20762894
type: Answer
has body: This library you're using seems like it's not supported really. Seems it's not changed since 2010. I would try using something else. I have used this one for example without any issues. http://code.google.com/p/google-gson/downloads/list
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31117290
upvote count: 1

http://stackoverflow.com/comment/31232449
type: Comment
score: 0
has text: Thank you, but I tried both and I still get errors related to the lack of javatuples jar
type: QuestionComment
comment on: http://stackoverflow.com/q/20819435

http://stackoverflow.com/comment/31002351
score: 1
comment on: http://stackoverflow.com/a/20686217
type: AnswerComment
has text: @geceo If two nodes have the same key fields, that means it should be the same node. It is a problem of deciding what are the key fields for an object, not a implementation of `equals` or `hashCode`.
type: Comment

http://stackoverflow.com/comment/31072254
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/20737225
has text: @Chawbee Accept my answer - the checkmark up there to the left (You don't have enough rep to upvote it yet). Thanks!
score: 0

http://stackoverflow.com/comment/30970238
score: 0
comment on: http://stackoverflow.com/a/20681741
type: AnswerComment
type: Comment
has text: Wow that fixed it thanks a lot. I'll accept this as an answer.

http://stackoverflow.com/q/20804439
has comment: http://stackoverflow.com/comment/31191229
tagged with: 2d-games
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31191938
tagged with: java
tagged with: slick2d
has body: I've implemented some pathfinding in my 2d game, but I don't know how to move my 'Zombie' character. I'm using slick2d and everything gets put on the screen in the render method, however I want to update the zombies movement in the Zombie class. Here is the method in the zombie class: public void findPrey(){ Pathfinder pf = new Pathfinder(); pf.setStartNode(xPosition,yPosition); for(PathCoordinates p: pf.calculatePath()){ if(p.getXPosition() &gt; xPosition){ moveRight(2); }if(p.getXPosition() &lt; xPosition){ moveLeft(2); }if(p.getYPosition() &gt; yPosition){ moveUp(2); }if(p.getYPosition() &lt; yPosition){ moveDown(2); } } } So I want to loop through the List of x and y coordinates and move the zombie. However nothings happens- the zombie doesnt move at all. In my 'world' class I have the render method, which loops through the zombies and renders them, the code has been edited slightly: public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { for (Zombie z : zombies) { if (!z.isDead()) { z.render(gc, sbg, g); z.findPrey(); } } } So, basically my question is how - do I make my zombie character move?! Thanks for any help or guidance
type: Question
score: 0
has answer: http://stackoverflow.com/a/20806785
has title: How to update and move object with pathfinding?
tagged with: path-finding
answer count: 1
tagged with: game-engine

lwjgl
tags question: http://stackoverflow.com/q/20790789
tags question: http://stackoverflow.com/q/20848157
tag name: lwjgl
tags question: http://stackoverflow.com/q/20809410
tags question: http://stackoverflow.com/q/20724323
tags question: http://stackoverflow.com/q/20801017
tags question: http://stackoverflow.com/q/20690011
tags question: http://stackoverflow.com/q/20788163
tags question: http://stackoverflow.com/q/20806427
tags question: http://stackoverflow.com/q/20765332
tags question: http://stackoverflow.com/q/20824559
tags question: http://stackoverflow.com/q/20849168
tags question: http://stackoverflow.com/q/20769821
tags question: http://stackoverflow.com/q/20797514
tags question: http://stackoverflow.com/q/20747035
tags question: http://stackoverflow.com/q/20787075
type: Tag
tags question: http://stackoverflow.com/q/20733516
tags question: http://stackoverflow.com/q/20826869
tags question: http://stackoverflow.com/q/20775629
tags question: http://stackoverflow.com/q/20810857
tags question: http://stackoverflow.com/q/20692667
tags question: http://stackoverflow.com/q/20687407

http://stackoverflow.com/a/20768136
upvote count: 1
has comment: http://stackoverflow.com/comment/31127875
accepted answer of: http://stackoverflow.com/q/20768093
answers question: http://stackoverflow.com/q/20768093
type: AcceptedAnswer
has body: Did you do this step in the deploy your webapp section and also add :main my-webapp.handler If this doesn't help then could you post the entire project.clj file so we can look for other problems?
downvote count: 0
has comment: http://stackoverflow.com/comment/31127685
type: Answer
has comment: http://stackoverflow.com/comment/31127734
score: 1
has comment: http://stackoverflow.com/comment/31127289

http://stackoverflow.com/q/20800603
downvote count: 0
has title: How to set a listener to a switch in the action bar?
has comment: http://stackoverflow.com/comment/31246046
favorite count: 0
has answer: http://stackoverflow.com/a/67755135
answer count: 5
has answer: http://stackoverflow.com/a/20834391
has comment: http://stackoverflow.com/comment/31246024
tagged with: android
has comment: http://stackoverflow.com/comment/31243620
has answer: http://stackoverflow.com/a/20834267
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20800854
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20800854
has body: I have this menu layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/actionBarSave" android:showAsAction="always" android:scaleType="fitXY" android:icon="@drawable/save_33x26" style="@style/ActionButtonStyle" android:title="save" /&gt; &lt;item android:id="@+id/actionBarLoad" android:showAsAction="always" android:icon="@drawable/load70x24" android:scaleType="fitXY" android:title="load" /&gt; &lt;item android:id="@+id/actionBarDelete" android:showAsAction="always" android:scaleType="fitXY" android:icon="@drawable/delete_enabled" android:title="delete" /&gt; &lt;item android:id="@+id/actionBarSoundSwitch" android:title="soundswitch" android:layout_centerInParent="true" android:scaleType="fitXY" android:showAsAction="always" android:actionLayout="@layout/sound_switch" /&gt; &lt;/menu&gt; The sound_switch layout file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;Switch android:id="@+id/soundSwitch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SFX" android:layout_centerInParent="true" /&gt; &lt;/RelativeLayout&gt; Here is my java code where I am attempting to add a OnCheckedChangeListener to the switch: @Override public boolean onOptionsItemSelected(MenuItem item) { soundSwitch = (Switch)findViewById(R.id.actionBarSoundSwitch); soundSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener(){ @Override public void onCheckedChanged(CompoundButton arg0, boolean arg1) { soundOn = arg1; } }); switch (item.getItemId()) { case R.id.actionBarSave: onSave(); return true; case R.id.actionBarLoad: onLoad(); return true; case R.id.actionBarDelete: onDelete(); return true; case R.id.actionBarSoundSwitch: onSound(); return true; default: return super.on…
type: Question
has comment: http://stackoverflow.com/comment/31247058
accepted answer: http://stackoverflow.com/a/20834267
has answer: http://stackoverflow.com/a/20834924
score: 3

http://stackoverflow.com/a/20685392
score: 0
answers question: http://stackoverflow.com/q/20685173
type: Answer
has body: Prabhkaran is exactly right, has answer will work. The code HashMap&lt;player.getName(), player&gt; is not valid, because you are supplying objects into the HashMap generic parameters, and they should be class definitions. Example: // Construct a HashMap with can contain Strings as keys and values HashMap&lt;String, String&gt; mymap = new HashMap&lt;String, String&gt;(); // add Strings to my hashmap mymap.put("hello","world"); is OK, but // compilation failure! new HashMap&lt;"Hello","World"&gt;(); is not.

http://stackoverflow.com/a/20693517
answers question: http://stackoverflow.com/q/20691925
score: 1
has body: The code you posted cannot give that error message. There must be some other code in your script that causes that error. Only a SET statement without an = could give that error. After parsing and expansion, the offending statement must look like one of the following: set list[ set "list[ set "list[" Actually, you could get that error in the presence of an = if there are quotes that are misplaced. For example, the following will give that error because all text after the last " is ignored: set "list["1]=value The 1]=value appears after the last " and is ignored, leaving set "list[". You might consider enabling ECHO so that you can pinpoint exactly where the error message is occurring. Then you need to figure out what conditions could lead to the error at that point. Update in response to "Edit 2:" in question That IN() clause in the newly posted code is almost assuredly the point where the error message is generated. It indicates that the list "array" is not defined when the FOR /F loop is executed. The question is, why not? Things to look for: Is something preventing the earlier FOR loop that defines the list "array" from running? Are you sure the parameters are getting passed properly to the script? If there are no parameters, then there will not be an array. Is something undefining the array before the 2nd FOR loop has a chance to execute? I suggest you put in some diagnostic ECHO statements to help debug. For example, ECHO BEFORE 1ST LOOP immediately before the loop that defines the array to make sure the loop is being reached. Or ECHO ARGS = %* at the beginning of the script to make sure the parameters are getting passed properly. Happy sleuthing :-)
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31026656
has comment: http://stackoverflow.com/comment/30992579
has comment: http://stackoverflow.com/comment/31027416
has comment: http://stackoverflow.com/comment/30993831
downvote count: 0

http://stackoverflow.com/q/20796676
favorite count: 0
has answer: http://stackoverflow.com/a/20796705
has body: below are the For Loop //Declare 5 String variable String p1, p2, p3, p4, p5; for (int row = 1; row &lt;= 5; row++) { String pno = driver.findElement( By.xpath("//*[@id='body']/table/tbody/tr[" + row + "]/td")).getText(); p1 = pno; } my question while executing the First row (row =1) it should be assign that value in p1 variable While executing the Second row (row = 2) it should be assign that value in p2 variable , vice-versa how could possible to assign the each row value with separate variable in java
type: UnansweredQuestion
tagged with: java
downvote count: 2
type: Question
tagged with: for-loop
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/20796804
has answer: http://stackoverflow.com/a/20796681
has comment: http://stackoverflow.com/comment/31177668
answer count: 3
has title: For Loop value assign with multiple String - java

http://stackoverflow.com/a/20859513
answers question: http://stackoverflow.com/q/20848082
has comment: http://stackoverflow.com/comment/31301821
type: Answer
has comment: http://stackoverflow.com/comment/31304918
downvote count: 1
score: 3
has body: Simple Factory - This isn't an official GoF pattern, infact I had no idea what you were talking about until I pulled out my Head First Design Pattern Book. Simple Factory is just a method that can return different hardcoded subtypes. public Pizza createPizza(String type){ if(type.equals("cheese")){ return new CheesePizza(); }else if (type.equals("pepperoni")){ return new PepperoniPizza(); } ... } The problem with this code is you are stuck with only the hardcoded types. If you want to change how the method works, or what types are returned you have to modify code and recompile. Adding new types will be very difficult. Factory Method - you do most of the work in a super class but put off deciding what sort of object you will be working with until runtime. Often the superclass needs to create a worker object of some default type but the superclass allows subclasses to specialize the worker. Factory Methods are usually used when an AbstractFactory is overkill but one downside is it forces you to use inheritance which has its own set of maintenance and design problems. This is very similar to SimpleFactory except you use inheritance instead of a discriminator to get different return types. public void foo(){ Bar bar = createBar(); //do stuff with bar } //method is protected so subclass can override it to return something else protected Bar createBar(){ return new DefaultBar(); } AbstractFactory - Create Objects knowing only the interface they implement not the actual class. AbstractFactories make it easy for code to work in different systems because you don't need to know the concrete factory or concrete products that are used. For example Collection.iterator() is an abstract factory of Iterator objects. Classes such as LinkedList or HashSet have their own implementations of iterator() (and therefore are Concrete Factories) that return different classes that implement the iterator interface (the concrete product) Once you finish Head First Design Patterns I recommend Ho…
has comment: http://stackoverflow.com/comment/31302006
upvote count: 4
has comment: http://stackoverflow.com/comment/38081302
has comment: http://stackoverflow.com/comment/31304938
has comment: http://stackoverflow.com/comment/68850949

http://stackoverflow.com/comment/31035471
score: 0
comment on: http://stackoverflow.com/q/20717151
has text: @Baz http://postimg.org/image/l8zu4uc2j/
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31051168
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20725732
type: AnswerComment
has text: When I test the code, it terminates after it says `Enter the operation`

http://stackoverflow.com/q/20802027
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-adapter
score: 2
answer count: 0
upvote count: 2
has title: Spinner double click crashing app
tagged with: java
type: Question
has body: I have implemented spinner and its working fine with 'single click'. But when I double click on any item of spinner, whole app is getting crashed. Basically user should be unable to double click. I am running code on emulator. Is this happing due to slow emulator or is there any error in my code? MainActivity.java static Spinner statusSpinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mySpinner = (Spinner) findViewById(R.id.Spn_Status); mySpinner.setOnItemSelectedListener(this); } @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { //do something } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent){ //do something } activity_main.xml &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="0dip" android:weightSum="10" &gt; &lt;Spinner android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:id="@+id/Spn_Status" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="4" android:background="@drawable/drop_down" android:entries="@array/Status" android:paddingLeft="5dip" android:prompt="@string/Set_Status" android:spinnerMode="dialog"/&gt; &lt;/LinearLayout&gt; Logcat: java.lang.NullPointerException at android.widget.Spinner$DialogPopup.dismiss(Spinner.java:907) at android.widget.Spinner$DialogPopup.onClick(Spinner.java:945) at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:941) at android.widget.AdapterView.performItemClick(AdapterView.java:298) at android.widget.AbsListView.performItemClick(AbsListView.java:1100) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2788) at android.widget.AbsListView$1.run(AbsListView.java:3463) at android.widget.AbsListView.onDetachedFromWindow(AbsListView.java:2670) at android.view.View.disp…
tagged with: android-spinner

http://stackoverflow.com/comment/31203628
type: Comment
comment on: http://stackoverflow.com/a/20805378
has text: My socket will handle incoming socket data as long as my program is running. I think I really need to look at Service. I found some documents about Service and IntentService. I'm going to go with IntentService as you said. Thanks you so much.
type: AnswerComment
score: 0

http://stackoverflow.com/q/20795422
has body: URI uri = new URIBuilder() .setScheme("https") .setHost("1.1.1.1") .setPath("/cgi-bin/login") .setParameter("username", name) .build(); ... CloseableHttpResponse response = httpclient.execute(httppost); The "name" would be an email address. The symbol @ will be converted to "%40" when HTTP post. what's the problem? Thanks.
has comment: http://stackoverflow.com/comment/31175524
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31175558
has comment: http://stackoverflow.com/comment/31175202
has comment: http://stackoverflow.com/comment/31175761
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/20795940
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31175752
has comment: http://stackoverflow.com/comment/31175805
type: Question
tagged with: httpclient
has title: HTTP POST convert @ to %40
has comment: http://stackoverflow.com/comment/31175647
score: 0
accepted answer: http://stackoverflow.com/a/20795940
has comment: http://stackoverflow.com/comment/31175661

http://stackoverflow.com/comment/31092472
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/20748866
has text: No you cannot. At a time you can remove one element, remove in a loop or look at sublist() method. That might be useful.

http://stackoverflow.com/q/20701392
tagged with: sockets
tagged with: android
tagged with: java
has title: Why on double click android client received data?
type: Question
has answer: http://stackoverflow.com/a/20701698
has body: When I click the first time on login button, data send to server and server received data in return on first click data not show on android client screen. When I pressed login button again it again send data and then it show data on client screen... plz help me. Why data is received on secind click i want my data recived on my first click? Here is the code : Client tcpip code... public class SockProg { private Socket socket; DataOutputStream dataOutputStream; DataInputStream dataInputStream; String data; String serverip = "192.168.1.7"; int serverport = 4444; public void connetToServer(){ try { socket = new Socket(serverip, serverport); Log.i("AsyncTank", "doInBackgoung: Created Socket"); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (socket.isConnected()) { try { dataOutputStream = new DataOutputStream( socket.getOutputStream()); dataInputStream = new DataInputStream(socket.getInputStream()); } catch (IOException e) { e.printStackTrace(); } } } public void writeToStream(String message) { try { if (socket.isConnected()){ dataOutputStream.writeUTF(message.toString()); } else { Log.i("AsynkTask", "writeToStream : Cannot write to stream, Socket is closed"); } } catch (Exception e) { Log.i("AsynkTask", "writeToStream : Writing failed"); } } public String readFromStream() { String ret = null; try { if (socket.isConnected()) { Log.i("AsynkTask", "readFromStream : Reading message"); ret=dataInputStream.readUTF(); Log.i("AsynkTask", "readFromStream : read "+ret); } else { Log.i("AsynkTask", "readFromStream : Cannot Read, Socket is closed"); } } catch (Exception e) { Log.i("AsynkTask", "readFromStream : Reading failed"+e.getClass()); } return ret; } public void CloseSockets(){ if (socket != null) { try { socket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (dataOutputStream != null) { try { dataOutputStream.close(); } catch (IOException e) { // TODO Auto-generate…
score: 0
answer count: 1
type: UnansweredQuestion

m2crypto
tags question: http://stackoverflow.com/q/20805980
type: Tag
tag name: m2crypto

http://stackoverflow.com/comment/31079870
score: 0
type: AnswerComment
type: Comment
has text: See my edited question above, i have set Activity like this, then how can i check this condition with my code.
comment on: http://stackoverflow.com/a/20742138

http://stackoverflow.com/q/20794864
linked to: http://stackoverflow.com/q/9666416
has answer: http://stackoverflow.com/a/20794893
accepted answer: http://stackoverflow.com/a/20794893
tagged with: http://stackoverflow.com/tag/html
has body: I am not able to find where the problem, it is with js files or server.It is fine with some pages, but it is not loading js files in firefox. with firefox: SyntaxError: illegal character 癡爠浥湵楤猠㵛≶敲瑩捡汭敮產崻 ⽅湴敲⁩搨猩⁯映啌⁭敮畳Ⱐ獥灡牡瑥搠批⁣潭浡猍੶慲⁳畢浥湵潦晳整‽‭㈠⼯佦晳整⁯映獵扭敮畳⁦牯洠浡楮⁭ cssver...menu.js (line 1, col 7) SyntaxError: illegal character ⼯䉥汯眠晵湣瑩潮⁩猠畳敤⁴漠晩汬⁴桥⁓異灬楥牓畢⁃慴敧潲礠乡浥猠摲潰摯睮⸊晵湣瑩潮⁳敬散瑟潮䍨慮来⡭慩湓異灎慭攩笊†ਠ† Mariti...tory.js (line 1) SyntaxError: illegal character 晵湣瑩潮⁣汯獥浥⠩ഊ笍ਉउ␨∣汢潸∩⹦慤敏畴⠢獬潷∩㬍ਉउ␨∣执∩⹦慤敏畴⠢獬潷∩㬍ਉउ␨∮汩獴扯硤慴慢慮欢⤮捳猨≶楳楢楬楴礢Ⱒ popup.js (line 1, col 4) SyntaxError: illegal character 晵湣瑩潮⁩湩琨⤠笍੶慲⁤楶栠㴠摯捵浥湴⹧整䕬敭敮瑂祉搨❢慮湥爧⤮潦晳整䡥楧桴㬍੩映⡤潣畭敮琮来瑅汥浥湴䉹䥤⠧楮湥牣潮瑥湴桥慤敲摡 This is my jsp page <%@page contentType="text/html" import="java.util.*, com.sym.imu.model.AddSupplierModel" %> <%@ 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" %> <%! String[] ch = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; %> <% List<String> serviceProvider_Details_List = new ArrayList<String>(); serviceProvider_Details_List = (List)session.getAttribute("details_List"); session.removeAttribute("details_List"); if(serviceProvider_Details_List!=null && serviceProvider_Details_List.size()>0){ %> <%=serviceProvider_Details_List.get(0)%> <% if(serviceProvider_Details_List.get(2)!=null){ %> <bean:message key="Label.AddManufacturersVendorDoorNo"/> <%=serviceProvider_Details_List.get(2)%> <% } if(serviceProvider_Details_List.get(3)!=null){ %> <bean:message key="Label.AddManufacturersVendorStreet"/> <%=serviceProvider_Details_List.get(3)%> <% } if(serviceProvider_Details_List.get(4)!=null){ %> <bean:message key="Label.AddManufacturersVendorCity"/> <%=serviceProvider_Details_List.get(4)%> <% } if(serviceProvider_Details_List.get(5)!=null){ %> <bean:message key="Label.AddManufacturersVendorState"/> <%=servicePr…
type: AnsweredQuestion
tagged with: java
has title: Illegal Characters appended to some javascript files
type: Question
tagged with: javascript
tagged with: struts2
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31174291
tagged with: tomcat

http://stackoverflow.com/a/42205621
score: 0
has body: I have encountered the same exception on Wildfly 10. While following some important references: Namely documentation on establishing remote EJB connection on: https://docs.jboss.org/author/display/WFLY10/EJB+invocations+from+a+remote+client+using+JNDI java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:wildfly10-test-client-remote-ejb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1b26f7b2 at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:798) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128) at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186) at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146) at com.sun.proxy.$Proxy6.doWork(Unknown Source) at ejb.InvokeRemoteEjbTest.testThatFailsWithEJBCLIENT000025(InvokeRemoteEjbTest.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.ju…
type: Answer
answers question: http://stackoverflow.com/q/20817223

http://stackoverflow.com/q/20760254
tagged with: api
upvote count: 0
has title: Twitter4j getOAuthAccessToken always fail
type: AnsweredQuestion
tagged with: android
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/31112721
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20979749
tagged with: twitter4j
tagged with: java
has body: I'm using twitter4J to tweet with my Android App, here is a snippet of my code: try{ AccessToken at = mTwitter.getOAuthAccessToken(mReqToken, v); mTwitter.setOAuthAccessToken(at); status = mTwitter.updateStatus("This is the hook ..."); Log.e("TWITTER-STATUS", " = " + status.getText()); } catch (Exception e){ Log.e("TWITTER-KO", ""); } The getOAuthAccessToken() method is always failing and give the "TWITTER-KO" Log, the properties mReqToken and v are 2 strings which respectively contains my token access and the retrieved verifier string.The rest of the code like twitter4J authorization and setting the authorization are right. Can you please tell me what I'm doing wrong, I would like to post a tweet with my Android app.
accepted answer: http://stackoverflow.com/a/20979749
has comment: http://stackoverflow.com/comment/31475606

http://stackoverflow.com/q/20761149
tagged with: java
type: Question
answer count: 1
has title: android get keyEvent for focusable PopupWindow
score: 0
tagged with: popupwindow
tagged with: android
has body: I've got a popup-window like this: View view = li.inflate(R.layout.someview, null); PopupWindow popup = new PopupWindow(context); popup.setBackgroundDrawable(new BitmapDrawable()); popup.setWidth(ViewGroup.LayoutParams.MATCH_PARENT); popup.setHeight(ViewGroup.LayoutParams.MATCH_PARENT); popup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); popup.setTouchable(true); popup.setFocusable(true); popup.setContentView(view); Inside the popup-window there is an edittext which definitely needs to be able to get the focus!! So I cannot remove the setFocusable(true); flag but I want to receive the keyEvents inside the popup anyway. So how can I receive key events on an focusable popupwindow?
type: UnansweredQuestion
tagged with: keyevent
tagged with: popup
has answer: http://stackoverflow.com/a/22497548

http://stackoverflow.com/comment/31198001
score: 2
has text: Reverting to u25 worked for me. Thanks.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20807657

http://stackoverflow.com/q/20685286
has answer: http://stackoverflow.com/a/20688276
tagged with: gradle
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20688276
has title: How to specify dependency on tomcat libraries with gradle
tagged with: java
score: 4
tagged with: eclipse
type: Question
upvote count: 4
answer count: 1
downvote count: 0
tagged with: jar
tagged with: tomcat
favorite count: 0
has body: A bit of background about my knowledge level: I'm currently trying to learn how to build a project with gradle. So far I don't have much experience with build tools (almost none). I do understand the general idea and have seen ant and maven files before but never written them myself. Until now I just used other peoples build scripts or configured my builds using Eclipse. So I might be on a completely wrong track here, if so please point me in the correct direction. Also, I sadly don't have much experience building jars by hand. I have an Eclipse project which I want to compile into a jar. Required library jars are on my local file system. I managed to make gradle use these via dependencies { compile fileTree(dir:'lib', include:'*.jar') } in addition I have my source files in src/main/java and just use apply plugin: 'java' in the build.gradle file. Trying to build the project with gradle build seems to do the right thing, as far as I can tell. However, the library is supposed to be used in a web project running on a tomcat and makes use of some libraries that are supplied by tomcat, as far as I understand. E.g. I'm using javax.servlet.http.HttpServletRequest. The project works fine in Eclipse, but there I have the tomcat library added to my Eclipse build path. When I check in Eclipse I can see that javax.servlet.http.HttpServletRequest is part of the servlet-api.jar which is part of the Tomcat library. Now, when I build the project I get build errors because the java compiler cannot find the class because I didn't specify the servlet-api.jar in the dependencies. I guess I could download it somehow (or learn how to specify it as an external dependency to make gradle download it from some repository) but I am not sure whether that would be correct. Is there a way to tell gradle to use the same library that Eclipse uses? Or some other general way to tell it about all the tomcat jars, the same way I can simply add the complete Tomcat library in Eclipse? Or do I actually …

http://stackoverflow.com/q/20783380
downvote count: 0
answer count: 1
tagged with: jax-rs
tagged with: moxy
has body: I have a JAX-RS service using Jersey and MOXy. I have a handler that returns the JSON or XML (depending on the Accept: header) representation of a type Memo, but if the item is not found, it should return a 404 error with the JSON or XML representation of a different type MemoError. With Accept: application/json it's working correctly in the first case (returning Memo), but not in the second (throwing WebApplicationException with MemoError entity). If I change my handler to return a MemoError, the second case does work (but the first one doesn't, obviously). It also works correctly in both cases with Accept: application/xml (using the default JAXB implementation), so I think the issue is with MOXy. the handler: @Path("{id}") @GET @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public Memo getMemo(@PathParam("id") long id) { Memo memo = memoService.getMemo(id); if (memo == null) { throw new WebApplicationException(Response .status(Response.Status.NOT_FOUND) .entity(new MemoError(4, "Not found")).build()); } return memo; } MemoError: @XmlRootElement(name = "error") public class MemoError { private int code; private String message; public MemoError() { } public MemoError(int code, String message) { this.code = code; this.message = message; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } Error log: Dec 26, 2013 1:05:55 PM org.glassfish.jersey.server.ServerRuntime$Responder process SEVERE: Error occurred when processing a response created from an already mapped exception. Dec 26, 2013 1:05:55 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet JAX-RS Servlet threw exception Local Exception Stack: Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.XMLMarshalException Exception Descr…
favorite count: 0
has title: MOXy: Throw WebApplicationException with different entity type than return value of handler
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/20783766
accepted answer: http://stackoverflow.com/a/20783766
type: Question
tagged with: jersey

http://stackoverflow.com/comment/30969966
type: QuestionComment
has text: @Templar yes, I am sure I was successfully uploaded because before restarting server it was able to download.
comment on: http://stackoverflow.com/q/20681434
score: 0
type: Comment

http://stackoverflow.com/comment/31090624
type: Comment
has text: Thanks but what is Maven
comment on: http://stackoverflow.com/a/20747796
type: AnswerComment
score: 0

http://stackoverflow.com/a/20813131
type: Answer
has comment: http://stackoverflow.com/comment/35747930
has comment: http://stackoverflow.com/comment/59534234
has comment: http://stackoverflow.com/comment/31219265
has comment: http://stackoverflow.com/comment/98462366
upvote count: 12
answers question: http://stackoverflow.com/q/20807066
accepted answer of: http://stackoverflow.com/q/20807066
downvote count: 4
has comment: http://stackoverflow.com/comment/35744831
has comment: http://stackoverflow.com/comment/59537265
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/98489080
has body: I don't think you can use the JAXP service mechanism to search for an XSD 1.1 processor. Load Saxon or Xerces in the normal way, and then enable XSD 1.1 processing. For Saxon this is done using SchemaFactory.setProperty("http://saxon.sf.net/feature/xsd-version", "1.1") UPDATE 2021-09-04 In recent Saxon releases, XSD 1.1 is the default, and no special property needs to be set to enable it.
score: 8
has comment: http://stackoverflow.com/comment/98487783

http://stackoverflow.com/q/20748658
tagged with: junit
downvote count: 0
possible better answer: http://stackoverflow.com/a/20921857
favorite count: 0
has comment: http://stackoverflow.com/comment/31153482
has answer: http://stackoverflow.com/a/20956226
accepted answer: http://stackoverflow.com/a/20956226
upvote count: 1
tagged with: spring
tagged with: autowired
linked to: http://stackoverflow.com/q/7865524
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: spring-data
has answer: http://stackoverflow.com/a/29393809
has answer: http://stackoverflow.com/a/20921857
type: Question
has comment: http://stackoverflow.com/comment/31348915
has body: I am working on a project which wants to use spring-boot-data-jpa. The local (IDE) database can be H2. However, for all servers (dev/test/prod), we are forced to use DB/2 (unfortunately!). We can't seem to get it things working with DB/2. We get an error like this: java.lang.IllegalStateException: Failed to load ApplicationContext.... Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [...Repository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} when running the unit tests (JUnit). Note, the blank {} annotation. Which on the face of it seems like an "obvious" issue. The repository bean can not be loaded or found on the classpath. However, when we run this with H2 configuration, it works just fine. So, the next logical conclusion seems to be the repositories configuration (data source, etc.) is not set up correctly. However, we can use the same configuration values in a non spring boot application and it works fine! So then I was thinking it could be something with the either the differing classloaders or cglib proxies not using the "real" implementation class. SO questions like these: Spring data autowire issue CGLIB needed for Spring Junit Tests Autowire and eclipse can cause issues However, the correct answers for those questions do not resolve the issue. So here is my post/question. How do figure out the root cause of this issue? I have tried to walk through the code (spring and our code) in the debugger but can't narrow down a cause. So then I tried this, I took the sample spring boot jpa and modified it to use specific properties for DB/2 and I can get the same failure. So it seems like my configuration must be wrong or there is a bug in the spring code. I have looked at the configuration with someone else and we don't see the problem. We tried this configuration in another (non-spring boot app) and it works. Here is a patch…
linked to: http://stackoverflow.com/q/9686042
has answer: http://stackoverflow.com/a/20998991
has comment: http://stackoverflow.com/comment/31346057
has title: Spring Boot Data JPA issues with DB/2 Configuration and JUnit
has comment: http://stackoverflow.com/comment/31348136
linked to: http://stackoverflow.com/q/12627300

http://stackoverflow.com/a/20732201
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/20732178
has body: byte is a signed integer type, going from -128 to 127. 0xFF is 255, so it's larger than 127. 0xFFFFFFFF is -1, so it's within the bounds of the byte type. See http://en.wikipedia.org/wiki/Two%27s_complement
has comment: http://stackoverflow.com/comment/31062497
accepted answer of: http://stackoverflow.com/q/20732178
upvote count: 4

http://stackoverflow.com/q/20687360
tagged with: drawable
type: AnsweredQuestion
has title: OOP design: How to decide program flow and class responsible for method (JSFML library)
tagged with: oop
upvote count: 3
tagged with: java
tagged with: sfml
type: Question
score: 3
has answer: http://stackoverflow.com/a/20688427
has body: I'm designing a 2D game to practice Java and Object Oriented Programming (I'm using the JSFML library, if that helps), and I have doubts regarding how to best design the following: The library I'm using offers a Drawable interface implemented by visible game elements (the player, enemies, backgrounds, etc). I also have a RenderWindow upon which I'll draw the Drawable objects. Here's the thing, the RenderWindow has a draw(Drawable d) method that draws a Drawable object on the current Window, and the Drawable objects have a draw(RenderWindow r) method that draws the current Drawable object on the RenderWindow passed. If they do basically the same thing, which one should I use? Why? What should I take into consideration to decide? I use a HashMap to store the Drawable objects. Should I pass the RenderWindow to the Drawables in the HashMap or pass the Drawables in the HashMap to the RenderWindow? Any advice is appreciated.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: program-flow
accepted answer: http://stackoverflow.com/a/20688427

http://stackoverflow.com/comment/31217768
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20818665
has text: @SotiriosDelimanolis - Yes, I've tried going through that and I couldn't seem to get it working. I'm not sure if I'm just missing something or what, but I can't seem to understand it.
score: 0

http://stackoverflow.com/comment/30985280
type: QuestionComment
has text: 5) whats reason to for return colonnes.isEmpty() ? rowCount : colonnes.get(0).size();, Cell can have null value too 6) notifiers in Table model are wrong, btw fireTableChanged reset tablemodel, not good idea, you can very simple to lost all custom TableCellRenderer/Editors .... etc
comment on: http://stackoverflow.com/q/20688267
score: 0
type: Comment

http://stackoverflow.com/a/20742150
type: Answer
has body: You can do like follow, no need to write so many condition String str=editText1.getText.toString(); String str1=editText2.getText.toString(); . . . . String strn=editTextn.getText.toString(); now check condition if(str.length()&gt;0 || str1.length&gt;0 || strn.length&gt;0){ // whatever code you want to put }else{ //alert dialog saying field is empty } Hope this helps...
score: 0
answers question: http://stackoverflow.com/q/20741916

http://stackoverflow.com/comment/31132397
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20771120
has text: i didnt add any links to the answer. which link may be invalid? It is just a "to the point" code block.

http://stackoverflow.com/comment/31086447
type: AnswerComment
comment on: http://stackoverflow.com/a/20745737
score: 0
type: Comment
has text: Your code checks if the input line CONTAINS the SKIP_TO_STR. Is this intended? I assumed we shall check if it is EQUAL to the SKIP_TO_STR...

http://stackoverflow.com/q/20817425
tagged with: tomcat
score: 6
has answer: http://stackoverflow.com/a/20817450
has title: Why reflection is used in this situation
favorite count: 0
has answer: http://stackoverflow.com/a/20817555
type: Question
has body: Today, I am looking the source code of tomcat in the Bootstrap.init() method, I found it used reflection to create an instance of org.apache.catalina.startup.Catalina, and use invoke() to set the ClassLoader Like the following code Class<?> startupClass = catalinaLoader.loadClass("org.apache.catalina.startup.Catalina"); Object startupInstance = startupClass.getConstructor().newInstance(); String methodName = "setParentClassLoader"; Method method = startupInstance.getClass().getMethod(methodName, paramTypes); method.invoke(startupInstance, paramValues); I found that many frameworks use reflections to create an instance, even though the class and method can be determined Just like the above code, use String to determine the target. Is it still necessary to use reflection?
upvote count: 7
has comment: http://stackoverflow.com/comment/84397686
has answer: http://stackoverflow.com/a/72399757
tagged with: reflection
tagged with: java
answer count: 3
downvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/31233656
score: 0
type: Comment
has text: Instead of looking for the character at the right side, you could for instance trim the letters 'FT' from the left. Then you can apply MAX function to the result
comment on: http://stackoverflow.com/a/20827230
type: AnswerComment

http://stackoverflow.com/comment/31125492
comment on: http://stackoverflow.com/a/20763716
has text: Fixed it. And yes, you should have that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20729321
answers question: http://stackoverflow.com/q/20729269
type: Answer
upvote count: 1
score: 1
has body: The Graphics object is what you actually use to draw into the canvas to render your component. It's a generic drawing API used in several places throughout Java (for example with Images) to allow you to paint into things.
downvote count: 0

http://stackoverflow.com/q/20815242
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/20833293
favorite count: 0
type: UnansweredQuestion
score: 3
tagged with: amazon-s3
upvote count: 3
tagged with: java
type: Question
has body: I am new to amazon aws. I want to extract Product details and product reviews. I've googled this question and I got this link. But this is not getting me anywhere. So please help me. P.S. : I want to implement this in Java.
linked to: http://stackoverflow.com/q/4811259
has title: Retrieve product information and product reviews from amazon

http://stackoverflow.com/q/20731621
has answer: http://stackoverflow.com/a/20733083
type: UnansweredQuestion
tagged with: sockets
tagged with: http
has comment: http://stackoverflow.com/comment/31061317
has body: I have a problem with my senior project. My objective is to read and modify HTTP response packet. I have a problem about java.net.SocketException. Could you help me, please? Exception at Responsethread java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) at java.net.SocketOutputStream.write(SocketOutputStream.java:147) at helper.ResponseThread.run(ResponseThread.java:163) BUILD STOPPED (total time: 4 minutes 3 seconds) Here is my code Helper.java package helper; import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; public class Helper { public void proc() { try { ServerSocket servsock = new ServerSocket(80); String hostname="www.hungeng.besaba.com"; InetAddress ip=InetAddress.getByName(hostname); //int serverPort=3456; //Socket clientSocket =new Socket(ip,serverPort); //String ipAddr="31.170.164.70"; //http://hungeng.besaba.com/ while (true) { Socket sockC = servsock.accept(); //get input stream of the Socket(sockC) from Client InputStream inC = sockC.getInputStream(); //get output stream of the Socket(sockC) to Client OutputStream outC = sockC.getOutputStream(); //Connect to the specified server(ipAddr) at the 80 port. Socket sockS = new Socket(ip, 80); //get input stream of the Socket(sockS) from server(ipAddr) InputStream inS = sockS.getInputStream(); //get output stream of the Socket(sockS) to server(ipAddr) OutputStream outS = sockS.getOutputStream(); //Create Thread for sending The Request Message from Client RequestThread request = new RequestThread(); //Create Thread for sending The Response Message to Client ResponseThread response = new ResponseThread(); // match a Request Thread with a Response Thread request.server = response; response.client = request; request.is = inC; request.os = outC; response.is = inS; response.os = o…
has title: "java.net.SocketException: Connection reset by peer: socket write error" How can I solve it
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/62929
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/31061347
linked to: http://stackoverflow.com/q/62929

http://stackoverflow.com/a/26229678
score: 20
answers question: http://stackoverflow.com/q/20710704
upvote count: 20
downvote count: 0
type: Answer
has body: The latest version of PMD (5.1.3 when writing this answer) is supported by gradle. The rulesets need to be prefixed by a java- I tested this with gradle-1.12 To use PMD 5.1.3 with gradle, the following configuration defines all the possibles rulesets I could find: pmd { toolVersion = '5.1.3' ruleSets = [ 'java-android', 'java-basic', 'java-braces', 'java-clone', 'java-codesize', 'java-comments', 'java-controversial', 'java-coupling', 'java-design', 'java-empty', 'java-finalizers', 'java-imports', 'java-j2ee', 'java-javabeans', 'java-junit', 'java-logging-jakarta-commons', 'java-logging-java', 'java-migrating', 'java-naming', 'java-optimizations', 'java-strictexception', 'java-strings', 'java-sunsecure', 'java-typeresolution', 'java-unnecessary', 'java-unusedcode' ] } Reference: http://forums.gradle.org/gradle/topics/_pmdtest_fails_with_cant_find_resource_null_when_rulesets_include_braces_gradle_2_0_rc_1

http://stackoverflow.com/comment/31266231
has text: @DavidV With some minor modification you can write to whatever stream you need (I write to a file).
comment on: http://stackoverflow.com/a/20844884
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38837150
comment on: http://stackoverflow.com/a/20799711
has text: The serrations should be a triangle wave equation perpendicular to the line's tangent. someone should draw it on an online web plotter like fooplot so we can try to improve it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/20699221
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20699055
has body: scannerTesting is your package name,right? If so, I suggest you run command "java" under the workspace D:\Java\Testing\src java scannerTesting.ScannerTest

http://stackoverflow.com/comment/31247502
score: 1
has text: @user3144349 You just "disable" the rendering engine, that's not how Swing is designed. It was made to work this way. You might as well try a cook a roast in the freezer...sorry, but that's the truth of the matter. I would imagine any tutorial that is telling you to avoid `paintComponent` should also be telling you to use a `BufferStrategy` instead. This is the only way to gain control over the paint process. The problem here is, Swing components are designed to use the passive rendering engine...catch 22...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20833913

http://stackoverflow.com/q/20694571
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31021967
has comment: http://stackoverflow.com/comment/30995355
has body: I have implemented the quicksort algorithm that uses the first element of the list as pivot and it worked fine. now I refactored to pick a random index as pivot element, swap with the first element and do the quicksort subroutine. somehow, it does not work, I do not get the sorted array. here is my code, which is self-explanatory, but I am happy to explain if any clarification needed. public class Qsort { public static void quickSort2(int[] arr, int i, int j){ if (i&lt;j){ int part =randPartition(arr, i, j); quickSort2(arr, i, part-1); quickSort2(arr, part+1, j); } } public static int randPartition(int[] arr, int start, int end){ //int pivId = (int)(Math.random()*(end-start)+1)+start; -- ***** int pivId = start; //System.out.println("pivId is "+ pivId + "; start is " + start + "; end is " + end); System.out.println("arr is "+ Arrays.toString(arr)); int pivot = arr[pivId]; swap(arr, start, pivId); int i = start; for (int j = start+1;j&lt;=end;j++){ if (arr[j]&lt;pivot){ i++; swap(arr,i,j); } } swap(arr, start,i); return i; } private static void swap(int[] arr, int index1, int index2) { int temp = arr[index1]; arr[index1]=arr[index2]; arr[index2]=temp; } public static void main(String[] args) { int[] data2 = new int[]{10,11,9,7,5}; System.out.println("Unsorted array data " + Arrays.toString(data2)); quickSort2(data2, 0, data.length-1); System.out.println("Sorted array data " + Arrays.toString(data2)); } } I have commented out the random pivot calculation in the code with *****. I dont see any problem with it, but having the random pivot calculation destroys the code
has title: randomized quick sort in Java need a suble fix?
tagged with: random
has comment: http://stackoverflow.com/comment/30995987
has comment: http://stackoverflow.com/comment/30994304
favorite count: 0
has comment: http://stackoverflow.com/comment/30995105
type: UnansweredQuestion
upvote count: 1
tagged with: quicksort
has comment: http://stackoverflow.com/comment/30994988
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20695350
tagged with: algorithm

http://stackoverflow.com/a/20836600
has comment: http://stackoverflow.com/comment/31273186
answers question: http://stackoverflow.com/q/20836489
has comment: http://stackoverflow.com/comment/31279851
score: 0
has body: Make sure your layout files are having without errors and also check this one in your activity/fragment import com.org.packagename.R;
type: Answer

http://stackoverflow.com/a/20745547
has comment: http://stackoverflow.com/comment/31086801
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31087293
has comment: http://stackoverflow.com/comment/31087368
has comment: http://stackoverflow.com/comment/31086494
has comment: http://stackoverflow.com/comment/31086606
score: 0
has body: Use a interface as a callback to the activity GetXmlTask task = new GetXmlTask(ActivityName.this, "http://www.3pi.tf/test.xml"); Then in GetXmlTask ReturnData mCallback; public GetXmlTask(Context context, String url) { // Constructor in asynctask this.url = url; mCallback = (ReturnData)context; } Then public interface ReturnData { public void Returnxml(String xml); } In doInbackground you return THEXML return THEXML; In onPostExecute @Override public void onPostExecute(String result) { super.onPostExecute(result); if(mCallback!=null) { mCallback.Returnxml(result); } } In MainActivity implement the interface public class MainActivity extends Activity implements ReturnData { Then public void Retunxml(String data) { textView1.setText(data); }
has comment: http://stackoverflow.com/comment/31087187
has comment: http://stackoverflow.com/comment/31086426
has comment: http://stackoverflow.com/comment/31086891
has comment: http://stackoverflow.com/comment/31086917
type: Answer
has comment: http://stackoverflow.com/comment/31086644
has comment: http://stackoverflow.com/comment/31087261
accepted answer of: http://stackoverflow.com/q/20745440
has comment: http://stackoverflow.com/comment/31086493
answers question: http://stackoverflow.com/q/20745440
has comment: http://stackoverflow.com/comment/31087154
has comment: http://stackoverflow.com/comment/31086830

converters
tags question: http://stackoverflow.com/q/20694164
tag name: converters
type: Tag

size
type: Tag
tags question: http://stackoverflow.com/q/20748677
tag name: size
tags question: http://stackoverflow.com/q/20767290
tags question: http://stackoverflow.com/q/20742001
tags question: http://stackoverflow.com/q/20834414

http://stackoverflow.com/a/20761135
has body: This code will retrive all contactDetails of all contact Inside ContactList public class MainActivity extends Activity { TextView textDetail; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textDetail = (TextView) findViewById(R.id.textView1); readContacts(); } public void readContacts() { StringBuffer sb = new StringBuffer(); sb.append("your contacts"); ContentResolver content = getContentResolver(); Cursor c = content.query(ContactsContract.Contacts.CONTENT_URI, null,null, null, null); String phone = null; String emailContact = null; String emailType = null; String name = null; if (c.getCount() &gt; 0) { while (c.moveToNext()) { String id = c.getString(c.getColumnIndex(ContactsContract.Contacts._ID)); name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); if (Integer.parseInt(c.getString(c .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) { System.out.println("ContactName : " + name + ", ID : " + id); sb.append("\n Contact Name:" + name); Cursor phoneno = content.query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { id }, null); while (phoneno.moveToNext()) { phone = phoneno.getString(phoneno.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); sb.append("\n Phone number:" + phone); System.out.println("phone" + phone); } phoneno.close(); Cursor emailid = content.query( ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?", new String[] { id }, null); while (emailid.moveToNext()) { emailContact = emailid.getString(emailid.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); emailType = emailid.getString(emailid.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE)); sb.append("\nEmail:" + emailContact + "Email type:" + emailType); System.out.println("Email " + emai…
answers question: http://stackoverflow.com/q/20758354
has comment: http://stackoverflow.com/comment/31146999
type: Answer
score: 0

jscrollpane
tags question: http://stackoverflow.com/q/20724849
tag name: jscrollpane
tags question: http://stackoverflow.com/q/20702013
tags question: http://stackoverflow.com/q/20755234
type: Tag
tags question: http://stackoverflow.com/q/20836109
tags question: http://stackoverflow.com/q/20750049
tags question: http://stackoverflow.com/q/20681352
tags question: http://stackoverflow.com/q/20713631

http://stackoverflow.com/a/20755487
score: 4
accepted answer of: http://stackoverflow.com/q/20755234
has comment: http://stackoverflow.com/comment/31104997
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20755234
type: Answer
has comment: http://stackoverflow.com/comment/31104755
has comment: http://stackoverflow.com/comment/31105053
upvote count: 4
has body: You state: As the question states, I'm having trouble with updating the text of a JTextArea that is inside of a JScrollPane. I am able to grab the text from the typecasted getView() of the JScrollPane. However, I have tried the following to update the JTextArea. ((JTextArea)(chatWindow.getViewport().getView())).setText("Hello!"); Why go through all of this fragile code gymnastics? Much simpler, safer and easier would be to create a class level JTextArea instance field that is then displayed in your GUI in a JScrollPane, and simply obtain text or set text on that instance. No muss, no fuss, no bugs. If this cannot be done with your current program, then you've not yet told us enough that would suggest otherwise, and you will need to tell us much more. Edit Replies to your comments: have variables referencing both the JTextArea and the JTextField (just to try and figure this out) but even if I change either variable using one of the appropriate ways I described above, the contents inside of the JTextArea still won't change. Unless I'm not understanding what you're saying? Then this suggests that while you might be working the correct variable, perhaps you're working on the wrong reference. Perhaps the variables you're working with are not held in the GUI that is currently displayed. But this is all nothing but SWAG-work (silly wild-ass guess-work). Please don't force us to guess -- edit your original post and show us your code, best an sscce, show us how you're getting your handle to these variables and how you know that they belong to the displayed gui. Edit 2 Regarding your latest code. Let's look at this line: public static JTextArea chatWindowInsert; This field should not be static, and of this I am 100% certain. Where do you add any object that this field eventually refers to, to your GUI? I can't find this anywhere in your posted code. Edit 3 I see now that you put a completely different JTextField into a JScrollPane, never put it into the GUI anywhere, and do a…

http://stackoverflow.com/q/20776787
has title: How to Use Method from a Class that has been Passed in as a Variable
has comment: http://stackoverflow.com/comment/31142082
has answer: http://stackoverflow.com/a/20776838
linked to: http://stackoverflow.com/q/9554636
score: 0
answer count: 2
tagged with: compiler-errors
type: UnansweredQuestion
tagged with: swing
has body: I have JLabels in multiple JFrames, and all of them serve the purpose of being a status indicator. In the class Controller, I have a method that changes the JLabel in the given JFrame. My question is that how do I reference the JFrame as a variable? import javax.swing.*; public class Controller { public static class Status { public static void vPrint(JFrame frame, String text) { JLabel label = frame.getConsoleLabel(); label.setText(text) } } } So when I call it in the JFrame: Controller.Status.vPrint(this, "Set the JLabel Text."); All of the JFrames have the method getConsoleLabel() The problem is that when I call it, it says: cannot find symbol: method and I think the cause is that the variable frame isn't referenced. Any solutions?
tagged with: java
has answer: http://stackoverflow.com/a/20776817
type: Question

http://stackoverflow.com/comment/31070485
has text: I don't have enough points to add it.
score: 0
comment on: http://stackoverflow.com/q/20736442
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31182329
type: AnswerComment
type: Comment
has text: I have set enableHighAccuracy:true
comment on: http://stackoverflow.com/a/20799406
score: 0

http://stackoverflow.com/q/20778798
type: Question
answer count: 2
has title: Input probs in fantasy test game
score: 0
has answer: http://stackoverflow.com/a/20778819
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31145856
has answer: http://stackoverflow.com/a/20779675
has body: I tried making a simple game... but I encountered this problem where when I say "no" to anything, I have to type it in twice for it to actually work... Here's an example. will you attack? (yes(y) or no(n)) input: n input: n If you won't attack, will you use magic? import java.util.Random; import java.util.Scanner; public class ZeNiMiGame { public static Scanner sc = new Scanner(System.in); public static String name; public static String Class; public static String mon; public static int monhealth; public static int monattack; public static int health = 600; public static int mana = 150; public static Random r = new Random(); public static void main(String[] args) { Story(); PowerTable(); Fight(); } public static void Story() { System.out.println("Hello, warrior! What's your name?"); name = sc.next(); System.out.println("So your name is "+name+"... Well, I'm your Guide for this game.\n You can call me Vestibulum magna ipsum ducem, or magna ipsum ducem for short."); try{ Thread.sleep(5000); }catch (InterruptedException ex) { } System.out.println("Right now, we are traveling to the forgotten forest. Look! We're almost there!"); try{ Thread.sleep(5000); }catch (InterruptedException ex) { } System.out.println("Arrives at The Forgotten Forest"); try{ Thread.sleep(2000); }catch (InterruptedException ex) { }System.out.println("Look! An Orc! What do we do?"); mon = "Orc"; monhealth = 500; monattack = r.nextInt(30)+20; try{ Thread.sleep(3000); }catch (InterruptedException ex) { }System.out.println("An Orc has appeared before you! Will you fight? Well, you really have no choice... FIGHT!"); } public static void magic() { System.out.println("You can use 3 types of magic. Heal(h)\nApollo's Arrows(a), and the classic Fireball(f)"); System.out.println("Will you use Heal?(yes(y) or no(n))"); if(sc.next().equalsIgnoreCase("y")) { System.out.println("You used: Heal"); health = health+100; mana = mana-50; System.out.println("You healed yourself by 100 health using 50 mana."); }else if…
tagged with: java

http://stackoverflow.com/q/20744281
tagged with: android
has answer: http://stackoverflow.com/a/20744352
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/20745567
has answer: http://stackoverflow.com/a/40101052
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/40101052
has body: I am attempting to parse an XML file from Resources. After I have the file parsed I intend to perform some XPATH functions on it. The code I have is : Resources res = getResources(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = null; Document doc = null; XPathExpression expr = null; try { builder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { doc = builder.parse(res.getResourceName(R.xml.cdatest01)); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } When debugging the code throws an IOException error in the parse statement. The logcat shows the error as java.net.MalformedURLException: unknown protocol: com.apps4care.mycarerecord Any clues as to what I am doing wrong...
type: Question
has title: Parsing XML file from resources
accepted answer: http://stackoverflow.com/a/20745567
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/31083729
answer count: 3

http://stackoverflow.com/comment/31095841
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20734698
score: 0
has text: @khmarbaise: Sorry, I didn't found this option in Eclipse. Did I misunderstood something?

http://stackoverflow.com/comment/31208625
comment on: http://stackoverflow.com/q/20813848
type: QuestionComment
has text: Then What is Your Question?
type: Comment
score: 0

http://stackoverflow.com/comment/31126201
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20767708
has text: What are you using that won't let you convert the returned value to an int? (it should be a float).

http://stackoverflow.com/a/20807878
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/20807669
upvote count: 1
has comment: http://stackoverflow.com/comment/31197543
has body: First check you declared your object in onCreate method from Activity or Fragment.etc.. And if you want to check that the object is not null when the onResume method is called you it should looks like this. Remember it will be null in else because you said if that its not null do that, else its null set email not available but the problem is that in else the variable doesnt have a reference in others words its null, you should also check why your variable its null at that point. if (EMAIL != null) { tvEmail.setText("E-mail: " + EMAIL); } else { tvEmail = (TextView)findViewById(id); tvEmail.setText("E-mail: No Email Available"); } Edited This is not the best option you should go because you'll create a new object on onResume everytime it's called. You should check why the variable is null before onResume is called.

http://stackoverflow.com/comment/31206737
has text: yes it is running Yagnesh. we can use only FileOutputStream. Can we use Bufferedwriter for the same?
comment on: http://stackoverflow.com/a/20811517
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31081582
type: QuestionComment
has text: Your android system cannot access "C:\\Users\\John\\Desktop\\try.txt".. You can put it under "raw" folder and access it
comment on: http://stackoverflow.com/q/20743025
score: 0
type: Comment

http://stackoverflow.com/comment/31045316
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20722927
has text: your "111..." is bigger then the max value of int? try Long.parseLong

http://stackoverflow.com/q/20772783
upvote count: 1
has answer: http://stackoverflow.com/a/20772796
has comment: http://stackoverflow.com/comment/31135191
has comment: http://stackoverflow.com/comment/31134976
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: eclipse
type: Question
has title: Fail to read file and parse with gson when the program packaged as jar
has body: So I am using json to store some data in a txt file. And I use Gson to tackle json. The program went well in eclipse. But when I packaged it into a jar, problem occrurs. What I did first (in eclipse) is: String gsonStr = gson.toJson(masterShips); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter("D:\\master_ship.txt")); writer.write(gsonStr); } catch (IOException e) { System.err.println(e); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { System.err.println(e); } } } Then I copied the .txt file to eclipse and read it using this code: Scanner in = new Scanner(new FileReader("master_ship.txt")); String str = in.nextLine(); Log.toDebug(str); in.close(); JsonParser parser = new JsonParser(); JsonElement je = parser.parse(str); JsonArray ja = je.getAsJsonArray(); for (int i=0; i&lt;ja.size(); ++i) { ... } But when I put the .jar file and the .txt file in the same folder and excute, error appear. I thought there may be problems with the way of defining the path. Finally I turned to absolute path: Scanner in = new Scanner(new FileReader("D:\\master_ship.txt")); Still, it works well in eclipse, but not when using jar. Then I opened the jar with command line: Exception in thread "main" com.google.gson.JsonSyntaxException: com.google.gson. stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malform ed JSON at line 1 column 4 at com.google.gson.JsonParser.parse(JsonParser.java:65) at com.google.gson.JsonParser.parse(JsonParser.java:45) at kan.util.Master.loadMasterShip(Master.java:44) at kan.util.Master.load(Master.java:27) at kan.Main.main(Main.java:22) Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLeni ent(true) to accept malformed JSON at line 1 column 4 at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1386) at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:531) at c…
has comment: http://stackoverflow.com/comment/31135033
tagged with: jar
has comment: http://stackoverflow.com/comment/31134829
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31134879
favorite count: 0
has comment: http://stackoverflow.com/comment/31134906
linked to: http://stackoverflow.com/q/5052311
type: UnansweredQuestion
tagged with: embedded-resource

http://stackoverflow.com/comment/31089738
comment on: http://stackoverflow.com/q/20747529
type: Comment
type: QuestionComment
has text: Does it print to a control in a window or to the console?
score: 0

http://stackoverflow.com/a/20685594
accepted answer of: http://stackoverflow.com/q/20685489
upvote count: 2
answers question: http://stackoverflow.com/q/20685489
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: Do this: class Book { private String title; private String author; private String yearofPub; Book(String input) { title = input; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getYearofPub() { return yearofPub; } public void setYearofPub(String yearofPub) { this.yearofPub = yearofPub; } } And in your main method, you can: Book titleofBook = new Book(nextLine); titleofBook.setAuthor(...)

http://stackoverflow.com/comment/31084102
score: 1
type: AnswerComment
has text: A dependency with the scope "compile" does not mean that you will actually compile it. It only means that the artifact is required for you to compile your project. It is also included in the war file if you do a "mvn package". The compile scope is the default scope, by the way.
type: Comment
comment on: http://stackoverflow.com/a/20741081

http://stackoverflow.com/comment/31229181
comment on: http://stackoverflow.com/q/20824943
type: Comment
type: QuestionComment
has text: If it works correctly both ways then you should delete the entire declaration because you are not using it.
score: 1

http://stackoverflow.com/comment/31047541
type: Comment
comment on: http://stackoverflow.com/a/20715127
type: AnswerComment
has text: @user3124548: see edit to answer. Now you see why it is important to post your latest code rather than tell us it's not working without showing us. Luck!
score: 0

http://stackoverflow.com/q/20767518
accepted answer: http://stackoverflow.com/a/20767570
answer count: 1
tagged with: user-interface
downvote count: 0
has title: Java - JFormattedTextField AddActionListener
favorite count: 0
has body: I've been learning a bit more related to Java GUIs. However, I've encountered an problem and am unsure of how to fix it. I have a part of my program (displayed below, but irrelevant code has been removed), and everything aside from the JFormattedTextField variable (sliderField) works. What I am trying to do is make it so if a value is typed into sliderField that is greater than 5000, and the panel refreshes (already done elsewhere), the field will change to 5000. However, for some reason, actionPerformed doesn't seem to register any sort of change in my JFormattedTextField, also preventing the variable from being changed. Here is my code: public class testMenu extends JPanel implements ActionListener, ChangeListener { public testMenu(GUI p) { parent = p; setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0)); createPanel(); setVisible(true); } public void createPanel() { createOptions(); } private void createOptions() { options[0] = new JPanel(); add(options[0]); options[1] = new JPanel(); add(options[1]); options[2] = new JPanel(); add(options[2]); options[3] = new JPanel(); add(options[3]); options[4] = new JPanel(); add(options[4]); slider = new JSlider(0, 5000, 0); slider.setPaintTicks(true); slider.setValue(parent.variable); slider.addChangeListener(this); sliderField = new JFormattedTextField(NumberFormat.getInstance()); sliderField.setText(Integer.toString(parent.variable)); sliderField.setColumns(4); sliderField.addActionListener(this); options[5] = new JPanel(); options[5].add(new JLabel("Slider Value:")); options[5].add(slider); options[5].add(sliderField); options[5].setVisible(false); add(options[5]); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == sliderField) { int size = Integer.parseInt(sliderField.getText()); System.out.println(size); if (size &gt; 5000) { sliderField.setText("5000"); size = 5000; } parent.setVariable("" + size); } } private GUI parent; private JSlider slider; private JFormattedTextField sliderField; private…
upvote count: 2
has answer: http://stackoverflow.com/a/20767570
has comment: http://stackoverflow.com/comment/31126160
tagged with: swing
score: 2
tagged with: actionlistener
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/31066610
has text: Sorry, I should clarify. I completely agree with the bound you have. My concern is that the logic you used to derive it only shows that it's an upper bound, so it's not a complete replacement for the math I did. It's a lot cleaner, though!
type: Comment
comment on: http://stackoverflow.com/a/20712470
score: 0
type: AnswerComment

http://stackoverflow.com/a/20738599
answers question: http://stackoverflow.com/q/20738553
downvote count: 2
has comment: http://stackoverflow.com/comment/31074246
upvote count: 1
has comment: http://stackoverflow.com/comment/31074259
has comment: http://stackoverflow.com/comment/31074137
type: Answer
has comment: http://stackoverflow.com/comment/31074205
has comment: http://stackoverflow.com/comment/31074190
has comment: http://stackoverflow.com/comment/31074069
score: -1
has body: You need manually cast result to T, like public &lt;T extends Parent&gt; T copy() { return (T) new Child(); }

http://stackoverflow.com/q/20812711
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21970793
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/37395940
favorite count: 0
has comment: http://stackoverflow.com/comment/31206933
has title: inserting data using servlets in mysql database
has answer: http://stackoverflow.com/a/20812771
accepted answer: http://stackoverflow.com/a/20812771
has body: import java.sql.*; import java.util.*; public class app1conn { String url="jdbc:mysql://localhost:3306/test",uname,password; Connection con; PreparedStatement ps; app1conn() throws SQLException{ DriverManager.registerDriver(new com.mysql.jdbc.Driver()); con= DriverManager.getConnection(url,"root",""); } public void insert (String name,String email,String age,String dob)throws Exception{ ps=con.prepareStatement(url); //ps=new con.PreparedStatement ("insert into info(name,email,age,dob) values(?,?,?,?)") ; ps.setString(1,name); ps.setString(2,email); ps.setString(3,age); ps.setString(4,dob); ps.executeUpdate(); } public Vector getData() throws SQLException{ ps=con.prepareStatement("Select * from info"); ResultSet rs=ps.executeQuery(); ResultSetMetaData rms=rs.getMetaData(); Vector data=new Vector(); while(rs.next()){ Vector temp=new Vector(); temp.add(rs.getString(1)); temp.add(rs.getString(2)); temp.add(rs.getString(3)); temp.add(rs.getString(4)); temp.add(rs.getString(5)); data.add(temp); } return data; } public Vector getDataById(String id) throws SQLException{ ps=con.prepareStatement("Select * from info where id=?"); ps.setInt(1,Integer.parseInt(id)); ResultSet rs=ps.executeQuery(); ResultSetMetaData rms=rs.getMetaData(); Vector data=new Vector(); while(rs.next()){ Vector temp=new Vector(); temp.add(rs.getString(1)); temp.add(rs.getString(2)); temp.add(rs.getString(3)); temp.add(rs.getString(4)); temp.add(rs.getString(5)); data.add(temp); } return data; } void update_info(String name,String email,String age,String dob,String id) throws SQLException{ ps=con.prepareStatement ("update info set name=?,email=?,age=?,dob=? where id=?"); ps.setString(1, name); ps.setString(2, email); ps.setString(3, age); ps.setString(4, dob); ps.executeUpdate(); } } i am trying to insert the data.. when i click on submit button.. it shows null as an output..
possible better answer: http://stackoverflow.com/a/21970793
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31206608
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/31206607

http://stackoverflow.com/q/20849034
has title: Creating and assigning values to a variable in Scala template
tagged with: scala
has comment: http://stackoverflow.com/comment/31274891
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20849482
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/20849482
has answer: http://stackoverflow.com/a/20849900
answer count: 2
tagged with: playframework
downvote count: 0
accepted answer: http://stackoverflow.com/a/20849900
favorite count: 0
has body: I have not been able to solve this specific case from the examples provided in the documentation. I create a Result: Customer customer = new Customer("James"); Order[] orders = new Order[2]; orders[0] = new Order("Apple"); orders[1] = new Order("Orange"); Content html = views.html.template.render(customer, orders); return ok(html); And my template is: @(customer: Customer, orders: Array[Order]) Welcome @customer.name! @for(order <- orders) { @order.name } Now I want to add a Boolean variable in the template, then iterate through the orders, and if Apple appears in the orders, I want to set the created variable to true. Basically I need a var that has scope throughout the whole template. Thank you. Added some pseudocode. @(customer: Customer, orders: Array[Order]) Welcome @customer.name! **** var containsApple = false; @for(order <- orders) { @order.name **** if order.name == "apple" **** containsApple = true; }
linked to: http://stackoverflow.com/q/11289261
type: AnsweredQuestion

http://stackoverflow.com/q/20689999
tagged with: java
has answer: http://stackoverflow.com/a/20690562
has title: Using .append(string1 + string 2) vs .append(string1).append(string2)
downvote count: 0
tagged with: string-concatenation
favorite count: 0
has answer: http://stackoverflow.com/a/20690192
tagged with: append
has answer: http://stackoverflow.com/a/20691474
answer count: 4
has body: I am wondering if anyone could give me an answer as to which one of these statements would perform better in java using StringBuilder object: Using .append(string1 + string 2) vs .append(string1).append(string2)
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20690121
has comment: http://stackoverflow.com/comment/30985691
has comment: http://stackoverflow.com/comment/30985880
linked to: http://stackoverflow.com/q/65668
type: Question
has comment: http://stackoverflow.com/comment/30986361
tagged with: stringbuilder

http://stackoverflow.com/comment/31271233
has text: @user3104849, `show me in simple example by using Netbean Builder.` - I gave you a simple example. I don't use an IDE to generate code for me. I write the code myself so I understand how the code works. I would rather spend time learning Swing then learning how to use an IDE.
comment on: http://stackoverflow.com/a/20846317
type: Comment
score: 0
type: AnswerComment

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/20815198

http://stackoverflow.com/comment/31023751
comment on: http://stackoverflow.com/q/20711097
type: Comment
type: QuestionComment
has text: I'm afraid this cannot be expressed with JAXB. I'd take `org.json.JSONObject`
score: 0

http://stackoverflow.com/q/20750576
tagged with: java
has answer: http://stackoverflow.com/a/20751485
type: Question
tagged with: c#
score: 0
linked to: http://stackoverflow.com/q/6846162
accepted answer: http://stackoverflow.com/a/20751485
has title: How do I programmatically create an EndPoint for use with an HttpWebRequest in a Cmdlet?
answer count: 1
tagged with: httpwebrequest
tagged with: wcf
has body: Keep in mind folks, the proxy/client WCF classes generated by SvcUtil.exe and/or Add Service Reference do NOT always work. Thus you have to do things 'by hand' / 'the hard way'. Just say'en. In fact, this is a problem I'm having. I have to talk to a web service written in Java and the WSDL it spits out is so .. fraked up, that generated code simply doesn't work. SO, I have to make the SOAP calls by using HttpWebRequest. This is no problem when you can at least have an app.config within which to set up the end point info. Naturally, in my case, I'm now trying to talk to this POS Java service within a Cmdlet, which means it's in a DLL and thus can't use an app.config. So, the question now is; how the heck do I programmatically create / use BasicHttpBinding and EndPointAddress objects (and are those even the right one's) with an HttpWebRequest?
tagged with: soap
type: AnsweredQuestion

http://stackoverflow.com/comment/31051688
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20682522
type: QuestionComment
has text: The redis is still up and running,i have a different application in perl that has no issue connecting with redis. Also i have written a small minature monitor that constantly monitors the connection count in redis. @kuporific i will try to share my code after filtering out the propriety parts

http://stackoverflow.com/comment/31029030
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20713690
type: AnswerComment
has text: @user It depends on the scope you want your variables to have. Go through [this tutorial](http://docs.oracle.com/javase/tutorial/java/javaOO/). Also, consider accepting the answer.

http://stackoverflow.com/q/20753084
tagged with: java
has answer: http://stackoverflow.com/a/20753188
upvote count: 2
tagged with: game-loop
has answer: http://stackoverflow.com/a/20753155
answer count: 3
has body: Recently, I've been getting into Java Game programming. I have learned Java before, but this is my first time with Graphics, Game Loops etc. I followed this tutorial for a Game Loop, and it's working pretty well. There is nothing wrong with it, but I just can't figure out why I am thread.sleeping the code, and whats the point of it. If anyone could explain what start, elapsed and running do, and why I am doing thread.sleep(wait) then I would be super appreciative! GAME LOOP (Remember, it works, I just don't know why): while (running) { start = System.nanoTime(); update(); draw(); drawToScreen(); elapsed = System.nanoTime() - start; wait = targetTime - elapsed / 1000000; if (wait &lt; 0) { wait = 5; } try { Thread.sleep(wait); } catch (Exception e) { Game.logger.log("ERROR! Printing Stacktrace..."); e.printStackTrace(); } } }
downvote count: 0
favorite count: 0
score: 2
type: UnansweredQuestion
tagged with: multithreading
has title: Java Game Loop Explanation
has answer: http://stackoverflow.com/a/20753133
type: Question

http://stackoverflow.com/a/20843698
has comment: http://stackoverflow.com/comment/31304525
has body: Have you tried?: Throwable thr = e.getStackTrace(); StackTraceElement[] lines = thr.getStackTrace(); And working from there. Also, take a look at the javadocs Oli linked above
upvote count: 2
answers question: http://stackoverflow.com/q/20843619
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31264298
score: 2

http://stackoverflow.com/comment/31104170
score: 0
type: AnswerComment
type: Comment
has text: definitely it would crash cause when you select more than one data it becomes an array and this function is not adapted to it
comment on: http://stackoverflow.com/a/20755026

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/20780473

http://stackoverflow.com/a/21024171
has body: Use broadcaster directly by using BroadcasterFactory and invoke broadcaster.broadcast(message,ClientB)
score: 0
answers question: http://stackoverflow.com/q/20727030
type: Answer

http://stackoverflow.com/comment/31224529
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20822315
has text: Sounds like Boolean Algebra
type: Comment

http://stackoverflow.com/comment/31056944
type: QuestionComment
comment on: http://stackoverflow.com/q/20729269
has text: I learn only from tutorials, so I did try to find out what this object is for. Couldn't understand.
score: 0
type: Comment

http://stackoverflow.com/comment/31131946
comment on: http://stackoverflow.com/q/20770916
type: Comment
score: 0
has text: saw the related post, but still cannot understand this point Any operations involving multiple keys or check-then-act that need to be atomic will not be so and additional client side locking will be required. may be an example which i can co relate to
type: QuestionComment

http://stackoverflow.com/comment/31003590
comment on: http://stackoverflow.com/a/20700083
has text: there is onClick javascript call
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31027558
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20712827
has text: Google "Android Fragments"
score: 0

http://stackoverflow.com/q/20798511
tagged with: java
has comment: http://stackoverflow.com/comment/31281570
type: Question
has comment: http://stackoverflow.com/comment/31180767
has comment: http://stackoverflow.com/comment/31185777
has comment: http://stackoverflow.com/comment/31181032
tagged with: db2
score: 0
has body: I am facing this very strange problem from past few days. My application is inserting large size XML(3 MB) into DB2 database. The XML are saved in db as CLOB. Now exactly at the point when the insertion query is executed, my SYSTEM CRASHES. The error dump says: DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1) An attempt was made to access a pageable (or completely invalid) address at an interrupt request level (IRQL) that is too high. This is usually caused by drivers using improper addresses. If i modify the code to save an empty string into the CLOB data instead of XML, everything works fine. Another strange thing is that the system does not crashes every time. At times, the application handles 1-2 same requests(same request) successfully and XML data is stored in db. But sometimes, the crash happens at the very first request. I am using Spring-Jdbc. The application is running on a windows machine. Any thoughts on this?
tagged with: spring-jdbc
tagged with: clob
answer count: 0
has title: System crashes while inserting CLOB in DB2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31181126

http://stackoverflow.com/a/20779369
type: Answer
answers question: http://stackoverflow.com/q/20779328
has body: all assignments/expressions in java have to be inside a block (except initializations) you are assigning calculate = (Button) findViewById(R.id.button1); grade = (EditText) findViewById(R.id.editText1); wantedGrade = (EditText) findViewById(R.id.editText2); finalValue = (EditText) findViewById(R.id.editText3); outside any code block, at the class level. this is wrong syntax. also you should keep in mind that even if it were allowed, your layout would not have been inflated yet and these values would have been null, so you should shift the statements to OnCreate where you first set the content view, then call these statements: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); calculate = (Button) findViewById(R.id.button1); grade = (EditText) findViewById(R.id.editText1); wantedGrade = (EditText) findViewById(R.id.editText2); finalValue = (EditText) findViewById(R.id.editText3); }
score: 0

http://stackoverflow.com/comment/30979613
comment on: http://stackoverflow.com/a/20686878
type: Comment
score: 0
has text: Ohh I really like this one. I think this is closest to what I was looking for :D :D :D
type: AnswerComment

http://stackoverflow.com/comment/31067360
comment on: http://stackoverflow.com/q/20687477
has text: Tried "MILE"... No joy.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135672121
score: 1
type: AnswerComment
has text: A good point @LeandroGomide, in fact wall clocks drift and are re-synced periodically to a more reliable time source for this reason. This can be incorporated in the initial solution, since detecting significant drifts is indeed easy and can be used to pinpoint need to refresh the reference clock. I will incorporate you suggestions in a revised version of the code, thanks! Of course, this is still relevant for older legacy systems using Java8, in Java9+ there's a better clock as Meno Hochschild said.
type: Comment
comment on: http://stackoverflow.com/a/38658066

http://stackoverflow.com/q/20840260
accepted answer: http://stackoverflow.com/a/20840510
has answer: http://stackoverflow.com/a/20846463
has body: I have an annotation that can be added on METHOD and TYPE and is used in thousands of places in our project. @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @Target({METHOD, TYPE}) @Inherited public @interface RequiredStore{ Store value(); } Is it possible to make the annotation deprecated only on methods while keeping it non-deprecated on types? I want other developers to be notified by IDE that it should not be used on methods any more, until we'll refactor all existing usages and finally remove the METHOD part. If it's not possible, is there any Way to handle such case beside creating new annotation only for types and deprecating the old one?
favorite count: 0
score: 5
downvote count: 2
tagged with: annotations
has title: How to make annotation deprecated only on one target
type: AnsweredQuestion
tagged with: deprecated
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/20840510
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31257818
has comment: http://stackoverflow.com/comment/31258457
possible better answer: http://stackoverflow.com/a/20846463

http://stackoverflow.com/comment/31149246
comment on: http://stackoverflow.com/a/20780083
type: AnswerComment
has text: Thank you. I have successfully update the java version by giving the right path.
score: 0
type: Comment

http://stackoverflow.com/q/20705134
has comment: http://stackoverflow.com/comment/77684473
favorite count: 0
score: 2
downvote count: 0
type: UnansweredQuestion
has body: I want to supress the issues(which ever i want) fortify shows on the report in java files either by annotations or other means. like we supress PMD issues using @supressWarnings(PMD.XXX)
has answer: http://stackoverflow.com/a/20975158
tagged with: java
tagged with: fortify
has title: How to supress HP Fortify critical issues in java code
type: Question
upvote count: 2
answer count: 1

http://stackoverflow.com/a/22699914
answers question: http://stackoverflow.com/q/20810995
has body: don't know if you're still looking for this answer. In Java 8, and HTMLEditor only has one child, which is a GridPane. The first two children of that are the ToolBars, the third is a WebView. Remove the first two children from the gridpane to do the formatting you want. Does that help?
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/110564132

http://stackoverflow.com/q/20705901
answer count: 1
tagged with: sockets
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/20706922
accepted answer: http://stackoverflow.com/a/20706922
type: Question
has body: I have wrote a socket program where the host will receive file and client will send ( as far as I am concerned ). However, today when I checked it,I saw if I run the Host, nothing happens. But When I run the Client side, server side start prompting and asks me for file to send. and then server starts sending the file to my client pc. here is the code Server side: ServerSocket servsock = new ServerSocket(50000); Socket sock = servsock.accept(); File to_b_encf = new File("input"); OutputStream out = sock.getOutputStream(); FileInputStream fileInputStream = new FileInputStream(to_b_encf); byte[] buffer = new byte[64 * 1024]; int bytesRead = 0; while ((bytesRead = fileInputStream.read(buffer)) != -1) { if (bytesRead &gt; 0) { out.write(buffer, 0, bytesRead); totalSent += bytesRead; System.out.println("sent " + totalSent); } } sock.close(); servsock.close(); fileInputStream.close(); Client Side Code: Socket sock = new Socket("172.16.27.106", 50000); InputStream in = sock.getInputStream(); Scanner sc = new Scanner(System.in); System.out.print("File path: "); String output = sc.nextLine(); sc.close(); File fileName = new File(output); fileOutputStream = new FileOutputStream(output); // sending the actual file byte[] buffer = new byte[64 * 1024]; bytesRead = 0; while ((bytesRead = in.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, bytesRead); totalRecieved += bytesRead; } sock.close(); fileOutputStream.close(); Now, I have another question apart from whats wrong with my file sending and file receiving. I want to send file from one laptop to another without the help of any router or LAN connection. So, I guess I will need an Application Specific Network. What will be the best or secure application specific network? Does Java provide any library for application specific network? By the way, I have no idea regarding this field. It is not my current concern of the project. Just for a heads up actually. Thank you.
has comment: http://stackoverflow.com/comment/31015125
score: 0
tagged with: file-transfer
has title: Socket Programming - Client-Host is working alternative

http://stackoverflow.com/a/20760278
type: Answer
has body: As others have mentioned, the behaviour is an implementation detail. One way to find out is to only reference the String using a WeakReference then force a garbage collection and see if the WeakReference has been cleared. Here's some example code: // Only keep a weak reference to a String str = "a"; WeakReference&lt;String&gt; strRef = new WeakReference&lt;String&gt;(str); str = null; // Attempt to force GC Object obj = new Object(); WeakReference&lt;Object&gt; ref = new WeakReference&lt;Object&gt;(obj); obj = null; while(ref.get() != null) { System.gc(); } // Wait a bit a second to make sure GC has actually run Thread.sleep(1000); // Print the result if (strRef.get() == null) { System.out.println("String \"a\" has been garbage collected"); } else { System.out.println("String \"a\" has not been garbage collected"); } On my machine using JavaSE-1.7 the String is not garbage collected.
answers question: http://stackoverflow.com/q/20759652
score: 0

http://stackoverflow.com/a/20714203
type: Answer
answers question: http://stackoverflow.com/q/20714058
has body: From the File 'listFiles' method documentation: Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs. So perhaps an I/O error occurred. Check the permissions on that directory, does the user running the java program have the permission to read that directory? If not, there is your answer. If they do, then perhaps the directory is empty. BTW you should not use +"" to convert something to a string, it's a bad practice since it's slower than String.valueOf. I would use apache's StringUtils to join that array into a string, but that requires adding that jar to your classpath.
upvote count: 9
downvote count: 0
score: 9

http://stackoverflow.com/comment/31178407
score: 0
type: Comment
type: QuestionComment
has text: @bartosz klimek what u mean? maybe the specification wants it. Beside why you people do not search first to see if you can find any answer and after that post up ur error code?
comment on: http://stackoverflow.com/q/20797281

http://stackoverflow.com/q/20798011
tagged with: build.gradle
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/20799317
has body: I have created a jar file using gradle. How to add supporting file to this jar file My file structure is common\src\com\sp\ in this I have a java file common\src\bundle in this I have a property file my build.gradle is in common package I have run my gradle I got jar file I have extract a jar file I have class file only I didn't get a property file how to get property files in my gradle my buld.gradle is given bellow apply plugin: 'java' sourceCompatibility = '1.7' targetCompatibility = '1.7' dependencies { compile files ('lib/commons-codec-1.8.jar') compile files ('lib/trinidad-api.jar') compile files ('lib/javax.ejb_3.0.1.jar') compile files ('lib/toplink-grid.jar') compile files ('lib/trinidad-impl.jar') compile files ('lib/javax.servlet_1.0.0.0_2-5.jar') compile files ('lib/javax.jsp_1.2.0.0_2-1.jar') compile files ('lib/adfm.jar') compile gradleApi() compile localGroovy() } sourceSets { main { java { srcDirs = ['src'] } } }
answer count: 1
tagged with: jar
has title: How to add supporting file in jar using gradle script

http://stackoverflow.com/a/20806835
has body: Try a frame by frame animation with one frame consisting the picture to be displayed and other frame consisting of a blank transparent picture. Set duration for the picture frame to whatever ms of time your want. Running the animation will flash the picture once, provided you set android:oneshot="true" in animation list's definition. http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31216712
downvote count: 0
has comment: http://stackoverflow.com/comment/31230417
has comment: http://stackoverflow.com/comment/31208494
answers question: http://stackoverflow.com/q/20806590
type: Answer
has comment: http://stackoverflow.com/comment/31230130
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/20806590
has comment: http://stackoverflow.com/comment/31218965

http://stackoverflow.com/comment/31106163
comment on: http://stackoverflow.com/q/20756357
has text: if it is it's because it's greater than 6.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31219146
comment on: http://stackoverflow.com/a/20808264
type: Comment
type: AnswerComment
has text: Actually, there's something referencing the ImageAdapter called "ImageAdapter$2 @ 0x4224c1c8 Thread-1702 Unknown" but I have no idea what this is supposed to mean.
score: 0

http://stackoverflow.com/q/20753407
has title: Java memory: where are the references coming from?
has comment: http://stackoverflow.com/comment/31101342
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/20754645
has comment: http://stackoverflow.com/comment/31101390
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20754645
score: 0
has body: I have a Java program that is using a lot of memory. I used jmap -histo:live to track down the objects that are using all the memory. There are only a couple of types that are using up most of the memory, there are > 1M of them, but I can't tell where the references are coming from. Is there any way to tell from the command line what types of objects are holding references to these? Thanks!
type: Question
tagged with: jmap
tagged with: java
tagged with: profiling
answer count: 1

http://stackoverflow.com/comment/31188916
type: Comment
comment on: http://stackoverflow.com/a/20800057
score: 0
type: AnswerComment
has text: Okay so I actually have to print it? So it isn't like Python where you can just 'return' a value?

http://stackoverflow.com/a/20774868
has body: You can use scrptlets or expression . For learning more , refer link For Date Formatting (Till Java7) : You can use Simple DateFormat format codes . <% Date dNow = new Date( ); SimpleDateFormat ft =new SimpleDateFormat ("MM/dd/yyyy hh:mm a"); %>
downvote count: 0
has comment: http://stackoverflow.com/comment/31138413
answers question: http://stackoverflow.com/q/20774765
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/a/57233209
score: 1
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/20837856
has body: Same issue: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.UUID` out of START_OBJECT token What caused it was the following: ResponseEntity&lt;UUID&gt; response = restTemplate.postForEntity("/example/", null, UUID.class); In my test I purposely set the request as null (no content POST). As previously mentioned, the cause for the OP was the same because the request didn't contain a valid JSON, so it couldn't be automatically identified as an application/json request which was the limitation on the server (consumes = "application/json"). A valid JSON request would be. What fixed it was populating an entity with null body and json headers explicitly. HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity request = new HttpEntity&lt;&gt;(null, headers); ResponseEntity&lt;UUID&gt; response = restTemplate.postForEntity("/example/", request, UUID.class);

http://stackoverflow.com/comment/31191991
comment on: http://stackoverflow.com/a/20804887
has text: @arshajii I mentioned that because obviously the intention was to modify it hence the use of ***besides of that***
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31247962
has text: Then how will the JVM differentiate b/w the variables "i" in Demo and Test classes.. I a using "this" on both occassions, then I must be getting the same result...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20834647
type: AnswerComment

http://stackoverflow.com/q/20823527
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/850878
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31226628
linked to: http://stackoverflow.com/q/15492643
tagged with: data-structures
has body: Let me first premise my question with the fact that I am learning programming/data structures. Yes, I know that Java has a collections API to do what I am coding, but for the moment, I would rather learn the basic ideas first. I am coding an ArrayList implementation and am curious about garbage collection when references become obsolete. So in my case I have a generic object array i.e E[] data = (E[]) new Object[size]; and have a method E set(int index, E item) which will replace the data[index] with item. Here is my method body: public E set(int index, E item) { if(index&lt;0||index&gt;size-1) throw new IndexOutOfBoundsException(); //Not relevant to question E previousValue = data[index]; data[index]=null; data[index]=item; return previousValue; } On to my question. Is it necessary to make the object null even if it the index is going to be reassigned. It seems like I should, but the code looks redundant to me. Or if am correct, is there a less redundant looking way to code this? I would really appreciate more than a single sentence answer, I'm really curious about this topic.
tagged with: arraylist
upvote count: 2
has answer: http://stackoverflow.com/a/20823555
accepted answer: http://stackoverflow.com/a/20823555
answer count: 2
possible better answer: http://stackoverflow.com/a/20823569
downvote count: 1
has answer: http://stackoverflow.com/a/20823569
favorite count: 0
has comment: http://stackoverflow.com/comment/31226594
has title: Is it necessary to set obsolete references null when they will get reassigned?

http://stackoverflow.com/comment/31031145
type: QuestionComment
has text: yah, i've tried, but the compile shows that error : The method setListData(Object[]) in the type JList is not applicable for the arguments (List)... thanks for posts...
comment on: http://stackoverflow.com/q/20714489
score: 0
type: Comment

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

http://stackoverflow.com/comment/31288065
has text: @NikosParaskevopoulos interesting method, but the variable **map** returns only this `Content-Disposition: form-data; name="uploadfile[]"; filename}` and as a result I cannot use `map.get("id")`, which could be a solution to my problem.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20827284
score: 0

http://stackoverflow.com/comment/31047531
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20723827
has text: plz check my comment in for loop

http://stackoverflow.com/comment/31005778
has text: In the else part `map.put(tokens[1], list);` is not required.
type: Comment
comment on: http://stackoverflow.com/a/20701489
score: 0
type: AnswerComment

http://stackoverflow.com/q/20796334
has answer: http://stackoverflow.com/a/20796418
accepted answer: http://stackoverflow.com/a/20796418
tagged with: java
type: Question
has body: Let, I have two classes FishType and Fish FishType is an enumeration of standard fish classifications, including the following members: { Shark, Ray, Eel, } Fish class is: Name : String Classificiation : FishType So basically, I wanna declare property for "Fish" of 'FishType' enum class how it can be done in java?
has title: enum class declaration and use of this into another class
has comment: http://stackoverflow.com/comment/31176751
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/20796460
possible better answer: http://stackoverflow.com/a/20796419
has comment: http://stackoverflow.com/comment/31176767
has answer: http://stackoverflow.com/a/20796419
type: AnsweredQuestion
tagged with: enums

http://stackoverflow.com/comment/31128866
has text: Nope don't do that, I was confused at what you were doing, do String.format("%d... so something like this String.format("%d.2f ", beta(j));
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20769040

http://stackoverflow.com/comment/31245687
has text: @Bohemian: The term "pass-by-reference" has a specific meaning: Passing a reference to **the variable** into a function/method, so that you can change **the variable**. It's completely unrelated to object references. Saying anything in Java is "pass-by-reference" is always incorrect, and tends to be misleading. If Java had pass-by-reference, you could have an `int n`, make the call `foo(n)`, and `foo` could change the value of `n`. (Or `Object o`, `foo(o)`, and `foo` could point `o` at a *different* object.) That does not exist in Java.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20833402
type: Comment

http://stackoverflow.com/comment/30979589
comment on: http://stackoverflow.com/q/20686800
score: 0
type: Comment
has text: Yea i did, but for some reason it adds only the last node from the linked list.
type: QuestionComment

http://stackoverflow.com/a/20821321
accepted answer of: http://stackoverflow.com/q/20808490
has body: If the resource resides in a an assets folder within the classpath, then you need to add this to the resource identifier (i.e. filename &amp; path), e.g. assets/test_map.tmx. It may work in the IDE because the current working directory is different then than when the program is running from the JAR. When run from the JAR it is impossible to have a working directory within the JAR as it is only a file. When run from the IDE the JAR is not constructed yet, every single resource exists as a file in the file system, a working directory e.g. at the classes folder is possible. Thus it is possible to have different behaviour when running from IDE or from JAR and relying on specific or implicit environment like the working directory.
answers question: http://stackoverflow.com/q/20808490
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/20795953
has comment: http://stackoverflow.com/comment/31179702
upvote count: 3
tagged with: android
linked to: http://stackoverflow.com/q/16752073
has comment: http://stackoverflow.com/comment/31176035
downvote count: 1
answer count: 4
favorite count: 0
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/20796122
has answer: http://stackoverflow.com/a/20796088
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/20790390
has answer: http://stackoverflow.com/a/20796122
has answer: http://stackoverflow.com/a/20796163
tagged with: java
possible better answer: http://stackoverflow.com/a/20796021
has answer: http://stackoverflow.com/a/20796021
type: Question
has body: MainActivity.java: private class NetCheck extends AsyncTask&lt;String, Void, Boolean&gt; { @Override protected Boolean doInBackground(String... args) { return cd.isConnectingToInternet(); } protected void onPostExecute(Boolean th) { if (th == true) { new RemoteLoader(MainActivity.this).execute(); } } } RemoteLoader.java: public class RemoteLoader extends AsyncTask&lt;Void, Void, Void&gt;{ private View view; public RemoteLoader(View context){ this.view = view; } @Override protected Void doInBackground(Void... Pages) { // do in bg } @Override protected void onPostExecute(Void result) { // Set title into TextView TextView txttitle = (TextView) view.findViewById(R.id.txtProtip); txttitle.setText(protip); } } I'm trying to execute RemoteLoader class from MainActivity. But in RemoteLoader contains something that needs to inflate the Main layout. How do I pass the Layout from MainActivity to RemoteLoader in this case?
has comment: http://stackoverflow.com/comment/31176001
has title: Android - Passing View from Activity to AsyncTask class
has comment: http://stackoverflow.com/comment/31176058

matrix
tags question: http://stackoverflow.com/q/20700124
tag name: matrix
tags question: http://stackoverflow.com/q/20772811
tags question: http://stackoverflow.com/q/20708659
tags question: http://stackoverflow.com/q/20767397
tags question: http://stackoverflow.com/q/20830304
tags question: http://stackoverflow.com/q/20817665
type: Tag

http://stackoverflow.com/comment/31269678
score: 0
type: Comment
has text: You might still need to specify JFrame even when extending JFrame, but a static import is another time in which you would not need to specify the JFrame class.
type: AnswerComment
comment on: http://stackoverflow.com/a/20846514

http://stackoverflow.com/q/20774620
tagged with: java
has body: in my Android app I use MediaPlayer and SeekBar. I'd like to update the seekbar automatically, when something plays. I've got this code, but it lags every 1 second. Ive got a suspicion that it should run in a different thread, but I have no idea how to write it. Thanks in advance. private void startPlayProgressUpdater() { seekBar.setProgress(mediaPlayer.getCurrentPosition()); if (mediaPlayer.isPlaying()) { Runnable notification = new Runnable() { public void run() { startPlayProgressUpdater(); } }; handler.postDelayed(notification, 1000); } else { mediaPlayer.pause(); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20775939
has title: MediaPlayer is lagging while using Handler
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/31140253
score: 0
accepted answer: http://stackoverflow.com/a/20775939
tagged with: multithreading
answer count: 1

http://stackoverflow.com/q/20778955
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31149098
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: windows
has title: Eclipse crashing on startup(eclipse.exe has stopped working),any solution?
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/29096134
type: Question
has comment: http://stackoverflow.com/comment/31149388
has body: Crash Report : Problem signature: Problem Event Name: APPCRASH Application Name: eclipse.exe Application Version: 0.0.0.0 Application Timestamp: 4fad6d40 Fault Module Name: eclipse.exe Fault Module Version: 0.0.0.0 Fault Module Timestamp: 4fad6d40 Exception Code: c0000005 Exception Offset: 00075400 OS Version: 6.1.7600.2.0.0.256.1 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&amp;clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\system32\en-US\erofflps.txt **Eclipse.ini file** : -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807 -product com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256M -showsplash com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx256m -Xmx256m -Declipse.buildId=v22.3.0-887826 -XX:MaxPermSize=256M
has comment: http://stackoverflow.com/comment/31147355
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31148761

http://stackoverflow.com/q/20703898
tagged with: java
has body: I need to pass a list of objects (like a table of values) from java to oracle 8i. I am trying with the below database objects in oracle 8i. Is this possible in 8i? Please help me with a solution if possible. create or replace type GROUP_OBJ as object ( GROUP_TYPE VARCHAR2(32), PARAM_1 VARCHAR2(16), PARAM_2 VARCHAR2(16) ); / CREATE OR REPLACE TYPE GROUP_table AS TABLE OF GROUP_OBJ; / CREATE OR REPLACE PROCEDURE GROUP_TABLE_TEST (TABLE_OBJ IN GROUP_table) IS BEGIN null; EXCEPTION WHEN OTHERS THEN ROLLBACK; END GROUP_TABLE_TEST;
has title: Pass table of object type from java to oracle 8i
type: Question
has answer: http://stackoverflow.com/a/20719708
score: 0
answer count: 1
tagged with: oracle8i
accepted answer: http://stackoverflow.com/a/20719708
tagged with: parameters
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/q/20771318
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/20771538
type: AnsweredQuestion
has title: how to parse a file.html with jsoup in java
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: i have file.html,i want to open it and extract the links with jsoup library and show those links in the out put of my program how can i use this library to do this??? String html = " First parse " + " Parsed HTML into a doc. "; Document doc = Jsoup.parse(html); i want to do some thing like that,i want that file.html as String and extract the links of that
score: 0
tagged with: jsoup
answer count: 1
accepted answer: http://stackoverflow.com/a/20771538
tagged with: parsing
favorite count: 0

http://stackoverflow.com/comment/79706239
comment on: http://stackoverflow.com/a/46372147
type: Comment
score: 0
has text: better than before.
type: AnswerComment

atomic
type: Tag
tags question: http://stackoverflow.com/q/20753401
tag name: atomic

http://stackoverflow.com/comment/31111117
type: QuestionComment
comment on: http://stackoverflow.com/q/20754727
score: 0
has text: Put a breakpoint in your `setXXX` check `propertySupport` value then you will know for sure. Also note that `propertySupport` cannot be a column and something you instantiate in the constructor.
type: Comment

http://stackoverflow.com/comment/31148761
score: 0
type: Comment
type: QuestionComment
has text: Still the same problem
comment on: http://stackoverflow.com/q/20778955

http://stackoverflow.com/comment/31176751
has text: Fish is a class and FishType should be enum.
comment on: http://stackoverflow.com/q/20796334
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31021792
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20709304
has text: This question appears to be off-topic because it is about improving already working code. You may be able to get help on [codereview.se]
type: Comment

http://stackoverflow.com/comment/31171011
type: AnswerComment
comment on: http://stackoverflow.com/a/20793101
type: Comment
has text: A side note on that last paragraph for OP's benefit: Basically, you as the person implementing `GBinNode<T extends Comparable<T>>` are not responsible for implementing compareTo, it's the job of whoever is using your code to make sure that whatever `T` is, it already has that method implemented. Otherwise, the code won't even compile.
score: 14

http://stackoverflow.com/q/20708443
has comment: http://stackoverflow.com/comment/31018571
type: Question
has body: I have just started programming some things with Greenfoot, learning java along the way. I have become familiar on how to call certain methods between classes, and also differences between static and non-static. I'm makeing a game where you play the crab and move around to collect worms. There is a lobster that randomly roams around and if comes in contact with the crab, the crab dissapears. Every time you eat a worm, the score goes up by 10. It contains 5 classes named Crab, Lobster, Worm, Counter, and CrabWorld. For your sake, I'll just post the well documented code for you to read. But the important part that I am having trouble with is calling a method from the lobster to the Crab instance created by the CrabWorld. This method would change the lives of the crab. I have tried calling ((CrabWorld) getWorld), but I don't need to access the CrabWorld. I need to access the Crab instance (created in the CrabWorld, if that matters) from from the Lobster Class. Crabworld: import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Creates the crab Enviornment with a counter, crab and lobster. Also has methods to * place random worms in the world over time. Also has a method to add the score * To the Counter score * @author Troy Bick * @version 12/20/13 */ public class CrabWorld extends World { private Actor playerCrab = new Crab(); private Counter score = new Counter("Score: "); /** * Constructor for objects of class CrabWorld. * */ public CrabWorld() { super(560, 560, 1); prepare(); } /** * Prepare the world for the start of the program. That is: create the initial * objects and add them to the world. */ private void prepare() { addObject(score, 100, 540); addObject(playerCrab, 280, 280); addObject(new Lobster(), 100, 100); } /** * Randomly places worms at random periods */ public void act() { if(Greenfoot.getRandomNumber(100)&lt;0.5){ addObject(new Worm(), Greenfoot.getRandomNumber(540)+10, Greenfoot.getRandomNumber(540)+10); } } public void e…
score: 0
has comment: http://stackoverflow.com/comment/31018441
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/20740063
upvote count: 1
tagged with: methods
downvote count: 1
has comment: http://stackoverflow.com/comment/31018884
has comment: http://stackoverflow.com/comment/31018531
possible better answer: http://stackoverflow.com/a/20708637
has title: Calling methods from other classes java
has answer: http://stackoverflow.com/a/20708637
tagged with: class
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/20740063

http://stackoverflow.com/q/20747957
answer count: 3
has answer: http://stackoverflow.com/a/20748187
has title: How do I make a reusable small layout for android where instances of this layout create a list item on a single page
possible better answer: http://stackoverflow.com/a/20748076
tagged with: android
has answer: http://stackoverflow.com/a/20748104
accepted answer: http://stackoverflow.com/a/20748104
has answer: http://stackoverflow.com/a/20748076
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31090548
type: Question
tagged with: class
has body: I'm new to android development. I've bought a book and learned how to do most basic operations but I couldn't find out how to do exactly what I needed to make the app I'm working on right now. Basically so far I have an add button on the main screen. This takes the user to a secondary activity with forms to fill in. What I need to figure out is how to get the user entered information (once the user clicks accept) to appear as a list item on the first page with a progress bar, title, remove button, etc. The user should be able to add as many of these items to the list as they want (each with their own individual remove buttons, titles, etc). How would I generally go about doing this (what kind of classes should I use and such)? I'm not really sure where to start.
score: 0

http://stackoverflow.com/comment/31204000
has text: `Frameform form=new Frameform(); form.addPropertyChangeListener(FrameForm.BUTTON_CLICKED,listener);`What if the frame form is already auto generated by netbeans (because I use designer GUI to create the frame)? Shoul I add a new constructor with parameter to that frame?
comment on: http://stackoverflow.com/a/20802633
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31085603
type: Comment
type: AnswerComment
score: 2
has text: Since remove() is called over all the values of array, so if list will contain any value that is also present in the array, that value will be removed. I think you first figure out what are the values present in your list.Second, what are the values in the array.
comment on: http://stackoverflow.com/a/20745284

http://stackoverflow.com/q/20841416
has comment: http://stackoverflow.com/comment/31332628
upvote count: 3
tagged with: couchbase
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31262673
tagged with: java
accepted answer: http://stackoverflow.com/a/20948671
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31262660
has body: I have a Couchbase cluster with 3 nodes. I have a java process that writes to this cluster. When one of the nodes is down I'm getting this exception: 2013-12-30 14:03:23.259 WARN com.couchbase.client.CouchbaseConnection: Node expected to receive data is inactive. This could be due to a failure within the cluster. Will check for updated configuration. Key without a configured node is: 980d330b2a96656a93bd08e48e6fc759135e6e6f. Dec 30, 2013 2:03:23 PM com.couchbase.client.CouchbaseConnectionFactory resubConfigUpdate INFO: Attempting to resubscribe for cluster config updates. Dec 30, 2013 2:03:23 PM com.couchbase.client.CouchbaseConnectionFactory$Resubscriber run INFO: Reconnect attempt 1, waiting 0ms 2013-12-30 14:03:24.020 INFO com.couchbase.client.CouchbaseConnection: Reconnecting {QA sa=10.223.224.79/10.223.224.79:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} 2013-12-30 14:03:24.261 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Operation canceled because authentication or reconnection and authentication has taken more than one second to complete. 2013-12-30 14:03:24.263 WARN com.couchbase.client.CouchbaseConnection: Node expected to receive data is inactive. This could be due to a failure within the cluster. Will check for updated configuration. Key without a configured node is: 980d330b2a96656a93bd08e48e6fc759135e6e6f. 2013-12-30 14:03:25.265 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Operation canceled because authentication or reconnection and authentication has taken more than one second to complete. 441016302 [pool-5-thread-1] ERROR com.polimo.rtb.writer.CouchbaseWriter - Error while trying to write to couchbase java.util.concurrent.CancellationException: Cancelled at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:176) at net.spy.memcached.MemcachedClient.mutateWithDefault(MemcachedClient.java:1842) at net.spy.memcached.MemcachedClient.incr(MemcachedClient.java:1788…
has title: Couchbase cluster - exception when 1 node is down
downvote count: 0
has comment: http://stackoverflow.com/comment/31307841
has comment: http://stackoverflow.com/comment/31269885
favorite count: 0
possible better answer: http://stackoverflow.com/a/20951435
has answer: http://stackoverflow.com/a/20951435
has comment: http://stackoverflow.com/comment/31430391
score: 3
has answer: http://stackoverflow.com/a/20948671

http://stackoverflow.com/a/55638065
score: 15
type: Answer
answers question: http://stackoverflow.com/q/20837856
upvote count: 15
downvote count: 0
has body: Related to Eugen's answer, you can solve this particular case by creating a wrapper POJO object that contains a Collection&lt;COrder&gt; as its member variable. This will properly guide Jackson to place the actual Collection data inside the POJO's member variable and produce the JSON you are looking for in the API request. Example: public class ApiRequest { @JsonProperty("collection") private Collection&lt;COrder&gt; collection; // getters } Then set the parameter type of COrderRestService.postOrder() to be your new ApiRequest wrapper POJO instead of Collection&lt;COrder&gt;.

http://stackoverflow.com/a/20818681
has comment: http://stackoverflow.com/comment/31218529
answers question: http://stackoverflow.com/q/20818552
has comment: http://stackoverflow.com/comment/31217914
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31218899
has comment: http://stackoverflow.com/comment/31218413
accepted answer of: http://stackoverflow.com/q/20818552
has comment: http://stackoverflow.com/comment/31218377
has body: You need to instantiate UserInfo inside the Output class before you can use the addUser list that's in UserInfo. Then just call the getUser() method to return the list. Output has no addUser hence the can not find symbol class output{ UnserInfo userInfo = new UserInfo(); &lt;&lt;&lt;---------------- public void outputDetails(){ int i=1; for(User m : userInfo.getUser()){ &lt;&lt;&lt;----------------- System.out.println("Name: "+m.name); System.out.println("\nPassword: "+m.password); i++; } System.out.println(); } } Edit " Now there is no errors but the program does not print the name and password! It only prints "User 1"" It's not printing anything because the UserInfo object in theOutput class have nothing added. You need a constructor that takes a UserInfo class output { UserInfo userInfo; public output(UserInfo userInfo){ this.userInfo = userInfo; } ... } The in your main you pass the UserInfo to the Output User u = new Info("Jack", 123); UserInfo d1 = new UserInfo(); d1.addUser(u); output v = new output(d1); Print p = new Print(); p.addPrint(d1); p.UserList();//Prints number of users v.outputDetails();
type: Answer
has comment: http://stackoverflow.com/comment/31218816
has comment: http://stackoverflow.com/comment/31218468
has comment: http://stackoverflow.com/comment/31218853
has comment: http://stackoverflow.com/comment/31218234
has comment: http://stackoverflow.com/comment/31218600
has comment: http://stackoverflow.com/comment/31218577
has comment: http://stackoverflow.com/comment/31218431
score: 0

http://stackoverflow.com/comment/31243350
comment on: http://stackoverflow.com/q/20831978
has text: @SotiriosDelimanolis - A `long` is an "integer". The error message would seem (to someone who's not seen it a few time) to be nonsense.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31073951
score: 0
type: AnswerComment
type: Comment
has text: @EJP Please explain. Where do the runtime know whats the arguments for a non-serializable base class constructors? Where does the runtime know what non-serializable base class constructor he need to execute if there are multiple base-class-constructors?
comment on: http://stackoverflow.com/a/20719282

http://stackoverflow.com/a/20681127
has body: You are invoking this method without an assignment. //Call the velocity Calculator method velocityCalculator(distance, time); double velocity=0; After that, velocity is 0 and you print 0. You have to return a value in your method and assign it to your variable like this: public static double velocityCalculator(double distance, double time) { return distance/time; } and in your main do the following: //Call the velocity Calculator method double velocity = velocityCalculator(distance, time); Now your method velocityCalculator will return the calculated value and assign it to your newly created variable velocity. Another point is that you want to calculate with floating point numbers, but you are reading just integers. You can read a double value with double time = Double.parseDouble(br.readLine()); instead of Integer.parseInt.
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20681008
type: Answer
answers question: http://stackoverflow.com/q/20681008

http://stackoverflow.com/comment/31147976
type: Comment
comment on: http://stackoverflow.com/a/20779738
type: AnswerComment
has text: Well thats what its mentioned I guess
score: 0

http://stackoverflow.com/comment/31153792
comment on: http://stackoverflow.com/q/20782958
has text: yes i am trying to do that by update=":form:records:mon" then the loop problem is gone but it doesnt update the footer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31225212
has text: You need to copy `commons-fileupload` jar to your `WEB-INF/lib/` directory and then restart the server.
score: 0
comment on: http://stackoverflow.com/q/20822502
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20726599
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/20726722
favorite count: 0
type: AnsweredQuestion
has body: I write a custom gradle plugin where I would like to copy a specific file from a jar inside the classpath into the buildDir. I played around in a sandbox project and got this solution working: task copyFile(type: Copy) { from zipTree(project.configurations.compile.filter{it.name.startsWith('spring-webmvc')}.singleFile) include "overview.html" into project.buildDir } but if copy it into my plugin: project.task(type: Copy, "copyFile") { from zipTree(project.configurations.compile.filter{it.name.startsWith('spring-webmvc')}.singleFile) include "overview.html" into project.buildDir } I got the error: * What went wrong: A problem occurred evaluating root project 'gradle-springdoc-plugin-test'. &gt; Could not find method zipTree() for arguments [/Users/blackhacker/.gradle/caches/artifacts-26/filestore/org.springframework/spring-webmvc/4.0.0.RELEASE/jar/a82202c4d09d684a8d52ade479c0e508d904700b/spring-webmvc-4.0.0.RELEASE.jar] on task ':copyFile'. The result of println project.configurations.compile.filter{it.name.startsWith('spring-webmvc')}.singleFile.class is class java.io.File What I am doing wrong?
score: 3
upvote count: 3
tagged with: java
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/20726722
has title: Copy file from a jar in a custom gradle plugin

http://stackoverflow.com/q/20777564
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20777575
has comment: http://stackoverflow.com/comment/31143632
score: 0
has answer: http://stackoverflow.com/a/20777602
answer count: 2
has comment: http://stackoverflow.com/comment/31143623
has body: Which android version is highly used today? If I develop an app for Android 2.2 will it work in Jelly Bean? Is vice versa possible? In other words does Android OS supports upward compatibility or downward compatibility?
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31143650
tagged with: java
has title: In which android SDK API I should develop the app so that it works on all versions of android?
upvote count: 1

http://stackoverflow.com/comment/31194369
type: QuestionComment
comment on: http://stackoverflow.com/q/20805427
score: 1
has text: Check [this](http://stackoverflow.com/questions/13049563/communicationsexception-communications-link-failure)
type: Comment

http://stackoverflow.com/q/20693397
has comment: http://stackoverflow.com/comment/30992259
has body: I'm new to android programming and something weird started happening to my app after i was moving buttons in my layout. So there is a button (start) that when clicked, launches another activity. Here's the code. public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button startbutton = (Button) findViewById(R.id.button1); startbutton.setOnClickListener(new View.OnClickListener() { //STARTBUTTON @Override public void onClick(View arg0) { //LO QUE HACE EL START BUTTON Intent intent = new Intent(MainActivity.this, JugarActivity.class); startActivity(intent); } }); } } My problem is that when testing my app, when i click the start button nothing happens, but when i click another button i have in my layout (button4) IT DOES send me to the second activity. Here's my activity_main.xml in case it is needed. &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="150dp" android:minWidth="200dp" android:text="@string/Start" android:textSize="30sp" /&gt; &lt;Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxWidth="200dp" android:minHeight="50dp" android:minWidth="200dp" android:text="@string/Jugarporcontinente" android:textSize="30sp" /&gt; &lt;Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minWidth="200dp" android:text="@string/Aprende" android:textSize="30sp" /&gt; &lt;Button android:id="@+id/button6" android:layout_width="wrap_content" android:layout_height="wrap_content" andr…
has comment: http://stackoverflow.com/comment/30992158
has comment: http://stackoverflow.com/comment/30992175
tagged with: android
has title: Button2 is doing what button1 should be doing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/30992307
tagged with: java
has answer: http://stackoverflow.com/a/20699243
type: Question
has comment: http://stackoverflow.com/comment/30992237
score: 0
accepted answer: http://stackoverflow.com/a/20699243
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/30992212
has comment: http://stackoverflow.com/comment/30992771

http://stackoverflow.com/a/20822960
downvote count: 0
has comment: http://stackoverflow.com/comment/31225826
answers question: http://stackoverflow.com/q/20822710
type: AcceptedAnswer
upvote count: 2
has comment: http://stackoverflow.com/comment/31225766
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/20822710
has body: When you define the layout_width="fill_parent" in tab widget, you're saying all of the tabs will be evenly sized, and fill their respective parent. But content inside these tabs, in your case, is not guaranteed to be even. Therefor you need to create new a TextView inside each tab, to hold the text. This will allow content wrapping specific to each tab's content. I've provided an example XML for clarification: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1"/&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0" android:layout_marginBottom="-4dp"&gt; &lt;TextView android:tag="tab0" android:text="Starters" android:layout_width="wrap_content" android:layout_height="fill_parent" /&gt; &lt;TextView android:tag="tab1" android:text="Main Course" android:layout_width="wrap_content" android:layout_height="fill_parent" /&gt; &lt;TextView android:tag="tab2" android:text="Side Course" android:layout_width="wrap_content" android:layout_height="fill_parent" /&gt; &lt;TextView android:tag="tab2" android:text="Others" android:layout_width="wrap_content" android:layout_height="fill_parent" /&gt; &lt;TextView android:tag="tab2" android:text="Desert" android:layout_width="wrap_content" android:layout_height="fill_parent" /&gt; &lt;/TabWidget&gt; &lt;/LinearLayout&gt; I believe this will also require a slight modification to your java as well.

http://stackoverflow.com/comment/31273528
type: Comment
has text: @abarnert: initialization (int a = 5) is an assignment statement in Java. http://java.about.com/od/understandingdatatypes/a/declaringvars.htm
score: 1
comment on: http://stackoverflow.com/q/20847697
type: QuestionComment

http://stackoverflow.com/a/20696586
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20696542
answers question: http://stackoverflow.com/q/20696542
has body: I'm trying to check for no input from the user and if there's no input just make it zero. When there's no input or the input is invalid, valueOf does not return a NaN; it throws NumberFormatException. You can add a try/catch around the valueOf call (since you want float, not Float, you should use parseFloat instead to avoid the unnecessary boxing and unboxing of the value): float aa; try { aa = Float.parseFloat(a.getText().toString()); } catch (NumberFormatException nfe) { aa = 0; }
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/20697985
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20687108
answers question: http://stackoverflow.com/q/20687108
type: Answer
has body: Look at the code example the page I mentioned; the first argument is the aggregated exchange. It is null on the first invocation of an aggregation. You have to create your WidgetPayload on the first invocation and then keep adding widgets to it with every sub-sequent invocation. Then, when you get to the route step after the aggregator, the body of the exchange is your aggregated WidgetPayload.
score: 2

http://stackoverflow.com/comment/31122830
has text: Is it possibly you are using an asynchronous logger?
comment on: http://stackoverflow.com/q/20765881
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31276144
type: Comment
has text: @Tom first error, don't use a false(cause your constructor is public) singleton pattern with this, you need new instances always, when you execute one, you cannot execute it again. So delete `getInstance()` and your `instance`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20842115

http://stackoverflow.com/comment/31140990
score: 0
has text: Yes, you can use those examples, for the most part, but first you will need to learn how to use the JNA library.
type: Comment
comment on: http://stackoverflow.com/q/20775652
type: QuestionComment

http://stackoverflow.com/q/20777511
upvote count: 4
answer count: 4
tagged with: c++
has comment: http://stackoverflow.com/comment/31143571
has comment: http://stackoverflow.com/comment/31143525
has comment: http://stackoverflow.com/comment/31143509
possible better answer: http://stackoverflow.com/a/20777621
has comment: http://stackoverflow.com/comment/31143744
tagged with: c++11
type: Question
has comment: http://stackoverflow.com/comment/31143463
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20777560
has title: Semantics - Passing in an implemented interface into methods
tagged with: java
has comment: http://stackoverflow.com/comment/31143480
has answer: http://stackoverflow.com/a/20777559
has answer: http://stackoverflow.com/a/20777610
accepted answer: http://stackoverflow.com/a/20777610
has comment: http://stackoverflow.com/comment/31143520
has comment: http://stackoverflow.com/comment/31143472
has comment: http://stackoverflow.com/comment/31143517
has comment: http://stackoverflow.com/comment/31143481
downvote count: 0
has answer: http://stackoverflow.com/a/20777621
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31143461
has body: Consider the following interface: class MyInterface { virtual bool test(void * param) = 0; } Can do something like this to implement the interface? MyInterfacemyInterface = new MyInterface() { bool test(void * param) { return true; } } myClass.setInterface(myInterface); ----- OR ----- myClass.setInterface( new MyInterface() { bool test(void * param) { return true; } } ); PS: This method is done in Java. Wondering the something similar exsts in C++.

breakout
type: Tag
tag name: breakout
tags question: http://stackoverflow.com/q/20814260

http://stackoverflow.com/a/20738430
upvote count: 1
answers question: http://stackoverflow.com/q/20738079
downvote count: 0
type: Answer
score: 1
has body: Reason for not using ans.add(tmp); Since tmp is a method argument, so java passes a reference to the ArrayList by value. So tmp actually a reference to a List, not a List. So you need to create an ArrayList object with and add that object to ans ArrayList&lt;Integer&gt; arr = new ArrayList&lt;Integer&gt;(tmp); ans.add(arr); If you use ans.add(tmp), then the arrayList which tmp points to will be added to ans, and if any modifications are made later in the code to tmp, then the contents of the element which you added to ans will also change, since both will point to same memory block.

http://stackoverflow.com/comment/30994853
score: 0
has text: @MadProgrammer, we are getting too predictable :)
type: AnswerComment
comment on: http://stackoverflow.com/a/20694902
type: Comment

http://stackoverflow.com/a/20756660
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20756536
score: 3
has body: When your program is running, various objects exist. Those objects belong to classes. The code for a class constitutes a description of what it means for an object to belong to a class. So yes, a class is absolutely a categorisation of objects, or a collection of objects. When the program is not running, every class is empty - that is, there are no objects of that class. When the program starts, some objects get created, in some classes. There will still be some classes for which no objects have yet been created. Those classes can be thought of as "empty categories". The thing is that a definition of a class is very detailed. It specifies what fields an object has. It specifies what functionality an object has. But it is still categorising objects - that is, defining some subset of the available objects, and saying "these objects belong to this class". So both of the definitions of "class" that you have provided are technically correct. The second definition is far more useful, because it talks about what things we are likely to find in a class - that is, field declarations and method code.

http://stackoverflow.com/q/20791407
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/20791456
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has title: Dollar ($) sign after activity class name in Android logs (non-anonymous inner class)
accepted answer: http://stackoverflow.com/a/20791456
tagged with: android
has body: I am going through some crash logs for my app and the stack trace shows something like : at MyActivity.formatDouble(MyActivity.java:182) at MyActivity.access$47(MyActivity.java:196) at MyActivity$28.onCameraChange(MyActivity.java:167) "MyActivity" is an activity and hence not an anonymous inner class. I can't be sure of the dollar sign on line#3 (and the one in line#2 also)
linked to: http://stackoverflow.com/q/7578155
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/7578155

http://stackoverflow.com/a/20799575
type: Answer
score: 1
has body: Create a class for character and have the texture as it's member which you would always use for drawing each character object. Now clicking the buttons would only change the texture of the given character. Good luck.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20796996

methods
tags question: http://stackoverflow.com/q/20735743
tags question: http://stackoverflow.com/q/20705424
tags question: http://stackoverflow.com/q/20711454
tags question: http://stackoverflow.com/q/20751959
tags question: http://stackoverflow.com/q/20713502
tag name: methods
tags question: http://stackoverflow.com/q/20742337
tags question: http://stackoverflow.com/q/20798391
tags question: http://stackoverflow.com/q/20848683
tags question: http://stackoverflow.com/q/20720549
tags question: http://stackoverflow.com/q/20724243
tags question: http://stackoverflow.com/q/20733814
tags question: http://stackoverflow.com/q/20714433
tags question: http://stackoverflow.com/q/20835752
type: Tag
tags question: http://stackoverflow.com/q/20705826
tags question: http://stackoverflow.com/q/20774394
tags question: http://stackoverflow.com/q/20745948
tags question: http://stackoverflow.com/q/20821126
tags question: http://stackoverflow.com/q/20800962
tags question: http://stackoverflow.com/q/20747884
tags question: http://stackoverflow.com/q/20832685
tags question: http://stackoverflow.com/q/20782009
tags question: http://stackoverflow.com/q/20820370
tags question: http://stackoverflow.com/q/20846891
tags question: http://stackoverflow.com/q/20749062
tags question: http://stackoverflow.com/q/20757020
tags question: http://stackoverflow.com/q/20826972
tags question: http://stackoverflow.com/q/20710140
tags question: http://stackoverflow.com/q/20805841
tags question: http://stackoverflow.com/q/20685670
tags question: http://stackoverflow.com/q/20804698
tags question: http://stackoverflow.com/q/20752341
tags question: http://stackoverflow.com/q/20843722
tags question: http://stackoverflow.com/q/20767264
tags question: http://stackoverflow.com/q/20823645
tags question: http://stackoverflow.com/q/20708443
tags question: http://stackoverflow.com/q/20691657
tags question: http://stackoverflow.com/q/20736909
tags question: http://stackoverflow.com/q/20770307
tags question: http://stackoverflow.com/q/20736574
tags question: http://stackoverflow.com/q/20818685

http://stackoverflow.com/q/20767374
tagged with: java
has comment: http://stackoverflow.com/comment/31125558
has answer: http://stackoverflow.com/a/20767405
has comment: http://stackoverflow.com/comment/31125736
type: Question
has comment: http://stackoverflow.com/comment/31125607
has answer: http://stackoverflow.com/a/20767572
downvote count: 0
has answer: http://stackoverflow.com/a/20767391
favorite count: 0
has answer: http://stackoverflow.com/a/20767792
accepted answer: http://stackoverflow.com/a/20767792
has comment: http://stackoverflow.com/comment/31125653
answer count: 4
tagged with: reference
has title: Pass by value or reference
score: 1
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31125896
possible better answer: http://stackoverflow.com/a/20767572
has body: I know this subject is very beaten, but ... I'm programming an app for android in java, but I come from c++ , where the question of value or reference is very explicit. The problem is: Initially I have a class called Item that has a variable public int ID. In a class called ListingItem, I have a static List list with two item added to it, each has assigned to its variable ID the value 1. In this class there is also a function public static List getList() that returns List, specifically, the List list of this class. In another class, called Fragment, I have a List ItemList and a function private List getList() that returns List. The getList() of Fragment class does the following: private List &lt;Item&gt; getList() { List&lt;Item&gt; list = ListingItem.getList() // copy list from ListingItem.list List&lt;Item&gt; returnList = new ArrayList&lt;Item&gt;(); returnList.add(list.get(0); returnList.add(list.get(1); // copy to returnList two Item objects from list (that copied from ListingItem.list) returnList return; } Another function of class Fragment use Fragment.getList() like this: private functionOfFragment() { List&lt;Item&gt; ItemList = getList(); itemList.get(0).ID = 2; itemList.get(1).ID = 2; // changing from 1 to 2 } However, the value of ListingItem.list.get(0).ID and ListingItem.list.get(0).ID are also the value 2. How is this possible? obs: THIS CODE IS ONLY REPRESENTATIVE, THE PROBLEM ISN'T THE SYNTAX ERROS!

http://stackoverflow.com/comment/31137408
score: 0
comment on: http://stackoverflow.com/a/20774271
type: Comment
has text: but why after default statement.
type: AnswerComment

http://stackoverflow.com/a/20825501
type: Answer
answers question: http://stackoverflow.com/q/20825445
score: 0
has body: Generate Getters And Setters Like Follows: public int getX() { return x; } public void setX(int x) { this.x = x; }

http://stackoverflow.com/q/20757432
has title: find the value of variable given in a string
has body: Given a equation : 433+4H8= 871 H can be anyside of equation. Find the value of H and replace it in given equation. The output should be : 433+438=871 I have tried the following code but conversion of string to int does not work... import java.util.Scanner; import java.io.*; class hole { public static void main(String[] args) { Scanner reader= new Scanner(System.in); int[] nums= new int[3]; String str= reader.nextLine(); String str_1= str.replaceAll("=","+"); String[] split= str_1.split("[+]"); for (int k=0; k&lt;split.length; k++) { String ex= split[k]; nums[k]= Integer.parseInt(ex); } } }
has answer: http://stackoverflow.com/a/20757543
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20758046
has answer: http://stackoverflow.com/a/20757654
has comment: http://stackoverflow.com/comment/31107908
has answer: http://stackoverflow.com/a/20758384
has comment: http://stackoverflow.com/comment/31107823
score: 0
has comment: http://stackoverflow.com/comment/31107839
has answer: http://stackoverflow.com/a/20758544
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31107853
answer count: 5
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/31107862

http://stackoverflow.com/comment/31249454
has text: Try to verify if driver is already created if (driver == null) { drvier = new FireFoxDrvier()} else he will use existing driver and remove afterClass, it will close your browser
type: QuestionComment
comment on: http://stackoverflow.com/q/20833168
score: 0
type: Comment

http://stackoverflow.com/q/20696542
answer count: 5
has answer: http://stackoverflow.com/a/20696577
tagged with: android
has answer: http://stackoverflow.com/a/20696586
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20696609
has body: float aa = Float.valueOf(a.getText().toString()); if (Float.isNaN(aa)) { aa = 0; } I'm trying to check for no input from the user and if there's no input just make it zero, sounds simple enough but its not working for me. Its my first android app and it crashes when there is no user input and the user presses the go button. Can anyone help? Thanks.
upvote count: 3
tagged with: java
has title: Java - if (Float.isNaN(x))
type: Question
score: 3
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/20696586
has answer: http://stackoverflow.com/a/20696599
has answer: http://stackoverflow.com/a/20696649
has comment: http://stackoverflow.com/comment/30997740
downvote count: 0
has comment: http://stackoverflow.com/comment/30997866
tagged with: nan
favorite count: 0
possible better answer: http://stackoverflow.com/a/20696577

http://stackoverflow.com/a/20752076
type: Answer
answers question: http://stackoverflow.com/q/20751959
score: 0
has body: Make sure your method is static and also public instead of private. Also, don't forget to include class as well. After that, you should be able to use any methods of an object of that class.

http://stackoverflow.com/q/20830437
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/31240365
has title: Populating JTable with mysql
has answer: http://stackoverflow.com/a/20830728
accepted answer: http://stackoverflow.com/a/20830728
type: AnsweredQuestion
tagged with: java
tagged with: mysql
tagged with: swing
type: Question
has body: I am making this little program that displays information from mysql database from scratch(no drag and drop). Okay so I tried using NetBeans with Drag and Drop method practicing how to populate JTable with info from mysql database and it worked like a charm. But when I hard code it(if thats the term) it will not work. Here is my code. Sorry if its messy or something I am still a noob at this. import java.sql.*; import java.awt.Dimension; import javax.swing.*; import net.proteanit.sql.DbUtils; public class Main extends JFrame{ Connection conn = null; ResultSet rs = null; PreparedStatement pst = null; public JLabel label1,label2,label3,background; public JButton button1 , button2 , button3; public JTable table = new JTable(); //query for updating the JTable public void UpdateJTable(){ String sql = "SELECT name , TypeDebt , amount , DateDebt,Due_Date from btable"; try{ pst = conn.prepareStatement(sql); rs = pst.executeQuery(); table.setModel(DbUtils.resultSetToTableModel(rs)); }catch(Exception xe){ JOptionPane.showMessageDialog(null, "error"); } } //WindowEvent code private void formWindowOpened(java.awt.event.WindowEvent evt){ conn = sqlconnection.ConnectDb(); UpdateJTable(); } //constructor to be called in the main method public Main(){ init(); } //method for the GUI of the program public void init(){ // Images for the buttons ImageIcon img = new ImageIcon("C:\\Users\\janyjan\\Pictures\\addbutton.jpg"); ImageIcon img2 = new ImageIcon("C:\\Users\\janyjan\\Pictures\\searchbutton.jpg"); ImageIcon img3 = new ImageIcon("C:\\Users\\janyjan\\Pictures\\deletebutton.jpg"); // frame components/attributes setLayout(null); getContentPane(); setTitle("DEBT LIST"); setResizable(false); JLabel background=new JLabel(new ImageIcon("C:\\Users\\janyjan\\Pictures\\background.jpg")); background.setBounds(0,0,700,600); add(background); setVisible(true); setSize(700,600); getContentPane(); setLocationRelativeTo(null); addWindowListener(new java.awt.event.WindowAdapter() { public void windo…
tagged with: jtable
score: 0

http://stackoverflow.com/comment/31147266
has text: Right-click your project, select Properties and `Web Project Settings`. What is the value?
comment on: http://stackoverflow.com/q/20779554
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20719849
score: 0
has comment: http://stackoverflow.com/comment/31092367
answer count: 1
has body: I know there are couple of other questions like this, but nothing worked from there. The code is from here https://developers.facebook.com/docs/android/login-with-facebook There are not modifications. When i am logging FB always returns CLOSED_LOGIN_FAILED. I generated Key Hash with this: keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 and checked it with this: try { PackageInfo info = getPackageManager().getPackageInfo( "com.example.facebooktest", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); String s = Base64.encodeToString(md.digest(), Base64.DEFAULT); Log.d("KeyHash:", s); } } catch (Exception e) { } So the problem is not with the key. I have checked and double checked everything but i still don't know from where is the problem coming. I tried all the sample apps that come with the SDK and all of them return the same thing. Also i tried it on 3 different devices same problem. Can anyone help?
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has title: FB native login SessionState CLOSED_LOGIN_FAILED
has answer: http://stackoverflow.com/a/20996805
type: Question
tagged with: java

http://stackoverflow.com/comment/30990940
score: 1
has text: I don't think that this would be a good idea. If you really want to, look into reflection.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20692750

http://stackoverflow.com/comment/31631696
score: 0
type: Comment
has text: I just want to track the object sizes , that's it. :-) Yes , I could do it using taking heap dump , but I guess taking too many (and frequent ) heap dump might be expensive for the application
comment on: http://stackoverflow.com/a/21005255
type: AnswerComment

http://stackoverflow.com/comment/30997508
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20696242
type: Comment
has text: You can use threads in your case

http://stackoverflow.com/a/20835354
downvote count: 0
answers question: http://stackoverflow.com/q/20835324
upvote count: 2
accepted answer of: http://stackoverflow.com/q/20835324
type: AcceptedAnswer
has body: while(response.charAt(0)=='y') { System.out.println("Enter password") String input = sc.nextLine(); if(input.equalsIgnoreCase("Noah")==true) { System.out.println("Password correct"); break; } else if(input.equalsIgnoreCase("Noah")==false) { System.out.println("Password incorrect, would you like to try again?"); response = sc.nextLine(); } }
type: Answer
score: 2

http://stackoverflow.com/a/20727905
score: 1
answers question: http://stackoverflow.com/q/20727871
downvote count: 0
has body: If your rationals have reduced all common factors out of numerator and denominator, then you can do this: return (numerator == r.numerator) &amp;&amp; (denominator == r.denominator); If your rationals have not done that factorization, then I suggest you implement a GCD function that will allow you to do that. Then compare the reduced numerator and denominator against the reduced r.numerator and r.denominator. Example, assuming int is the underlying type for your rational numerator and denominator: int gcd_lhs = gcd( numerator, denominator ); int gcd_rhs = gcd( r.numerator, r.denominator ); int lhs_red_num = numerator / gcd_lhs; int lhs_red_den = denominator / gcd_lhs; int rhs_red_num = r.numerator / gcd_rhs; int rhs_red_den = r.denominator / gcd_rhs; return (lhs_red_num == rhs_red_num) &amp;&amp; (lhs_red_den == rhs_red_den); This approach has the advantage of being exact in all cases, and it will never exceed the precision of the underlying type that you're using for numerator and denominator. Approaches relying on multiplication, or on dividing something out of the values other than the GCD risk overflowing the precision available in the underlying types. (Division can "overflow" the available precision by producing a repeating binary fraction that must be rounded to fit in the available bits, assuming you cast to double first. Dividing by GCD is always exact, and remain as integer division.) You can mitigate that by using a BigInteger type and applying the cross-multiplication approach. That has its own costs. If you're already using BigInteger to store numerator and denominator, that may be the easiest approach, though.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/31270987
score: 0
type: Comment
has text: Add a semicolon after `mergeWords(...)`, for consistency
comment on: http://stackoverflow.com/a/20847194
type: AnswerComment

http://stackoverflow.com/a/20830017
accepted answer of: http://stackoverflow.com/q/20829975
score: 15
answers question: http://stackoverflow.com/q/20829975
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31239305
has body: You need to read from the Parcel in the same order in which you wrote things. You are writing this.id first, but you are attempting to read the string array before reading the id. Reverse the order of the calls in either the constructor or writeToParcel. Also, instead of writing a string array, why not just write each string individually? Seems a lot simpler. public NewsItem(Parcel in) { in.readInt(); this.name = in.readString(); this.bubble = in.readString(); this.drawable = in.readString(); this.title = in.readString(); this.summary = in.readString(); this.description = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.id); dest.writeString(this.name); dest.writeString(this.bubble); dest.writeString(this.drawable); dest.writeString(this.title); dest.writeString(this.summary); dest.writeString(this.description); }
upvote count: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/31239264

enumeration
tags question: http://stackoverflow.com/q/20795882
type: Tag
tag name: enumeration
tags question: http://stackoverflow.com/q/20797396
tags question: http://stackoverflow.com/q/20707657

http://stackoverflow.com/comment/31005704
type: QuestionComment
comment on: http://stackoverflow.com/q/20700750
score: 1
has text: Hi GGrec,Thanks for the replay.I read the link shared by you.It only says how to filter files with extensions. I want to filter files without extensions.
type: Comment

http://stackoverflow.com/a/20685751
downvote count: 0
answers question: http://stackoverflow.com/q/20685709
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: The following is a clean logic for that: public boolean vegStatus(){ for(PizzaTopping topping : topList) { if(!topping.isVeg()) return false; } return true; } It checks all Toppings and if any of them isn't Veg, it returns false right away and don't check the others (don't have to, right?). If it checks all of them and none of them were not Veg, it returns true.
accepted answer of: http://stackoverflow.com/q/20685709
score: 3

http://stackoverflow.com/a/20817810
has body: Adding Jersey to an Eclipse project without maven is simple: Click properties for the project, go to the Java Build Path. Click on the Add Library on the left, select user library. After you click next you will see "user libraries" in the upper right. Click that. Click new. Add a name: jaxrs-ri-2.5 for example. Click add external jars, and add the jars in the api, lib and ext folders. You're done. This will probably also include them in any war file you make with eclipse. Worked for me.
score: 0
has comment: http://stackoverflow.com/comment/31221483
answers question: http://stackoverflow.com/q/20784531
type: Answer

http://stackoverflow.com/comment/31157913
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20784024
type: AnswerComment
has text: @lazexe check it out my edited answer. Does it works for you??

http://stackoverflow.com/comment/31096017
has text: maybe you should give an example. Given some documents, what are the vectors input you need before feeding it into the neural network?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20710999

http://stackoverflow.com/q/20724250
type: Question
has comment: http://stackoverflow.com/comment/31048142
has comment: http://stackoverflow.com/comment/31048008
has body: I am need some quick help with finishing an assignment, In short I completed an assignment that required me to make a program that allowed the user to pop(), push() and top() an array. I did it but my tutor said that the code layout wrong as I had System.out.println statements in the stack class and these should be in the main menu app, and the stack class should only called the methods that it inherits from the array class. Fair enough I thought and I amended the code but I cannot get the push() method to work correctly now :/ I know that I need to use the Genio.getInteger method in the menu app push()method. Can anyone help? Stack Class: public class Stack extends Array { private int x; public Stack() { super();// initialise instance variables x = 0; } public Stack(int newsize) { super(newsize); System.out.println("Stack Created!"); } /** * @push user is asked to enter value at keyboard which is then added to the top of the stack * */ public boolean push(int item) { return add(item); } /** * @pop removes the current value staored at the top of the stack * */ public int pop() { deleteLast(); return getItemback(); } /** * @top displays the current value stored at the top of the stack * */ public int top() { displayLast(); return getItemback(); } } Menu app: public static void main() { int option; int item; Stack s = new Stack(); String []menuitems = {"1 - Display Stack","2 - Pop Stack", "3 - Push Onto Stack","4 - Top Of Stack","5 - Quit Program"}; Menu m = new Menu(menuitems,5); s.add(12);s.add(2);s.add(1);s.add(13);s.add(24); do { clrscr(); option = m.showMenu(); if ( option == 1 ) { s.display(); pressKey(); } if ( option == 2 ) { if (!s.isEmpty()) System.out.println ("Number Popped: "); else System.out.println ("The Stack Is Empty! "); pressKey(); } // THIS IS THE PART I CANNOT GET TO WORK!! NOT SURE WHERE/HOW TO CALL PUSH // METHOD? if ( option == 3 ) { item = Genio.getInteger(); if (!s.isFull()) System.out.println("Please Enter Number To be Pushed(" + item + ")"…
has title: Can't get push method to work
score: 0
has comment: http://stackoverflow.com/comment/31737795
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/31048197
has comment: http://stackoverflow.com/comment/31047974
has answer: http://stackoverflow.com/a/20724439
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31048160
has comment: http://stackoverflow.com/comment/31048060
has comment: http://stackoverflow.com/comment/31048211
tagged with: java

http://stackoverflow.com/comment/31008922
type: QuestionComment
comment on: http://stackoverflow.com/q/20702656
has text: well i cannot build it .. getting this error "conversion to dalvik format failed unable to execute dex" .. and i cant rectify it with the help of this [link](http://stackoverflow.com/questions/16087341/multiple-dex-files-conversion-to-dalvik-format-failed-unable-to-execute-dex) As i dont have the jar files , so i wont be able to reimport them after deleting .. (As suggested in the answer of the question on the uppermentioned link)
score: 0
type: Comment

http://stackoverflow.com/comment/31086762
has text: It looks you have posted improper code.
type: QuestionComment
comment on: http://stackoverflow.com/q/20745948
type: Comment
score: 1

http://stackoverflow.com/q/20698571
possible better answer: http://stackoverflow.com/a/20698655
has answer: http://stackoverflow.com/a/20699075
has answer: http://stackoverflow.com/a/20698835
tagged with: java
score: -1
tagged with: mysql
has answer: http://stackoverflow.com/a/20698588
type: Question
has answer: http://stackoverflow.com/a/20698878
has comment: http://stackoverflow.com/comment/31000928
has answer: http://stackoverflow.com/a/20698655
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31001134
upvote count: 0
answer count: 5
has title: Last login details of a user
has body: This is the query I am using ResultSet rsta3=st.executeQuery("Select * FROM login_details WHERE name ='"+name1+"' AND intime = (select max(intime) from login_details where name = '"+name1+"')"); With this I get the current login details.How to get the previous login details?What query should I use? The query given in the below answers gives only 11.44 time
accepted answer: http://stackoverflow.com/a/20698588
type: AnsweredQuestion

http://stackoverflow.com/a/20735323
has comment: http://stackoverflow.com/comment/31092485
has comment: http://stackoverflow.com/comment/31068622
has body: You do not need to make your gridWidth and gridHeight large numbers. The relative width and height are handled better with the weightX and weightY fields. public class MainFrame extends JFrame{ public MainFrame(){ super("Symulator Lotow"); JPanel returnPanel = new JPanel(new GridBagLayout()); add(returnPanel); Vector&lt;JButton&gt; v = new Vector&lt;JButton&gt;(); int licznik = 0; GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.insets = new Insets(0,0,0,0); c.anchor = GridBagConstraints.CENTER; v.add(new JButton()); c.gridwidth = 2; c.gridheight = 2; c.weightx = 6.0; c.weighty = 6.0; c.gridx = 0; c.gridy = 0; v.get(licznik).setBackground(Color.black); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 3; c.gridheight = 1; c.weightx = 6.0; c.weighty = 4.0; c.gridx = 2; c.gridy = 0; v.get(licznik).setBackground(Color.white); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 2; c.gridheight = 1; c.weightx = 3.0; c.weighty = 2.0; c.gridx = 2; c.gridy = 1; v.get(licznik).setBackground(Color.blue); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 1; c.gridheight = 1; c.weightx = 3.0; c.weighty = 2.0; c.gridx = 4; c.gridy = 1; v.get(licznik).setBackground(Color.yellow); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 2; c.gridheight = 1; c.weightx = 6.0; c.weighty = 2.0; c.gridx = 0; c.gridy = 2; v.get(licznik).setBackground(Color.yellow); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 3; c.gridheight = 1; c.weightx = 6.0; c.weighty = 2.0; c.gridx = 2; c.gridy = 2; v.get(licznik).setBackground(Color.yellow); returnPanel.add(v.get(licznik),c); licznik++; v.add(new JButton()); c.gridwidth = 1; c.gridheight = 1; c.weightx = 4.0; c.weighty = 2.0; c.gridx = 0; c.gridy = 3; v.get(licznik).setBackground(Color.red); returnPanel.add(v.get(licznik),c); liczni…
score: 0
answers question: http://stackoverflow.com/q/20735196
has comment: http://stackoverflow.com/comment/31079354
has comment: http://stackoverflow.com/comment/31068662
type: Answer

http://stackoverflow.com/comment/31239435
has text: What is "object-oriented code"? People throw around that term without actually thinking about it. It usually means to them "everything is an object and there is lots of inheritance". What it should be is modularity, encapsulation, separation of concerns etc. Inheritance is just a tool. Just because you have an inheritance hammer, problems shouldn't all be nails.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/20829969
type: AnswerComment

http://stackoverflow.com/comment/31090501
type: AnswerComment
has text: Ashish, I originally used this pattern, but decided to remove that extra layer since my @Id example worked the same and was clearer to read and understand.
type: Comment
comment on: http://stackoverflow.com/a/20747727
score: 0

http://stackoverflow.com/a/20715010
has comment: http://stackoverflow.com/comment/31031583
type: AcceptedAnswer
downvote count: 0
has body: There are a number of things about this code that won't work, and a number of things about it that are confusing. The immediate problem is that the panel jp is created in userInput(), and has things added to it there, but it is not itself added to a frame or a window or anything. So it isn't going to display. I recommend having all your UI "setup" code in one place -- set up the entire window, with empty labels or text fields or whatever, before the user is expected to enter anything. That way, the user doesn't have UI controls "popping up" on him, which is disconcerting since GUIs rarely work that way. It is also then easier to make sure that the panels that are to contain your controls are all created, and the layout managers are all set, and the controls are created and placed in the correct panels with the correct layout managers, etc., before you start getting into event-driven logic. One more caution -- any changes made to a Swing UI need to happen on the "event dispatch thread", and if you don't know what that is you need to read a tutorial or two until you figure it out. On the order of code: I find it best to create a container panel, set its layout manager, then create items that will go directly inside that panel and add them. Since nesting panels is common, this can have several layers. I'd probably put the controls you're going to have at the top in one panel, and have that panel set to the "north" portion of a borderlayout on the frame. Then I'd create another panel for the center of that borderlayout, and put anything I wanted in the stretchy portion of the frame there. So: create frame, set borderlayout (though actually it's the default), create upper panel, set layout, create upper controls and add them, add that panel to frame in the north, etc. I find it best to create and add an action routine along with the other characteristics of that control (label, color, etc.). One of the challenges of event-driven code is that, when you write something lik…
type: Answer
answers question: http://stackoverflow.com/q/20714331
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/20714331

http://stackoverflow.com/a/20832915
upvote count: 1
has body: Start by taking a read through How to Use Tabbed Panes You can only instance of classes that extend from Component, so assuming your three classes extend from Component, you shouldn't have any issues
downvote count: 0
answers question: http://stackoverflow.com/q/20832875
type: Answer
score: 1

http://stackoverflow.com/comment/31084760
comment on: http://stackoverflow.com/a/20744148
has text: In fact, all progressBar are null the first time. why ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31182267
score: 0
type: AnswerComment
has text: String pic_square, int uid, String name, add annotations with same names (although im pretty sure its not really needed if the fields names are same as in the json)
comment on: http://stackoverflow.com/a/20799397
type: Comment

http://stackoverflow.com/comment/31078021
score: 0
has text: No, the above code creates a *Socket* and connects it. There is no such thing as a 'SocketConnection' in the JDK.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20740631

http://stackoverflow.com/q/20713107
has comment: http://stackoverflow.com/comment/31027712
score: 2
has title: HashMap of HashMap of Generic Type serialization in Java
has comment: http://stackoverflow.com/comment/31027547
downvote count: 0
has comment: http://stackoverflow.com/comment/31027677
has comment: http://stackoverflow.com/comment/31027637
tagged with: java
has comment: http://stackoverflow.com/comment/56278258
has comment: http://stackoverflow.com/comment/31027994
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31029061
tagged with: hashmap
has comment: http://stackoverflow.com/comment/31028601
has answer: http://stackoverflow.com/a/20713214
answer count: 1
has comment: http://stackoverflow.com/comment/31028433
tagged with: serializable
has comment: http://stackoverflow.com/comment/31027588
has comment: http://stackoverflow.com/comment/31028722
favorite count: 0
has comment: http://stackoverflow.com/comment/31028737
has comment: http://stackoverflow.com/comment/31029164
has body: Fixed, per Engineer Dollery's answer, solution at bottom. The goal is to serialize the network field of class Network. Sorry for the naming. I had this, which compiled, and serialized properly. public class Network { private HashMap&lt;String, HashMap&lt;String, Number&gt;&gt; network; ... public void load(String networkFile) throws Exception{ network = (HashMap&lt;String, HashMap&lt;String, Number&gt;&gt;)Utility.deserialize(Utility.load(networkFile)); } public void save(String networkFile) throws Exception{ Utility.save(networkFile, Utility.serialize(network)); } } class Number implements Serializable { ... } I changed it to this generic version, which compiles, but no longer serializes. I need someway to specify that HashMap of T and Number is serializable. public class Network&lt;T extends Serializable&gt; { private HashMap&lt;T, HashMap&lt;T, Number&gt;&gt; network; ... public void load(String networkFile) throws Exception{ network = (HashMap&lt;T, HashMap&lt;T, Number&gt;&gt;)Utility.deserialize(Utility.load(networkFile)); } public void save(String networkFile) throws Exception{ Utility.save(networkFile, Utility.serialize(network)); } } class Number implements Serializable { ... } And this is the code for serialization package Bullib; import java.io.*; import java.util.*; import java.util.regex.*; public class Utility{ public static Pattern phrasePattern = Pattern.compile("[^;:!.?]+"); public static Pattern wordPattern = Pattern.compile("['A-Za-z]+"); public static Object deserialize(byte[] serialized) throws Exception { ByteArrayInputStream bi = new ByteArrayInputStream(serialized); ObjectInputStream si = new ObjectInputStream(bi); return si.readObject(); } public static byte[] serialize(Object target) throws Exception { ByteArrayOutputStream bo = new ByteArrayOutputStream(); ObjectOutputStream so = new ObjectOutputStream(bo); so.writeObject(target); so.flush(); return bo.toByteArray(); } public static byte[] load(String filename) throws Exception { RandomAcc…
tagged with: generics
has comment: http://stackoverflow.com/comment/31028262
has comment: http://stackoverflow.com/comment/31027811
has comment: http://stackoverflow.com/comment/31028046
tagged with: serialization
has comment: http://stackoverflow.com/comment/31027644
has comment: http://stackoverflow.com/comment/31027920
has comment: http://stackoverflow.com/comment/31027532
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31027935
has comment: http://stackoverflow.com/comment/31027731
has comment: http://stackoverflow.com/comment/31028251
has comment: http://stackoverflow.com/comment/31028068

http://stackoverflow.com/comment/31099747
type: Comment
type: QuestionComment
has text: No, the parser should NOT be able to print non Unicode characters. But that's OK, because your input file doesn't contain any.
comment on: http://stackoverflow.com/q/20752725
score: 0

http://stackoverflow.com/comment/31109923
has text: Have you googled it yet? Or checked "related questions" offered to you while you were typing your question? The web is saturated with answers to your problem.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20758664
score: 0

http://stackoverflow.com/q/20737479
has answer: http://stackoverflow.com/a/20738177
has answer: http://stackoverflow.com/a/20737697
has answer: http://stackoverflow.com/a/20737497
has comment: http://stackoverflow.com/comment/31072248
has answer: http://stackoverflow.com/a/72356794
answer count: 7
has comment: http://stackoverflow.com/comment/31072377
tagged with: string
has answer: http://stackoverflow.com/a/20737648
favorite count: 0
type: UnansweredQuestion
has title: Java - Convert int to String without using any available API
has body: I want to convert a primitive int to String with the following conditions : Example input : int number = 474567; convert into string with out using String class, Object class, no collection frame work. Please let me know if this is possible with the above given condition. I am aware of all other methods i.e using collections and String class library. Thanks in advance. int digit = number; int afterdivide = number; String retValue = ""; while(afterdivide &gt; 0) { digit = afterdivide % 10; afterdivide = afterdivide / 10; if(digit == 0){ retValue += "0"; } else if(digit == 1){ retValue += "1"; } // Other numbers to follow . . . } I tried something like this, but here i have created a String retValue and appending using '+' this will not satisfy my condition (String class used !!). A clue was given to me to solve this. Clue : How do you think String class is written in java.
has answer: http://stackoverflow.com/a/20737605
score: 1
upvote count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/20737579
type: Question
tagged with: java

http://stackoverflow.com/a/20744563
accepted answer of: http://stackoverflow.com/q/20744509
answers question: http://stackoverflow.com/q/20744509
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Did you try saving is as a blob? Here's the link to solution on Stack Overflow: insert BLOB file from Local to DB
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31084370

http://stackoverflow.com/q/20772538
tagged with: rabbitmq
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: While trying to submit a storm topology , ./storm jar /home/winoria1/Desktop/stormtopology.jar com.storm.StormTopology I am getting following error- Exception in thread "main" java.lang.UnsupportedClassVersionError: com/rapportive/storm/spout/AMQPSpout : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at com.winoria.frequest.SuggestionTopology.main(SuggestionTopology.java:28) my java version is winoria1@winoria:~$ java -version java version "1.6.0_27" OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) winoria1@winoria:~$ javac -version javac 1.6.0_27 winoria1@winoria:~$ any on…
has answer: http://stackoverflow.com/a/20772576
tagged with: apache-storm
type: Question
tagged with: amqp
accepted answer: http://stackoverflow.com/a/20772576
linked to: http://stackoverflow.com/q/10382929
answer count: 1
downvote count: 0
has title: UnsupportedClassVersionError-AMQPSpout: storm topology not running
favorite count: 0
has comment: http://stackoverflow.com/comment/31134488

http://stackoverflow.com/comment/30969840
score: 0
has text: Well, there you have the language construct versus convention thing. Setters, by convention, just take one argument. Methods however can have many. So, whenever it makes sense to set things together, do this, but maybe use a better name for the method which does not indicate it is a setter (which still is just a method).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20681489

http://stackoverflow.com/comment/31068301
has text: fixed it. One line beneath, I feel dumb. Thanks! :)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20735079
score: 0

http://stackoverflow.com/comment/31121525
has text: Periods, periods everywhere.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20765113
type: QuestionComment

google-cloud-datastore
tags question: http://stackoverflow.com/q/20783694
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/20758503
type: Tag
tags question: http://stackoverflow.com/q/20695009

http://stackoverflow.com/comment/31025361
type: QuestionComment
comment on: http://stackoverflow.com/q/20711336
has text: Yes, i can create the image dinamically. In fact, i'm think about use "canvas html5", this a great solutions and works fine.
score: 0
type: Comment

http://stackoverflow.com/comment/32512761
has text: Have you checked the two links in previous comment?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20734893

http://stackoverflow.com/comment/31169297
type: Comment
comment on: http://stackoverflow.com/a/20755743
has text: OK, great, i understand it much better now, then the actual java program should not run on Hadoop. The execution should be an ordinary lets say Swing Application, that only runs on the Name node, You can use the FileUtil class [link](http://hadoop.apache.org/docs/stable/api/org/apache/hadoop/fs/FileUtil.html) To take the local file and copy it to the destination HDFS. If you try to run the same program on the cluster "Run on hadoop" it will try to run it as a "Map/Reduce" job. Does it make things more clear? or i'm not understanding your needs correctly?
score: 0
type: AnswerComment

http://stackoverflow.com/a/20832561
answers question: http://stackoverflow.com/q/20829718
score: 1
has body: AAPT is the Android build tool that packages resources; it's used by both ADT and Android Studio. The most common crash I know of is due to bug https://code.google.com/p/android/issues/detail?id=42752. The cause usually seems to be a reference to a nonexistent string in one of your menu resources. Look for that and see if it clears up your crash. See also Execution failed app:processDebugResources Android Studio.
upvote count: 1
has comment: http://stackoverflow.com/comment/31247639
type: Answer
downvote count: 0

http://stackoverflow.com/comment/54796406
type: Comment
has text: Thank you very much. I still don't understand why this works and all other libraries with "Auto-Discoverable Features” doesn't work, even if I tried using maven and registering classes myself in web.xml...
type: AnswerComment
comment on: http://stackoverflow.com/a/20763003
score: 0

http://stackoverflow.com/comment/31235320
comment on: http://stackoverflow.com/q/20827354
score: 0
type: Comment
type: QuestionComment
has text: Yes, its being updated everytime from the render method in my 'world' class - I need it to be if else if because I dont want the zombie to move if the coordinates are the same - I just want it to stay still.

http://stackoverflow.com/a/20799089
upvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/20798654
downvote count: 1
answers question: http://stackoverflow.com/q/20798654
score: -1
has body: Try this: @RequestMapping(value = "productDescription/{productId}/{competitorList}", method = RequestMethod.GET) @ResponseBody public ProductDescription getProductDescription(@PathVariable("productId") String productId, @PathVariable("competitorList") String competitorList) { return service.getProductDescription(productId, competitorList); }

http://stackoverflow.com/comment/30973418
comment on: http://stackoverflow.com/a/20682497
has text: funny but it still doesn't work for me! I'm reading the XML from a file into a document object then parsing the XML directly from there. That shouldn't really matter though
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31063811
has text: Ease of use, convenience, complexity, what if someone sees all the same implementations in the subclasses and decides to move it to an abstract superclass (example 2)? it doesn't work anymore because of the binding of the method at compile-time. With problems I didn't necessarily meant bugs, bad design, etc. It's for a course of software engeneering so there's the aspect 'human' that needs to be considered (because anyone can write code a machine can understand).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20730722

http://stackoverflow.com/a/20706835
type: Answer
score: 8
answers question: http://stackoverflow.com/q/20701082
accepted answer of: http://stackoverflow.com/q/20701082
type: AcceptedAnswer
has body: If we will convert Map to json: Map<String, String> map = new HashMap<String, String>(); map.put("operating system", "GNU/Linux"); map.put("allergies", "weed"); The output will be: {"operating system":"GNU/Linux","allergies":"weed"} As we can see there is no key/value. Solution WrapperObject @JsonIgnoreProperties(ignoreUnknown = true) public class WrapperObject { // we can give any name to class, its only external {} private Attributes attributes; public WrapperObject() {} public Attributes getAttributes() { return attributes; } } Attributes @JsonIgnoreProperties(ignoreUnknown = true) public class Attributes { public Attributes() {} private ArrayList<Entry> entry; public ArrayList<Entry> getEntry() { return entry; } } Entry @JsonIgnoreProperties(ignoreUnknown = true) public class Entry { private String key; private String value; public Entry() {} public String getKey() { return key; } public String getValue() { return value; } } Launcher public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException { String str = "{" + " \"attributes\": {" + " \"entry\": [" + " {" + " \"key\": \"operating system\"," + " \"value\": \"GNU/Linux\"" + " }," + " {" + " \"key\": \"allergies\"," + " \"value\": \"weed\"" + " }" + " ]" + " }" + "}"; ObjectMapper mapper = new ObjectMapper(); WrapperObject mj = mapper.readValue(str, WrapperObject.class); if(mj == null){ System.err.println("null"); } // dummy check System.out.println(mj.getAttributes().getEntry().get(0).getKey()); } Output: operating system
downvote count: 0
upvote count: 8

http://stackoverflow.com/a/20723444
score: 2
downvote count: 0
has body: You can get the device language by Locale.getDefault().getDisplayLanguage(); And then do a checking on the input string to see if any character in the string is in the range between \u0600 and \u06FF (Arabic charset in Unicode), then it should do the trick Here is the answer of how to check if the string is in a specific charset public boolean isEncoded(String text){ Charset charset = Charset.forName("US-ASCII"); String checked=new String(text.getBytes(charset),charset); return !checked.equals(text); }
has comment: http://stackoverflow.com/comment/31046890
upvote count: 2
has comment: http://stackoverflow.com/comment/31046268
has comment: http://stackoverflow.com/comment/31046851
has comment: http://stackoverflow.com/comment/31046715
type: Answer
answers question: http://stackoverflow.com/q/20723320

http://stackoverflow.com/comment/31217742
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/20818665
has text: Have you gone through the logback manual? It is very comprehensive.

http://stackoverflow.com/comment/30984692
type: Comment
comment on: http://stackoverflow.com/q/20689122
type: QuestionComment
has text: It would be helpful to know what exact Scala version are you using, since “class file X is broken” have had various causes in different versions.
score: 0

http://stackoverflow.com/comment/31084050
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20744474
score: 3
has text: use java.util.Date instead of java.sql.Date.

http://stackoverflow.com/a/20698324
type: Answer
score: 1
answers question: http://stackoverflow.com/q/20698138
has body: I'd say it's like that: Boat boat1 = new Boat(); // doesn't work, Boat is abstract Boat boat2 = new Boat(Color.black, 300.2);// doesn't work, Boat is abstract Boat boat3 = new Kayak(Color.yellow, 30.2, 1, 1); // ok Kayak kayak1 = new Kayak(Color.yellow, 30.2, 1, 1); // ok Kayak kayak2 = new Kayak(); // No such constructor I'm having trouble because I think that since in the Boat class, Color is private so an instance of Kayak doesn't have a color associated with it. Is this true? Not really, Kayak accepts Color as a param, so it can then pass it to Boat constructor Also, where the the fact that the Boat class is abstract come into play, how does it affect Kayak? No, it is ok to derive from abstract class and then to use it as a reference base (i.e. Boat x = new Kayak)
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/20759765
upvote count: 4
downvote count: 0
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/20772852
favorite count: 0
has comment: http://stackoverflow.com/comment/31112837
has comment: http://stackoverflow.com/comment/31113401
type: AnsweredQuestion
has title: Java 7 Manifest Security Changes
tagged with: java
accepted answer: http://stackoverflow.com/a/20772852
type: Question
has body: With recent changes to Java 7s security checks, I'm updating our webstart application to allow it to run without warnings. Our webstart application consists of a number of jar files, only a few of which are developed by us, we use a number of 3rd party jar files (log4j, swingx, ...) Our previous setup used a self signed certificate, with which we signed all jar files. We have now purchased a signing certificate from a proper CA. The steps I've taken so far are: Unpack the jar files Strip out old certificates (remove *.DSA *.SF *.RSA and hashes from the manifest) from all jar files Re-package jar files Add Permission, Codebase, Application-Name attributes to the jar file which contains our main class. Sign jar files with the new key Running this in webstart on a machine with Java 7 u45 gives no warning dialog, which is great. However, looking in the java console, I see that it is warning about missing Permission, Codebase, Application-Name attributes for all jar of the other jar files. Should I also be adding these attributes to every jar file? I'm already uneasy with repackaging 3rd party jar files, but now having to add manifest attributes too makes me feel I've missed something. So, change manifests, or something else? Thanks, and Merry Christmas Edit: Thanks for the useful responses, I just wanted to update this with some details of the solution I have implemented. I take the following steps to repackage each jar file required by the application. - Unpack the jar file to a temporary directory - Remove *.DSA *.RSA *.SF from META-INF - Remove lines from META-INF/MANIFEST.MF which start with - SHA-256-Digest - SHA1-Digest - Permissions - Codebase - Application-Name - Insert lines into META-INF/MANIFEST.MF - Permissions: all-permissions - Codebase: * - Application-Name: MY APP NAME - Ensure all line endings in MANIFEST.MF are appropriate for my system (dos2unix) - Recreate the jar file with the new manifest specified - Sign the jar file with the current code signing …
score: 4
has comment: http://stackoverflow.com/comment/31112449
tagged with: java-web-start

http://stackoverflow.com/comment/31133352
type: Comment
type: QuestionComment
score: 2
has text: Despite extensions, you'd most probably need to implement natively, unless you have such a special HID, this is not going to work anyway. A regular mouse, and the events in Java, have binary buttons only (state 1 or 0; true, or false)
comment on: http://stackoverflow.com/q/20771857

http://stackoverflow.com/comment/31058648
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20730203
has text: thanks, im testing it atm, will change my question if problem persists

http://stackoverflow.com/a/20749770
upvote count: 0
has comment: http://stackoverflow.com/comment/31095708
type: Answer
has body: I replicated your code and here is what i found:
answers question: http://stackoverflow.com/q/20745964
downvote count: 2
score: -2

http://stackoverflow.com/q/20719393
answer count: 1
has title: compress and decompress String using DeflaterOutputStream and InflaterInputStream in java
favorite count: 0
upvote count: 4
has body: I need to save a string on a file and I am using DeflaterOutputStream to compress. when I try to decompress I can't get the original String. I get an uncleared symbols. Her is my code: public static void decompress() throws Exception { InputStream in=new FileInputStream("E:/codes.txt"); InflaterInputStream ini = new InflaterInputStream(in); ByteArrayOutputStream bout =new ByteArrayOutputStream(512); int b; while ((b = in.read()) != -1) { bout.write(b); } ini.close(); bout.close(); String s=new String(bout.toByteArray()); System.out.print(s); } public static void compressData(byte[] data) throws Exception { OutputStream out=new FileOutputStream("E:/test.txt"); Deflater d = new Deflater(); DeflaterOutputStream dout = new DeflaterOutputStream(out, d); dout.write(data); dout.close(); } public static void main(String[] args) throws Exception { compressData("My name is Motasem".getBytes()); decompress(); } I don't where exactly is the problem . I though it's in converting the byte array to String but I tried it and it is working. You can check this website http://www.mkyong.com/java/how-do-convert-byte-array-to-string-in-java/
type: AnsweredQuestion
downvote count: 0
tagged with: compression
type: Question
has comment: http://stackoverflow.com/comment/31039024
has answer: http://stackoverflow.com/a/20719551
accepted answer: http://stackoverflow.com/a/20719551
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/31045673

http://stackoverflow.com/a/20895980
type: Answer
answers question: http://stackoverflow.com/q/20780779
score: 0
has body: I went around this problem with a dynamic loading library Vinyasa Here is a blog post about it: Dynamic reloading of java code in emacs/nrepl
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20780779

http://stackoverflow.com/q/20800346
has title: How to get notification of change in database
answer count: 0
has body: I want that Whenever there is any change in Specific table of database, I get notification at run time, so that I may be able to take action accordingly in my Java program.I am using tomcat as server. Is JMS help me in this case.Kindly guide me if there is any way to do so. Thanks
type: Question
has comment: http://stackoverflow.com/comment/31183908
score: 0
tagged with: mysql
has comment: http://stackoverflow.com/comment/31183588
has comment: http://stackoverflow.com/comment/31183595
has comment: http://stackoverflow.com/comment/31184006
tagged with: java
tagged with: database
type: UnansweredQuestion

http://stackoverflow.com/comment/31074205
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20738599
has text: @BrianRoach OK so answer is Java doesn't allow this?
type: AnswerComment

http://stackoverflow.com/a/20776453
score: 10
has comment: http://stackoverflow.com/comment/31141558
has body: static so that the JVM can run the method without having to instantiate the class object + public so that the JVM can access it freely without any access issues.
has comment: http://stackoverflow.com/comment/66244351
has comment: http://stackoverflow.com/comment/101746538
answers question: http://stackoverflow.com/q/20776413
type: Answer
has comment: http://stackoverflow.com/comment/31141862
upvote count: 13
downvote count: 3
has comment: http://stackoverflow.com/comment/31141595

http://stackoverflow.com/comment/31063724
has text: i have already built an app and have the app-id and appsecret but did not reveal it here for obvious reasons. I am having a problem designing the login flow
comment on: http://stackoverflow.com/a/20732637
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/103578452
has text: how to detect after all field changed, because, it detect every time it changes, when any button is pressed.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20824665
score: 1

http://stackoverflow.com/comment/31069961
type: AnswerComment
has text: Handler is saving its MessageContext, on next precondition check when new message arrival it will get this MessageContext and decide next steps.
type: Comment
comment on: http://stackoverflow.com/a/20729107
score: 0

http://stackoverflow.com/comment/31103139
type: QuestionComment
has text: You might also switch to a `SortedSet` and just use contains for your id/defaultId.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20754628

http://stackoverflow.com/comment/31190719
type: AnswerComment
comment on: http://stackoverflow.com/a/20800179
type: Comment
score: 1
has text: Factory Method is simpler. Abstract (or interface) Factory is more powerful. Use the one you need for your case.

http://stackoverflow.com/comment/31211051
type: QuestionComment
comment on: http://stackoverflow.com/q/20814607
score: 1
has text: Show us the stack trace and the `unwrap` method. The problem is most likely in your code, not the JIT.
type: Comment

http://stackoverflow.com/comment/31247664
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20834209
has text: I tried to get the process.getErrorStream(), it doesn't give any error, it gives null. Process#waitFor() gives 0.

http://stackoverflow.com/q/20796432
has title: Strange behaviour of write method
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31177387
has answer: http://stackoverflow.com/a/20796567
has answer: http://stackoverflow.com/a/20796597
has answer: http://stackoverflow.com/a/20796545
downvote count: 0
has body: I was looking some methods of PrintStream class and came across write() and as per the docs to print in the console we need to call System.out.flush();.But my doubt is if I write these lines System.out.write(40); System.out.write(10); Then also ( gets printed.I know 10 represents new line but I wanted to know why it only happens with new line.If I write System.out.write(40); System.out.write(32); 32 for space then also nothing gets printed. Demonstration
favorite count: 0
accepted answer: http://stackoverflow.com/a/20796567
linked to: http://stackoverflow.com/q/7166328
possible better answer: http://stackoverflow.com/a/20796545
has comment: http://stackoverflow.com/comment/31177158
has comment: http://stackoverflow.com/comment/31177191
has answer: http://stackoverflow.com/a/20796593
has comment: http://stackoverflow.com/comment/31177115

http://stackoverflow.com/comment/31174076
has text: you can make a configuration, while let `apache` to cope with static file such as `404` or `500` page, and then forward other dynamical request into tomcat or other servlet container
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20794756

http://stackoverflow.com/a/20840076
has comment: http://stackoverflow.com/comment/31257417
has comment: http://stackoverflow.com/comment/31257536
type: AcceptedAnswer
downvote count: 0
has body: First, the Sonatype dependency version in the snapshots repository you had linked in your post is 1.1-SNAPSHOT and not 1.0. It's not recommended to use 3rd party snapshots in your build If however you insist, you need to add Sonatype snapshots repository to your maven build as follows: sonatype-snapshots sonatype-snapshots https://oss.sonatype.org/content/repositories/snapshots/ true EDIT The 1.0 version resides in Sonatype releases repository: sonatype-releases sonatype-releases https://oss.sonatype.org/content/repositories/releases/ true false
answers question: http://stackoverflow.com/q/20839918
score: 2
accepted answer of: http://stackoverflow.com/q/20839918
upvote count: 2
has comment: http://stackoverflow.com/comment/31257244
type: Answer

http://stackoverflow.com/q/20737082
has body: I'm using JSCH to ssh to an external with Java. As of right now, my JSCH code looks like this: JSch jsch = new JSch(); Session session = jsch.getSession(user, host, 22); session.setPassword(pass); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(5000); Channel channel = session.openChannel("shell"); channel.connect(); input.add(command); (with input.add eventually writing my command to an OutputStream). The code works, but the problem is that the output looks strange. [m[?1l>(B)0[H[J[1;1H[22:40:53] [Server thread/INFO]: what[K rather than just [22:40:53] [Server thread/INFO]: what If I use exec rather than shell, I'll get the latter output, however, I can't use tmux with exec because tmux needs a pseudo terminal. I've tried both exec and shell with every combination of setPty (true and false) and I still can't seem to get output that doesn't have weird symbols, works with tmux, and doesn't close the outputstream when it's not receiving anything.
tagged with: shell
tagged with: exec
favorite count: 0
has title: Java JSCH - how to use tmux & shell?
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: jsch

http://stackoverflow.com/comment/31204618
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20811071
type: Comment
has text: Unexpected behavior is a connection lost dialog. It is expected, but not desired.

http://stackoverflow.com/q/20812093
has answer: http://stackoverflow.com/a/20812378
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/20812171
has comment: http://stackoverflow.com/comment/31205450
tagged with: arrays
tagged with: sorting
favorite count: 0
has body: I have to sort elements in each row and then display the array. For example, if the input array is: 5 1 3 1 3 5 INPUT: 7 6 4 OUTPUT: 4 6 7 9 8 2 2 8 9 My code for that was: for (int i = 0; i &lt; size; i++) { //"size" is the size of the square matrix for (int j = 0; j &lt; size; j++) { for (int k = 0; k &lt; size - 1; k++) { for (int l = 0; l &lt; size - k - 1; l++) { if (arr[i][j] &gt; arr[i][j+1]) { //arr[][] is of datatype int int temp = arr[i][j]; arr[i][j] = arr[i][j+1]; arr[i][j+1] = temp; } } } } } Any suggestions?
has comment: http://stackoverflow.com/comment/31205509
score: 0
has comment: http://stackoverflow.com/comment/31205418
possible better answer: http://stackoverflow.com/a/20812147
has answer: http://stackoverflow.com/a/20812147
accepted answer: http://stackoverflow.com/a/20812171
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31205456
has title: sorting elements in a row in a 2D array
has comment: http://stackoverflow.com/comment/31205489
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/69132478
type: Answer
answers question: http://stackoverflow.com/q/20736460
has body: In python vectorized gradient descent implementation for linear regression with MSE loss may look like the following: import numpy as np def grad_step(X, y, θ, α): m = X.shape[0] return θ - (α / m) * 2 * X.T @ (X @ θ - y) def compute_loss(X, y, θ): return np.mean((X @ θ - y).T @ (X @ θ - y)) # run gradient descent θ = np.zeros(X.shape[1]).reshape(-1,1) for _ in range(100): θ = grad_step(X, y, θ, α = 0.01) Since with matrix differentiation rules, we can compute the gradient of the cost function as follows:
score: 0

http://stackoverflow.com/a/20821661
score: 3
upvote count: 3
has body: The best way to deploy a JWS app. or applet is to use the Deployment Toolkit Script. It will use whatever tag is most appropriate for that version of that browser.
downvote count: 0
answers question: http://stackoverflow.com/q/20821649
type: Answer
has comment: http://stackoverflow.com/comment/31223343

http://stackoverflow.com/q/20702951
has answer: http://stackoverflow.com/a/20704249
answer count: 3
downvote count: 0
has body: I use hibernate sequences to generate id of an entity. I use PostgreSQL 9.1. Is it possible to get entity id before it is saved to database? How?
tagged with: sequence
favorite count: 0
tagged with: postgresql
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/20703203
upvote count: 6
linked to: http://stackoverflow.com/q/6386888
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/20703826
has title: Get ID before saving to database
type: Question

http://stackoverflow.com/q/20837177
answer count: 1
has title: Which is the best way to check if there is already a user visiting a range of pages in a Web app?
accepted answer: http://stackoverflow.com/a/20837253
tagged with: web-applications
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31271734
linked to: http://stackoverflow.com/q/17733437
type: Question
has answer: http://stackoverflow.com/a/20837253
tagged with: struts2
score: 0
has body: I have a Web application where I need to restrict the access to certain pages if there is already another registered user visiting those pages. If so, the other user only would have read access. Which is the best way to implement this?

http://stackoverflow.com/comment/30990164
comment on: http://stackoverflow.com/q/20691757
type: Comment
type: QuestionComment
score: 2
has text: @BorisTreukhov The benefit was mutual exclusion.

http://stackoverflow.com/a/20766943
downvote count: 0
has comment: http://stackoverflow.com/comment/31126124
has comment: http://stackoverflow.com/comment/31125865
type: Answer
has comment: http://stackoverflow.com/comment/31126086
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20762067
has body: You are aware that using an interceptor is by far the easiest way to do this? Logging interceptors are exactly for doing this. That said, if you cannot do things the easy way then you have to try something else. For example, you can have your own JAXBContext and use that to write the values out for logging purposes; it won't be exactly the same, but it will be pretty close. // I assume you've already JAXB-annotated these classes anyway. JAXBContext c = JAXBContext.newInstance(YourInputPOJO.class, YourOutputPOJO.class); public YourOutputPOJO theMethod(YourInputPOJO input) { logMessage("in", "theMethod", input); YourOutputPOJO output = ...; logMessage("out", "theMethod", output); return output; } private void logMessage(String dir, String method, Object message) { Marshaller m = c.createMarshaller(); Writer out = new StringWriter(); m.marshal(message, out); log.info("message " + dir + ":" + method + "(" + out + ")"); } Don't make the JAXBContext on every call — it's quite expensive — but making the Marshaller isn't too bad. Don't share the Marshaller between threads, but after creation the JAXBContext is thread-safe. And I've totally omitted the exception handling…
has comment: http://stackoverflow.com/comment/31125556

http://stackoverflow.com/q/20696099
has answer: http://stackoverflow.com/a/20696186
type: Question
has comment: http://stackoverflow.com/comment/66774052
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/20700946
has comment: http://stackoverflow.com/comment/30999769
has answer: http://stackoverflow.com/a/20696136
has comment: http://stackoverflow.com/comment/30997868
downvote count: 0
accepted answer: http://stackoverflow.com/a/20696203
has comment: http://stackoverflow.com/comment/30998664
favorite count: 0
has comment: http://stackoverflow.com/comment/30997000
has comment: http://stackoverflow.com/comment/30998697
answer count: 5
tagged with: android
possible better answer: http://stackoverflow.com/a/20696136
has title: Why doesn't my linear layout match my parent height in listview?
has comment: http://stackoverflow.com/comment/30999276
has answer: http://stackoverflow.com/a/20696203
has answer: http://stackoverflow.com/a/20696147
has comment: http://stackoverflow.com/comment/30998046
has comment: http://stackoverflow.com/comment/31883543
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I have the following code <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/gameNameView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/game_list_text_size" /> <TextView android:id="@+id/gameCreationDateView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/gray" android:textSize="@dimen/small_text_size" android:textStyle="italic" /> The LinearLayout with id itemLinearLayoutView is the main layout that wrap everything in a row of listview. The problem I am having is that the second linear layout child does not take the height of the parent linear layout with id itemLinearLayoutView. Any solutions? or Problem with the code?

http://stackoverflow.com/a/20713495
has comment: http://stackoverflow.com/comment/31028461
type: Answer
has body: It is iterating through your entire list, but checkCollisions overwrites the value of canGoLeft, canGoRright, etc. every time it is called. You should do something like canGoLeft = canGoLeft &amp;&amp; !leftRect.intersects(entity.getRect());
upvote count: 3
has comment: http://stackoverflow.com/comment/31028351
accepted answer of: http://stackoverflow.com/q/20713477
score: 3
has comment: http://stackoverflow.com/comment/31029400
answers question: http://stackoverflow.com/q/20713477
has comment: http://stackoverflow.com/comment/31029167
has comment: http://stackoverflow.com/comment/31028503
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31029618

http://stackoverflow.com/comment/31234497
has text: No, you don't have to install a SMTP server, if your company has a email service that already sends outgoing emails then it already has a SMTP server. Just connect to it. See @Jurgen's answer for more info.
type: Comment
comment on: http://stackoverflow.com/a/20827218
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31065347
has text: @derstrom8 see the edits I updated the code for fileupload.jsp UploadAction is action class that is mapped to upload action is struts.xml file as shown above.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20733554
score: 0

http://stackoverflow.com/q/20843873
has body: I am attempting to write a BufferedImage to png file using ImageIO, but every time I add an ICC_Profile to the IIOMetadata the resulting png image has no ICC_Profile embedded, and running ImageMagick identify on the resulting png file yields an error. What I need is working code that adds the ICC_Profile. I admit that I am a bit of a novice with ImageIO. My thinking is that I just add the profile to the header and whatever is used to render the image should find the profile and display the image in the associated colorspace (if supported). Am I missing something else that I should be doing to this image? Also - I would like to be clear that I want to use only ImageIO and not ColorConvertOp from JAI because JAI hasn't been developed in 7 years and the best way to do this is with standard JDK classes, in my opinion. Is this possible and/or has anybody else been able to achieve it? My Code: Iterator i = ImageIO.getImageWritersByFormatName("PNG"); if (i.hasNext()) { ImageWriter imageWriter = (ImageWriter) i.next(); ImageWriteParam param = imageWriter.getDefaultWriteParam(); ImageTypeSpecifier its = new ImageTypeSpecifier(bi.getColorModel(), bi.getSampleModel()); IIOMetadata iomd = imageWriter.getDefaultImageMetadata(its, param); String formatName = "javax_imageio_png_1.0"; Node node = iomd.getAsTree(formatName); //add resolution IIOMetadataNode phys = new IIOMetadataNode("pHYs"); phys.setAttribute("unitSpecifier", "unknown"); phys.setAttribute("pixelsPerUnitXAxis", "300"); phys.setAttribute("pixelsPerUnitYAxis", "300"); //add ICC PROFILE IIOMetadataNode iccp = new IIOMetadataNode("iCCP"); //ICC_Profile pro = Util.getAdobeRGBICCProfile(); iccp.setUserObject(parameters.getOriginalICC()); iccp.setAttribute("profileName", "AdobeRGB1998"); iccp.setAttribute("compressionMethod", "deflate"); node.appendChild(phys); node.appendChild(iccp); try { iomd.setFromTree(formatName, node); } catch (IIOInvalidTreeException e) { System.out.println("IIOInvalidTreeException Occurred setting…
score: 0
answer count: 1
tagged with: javax.imageio
has answer: http://stackoverflow.com/a/20884108
has comment: http://stackoverflow.com/comment/31289512
tagged with: java
tagged with: image-processing
accepted answer: http://stackoverflow.com/a/20884108
has comment: http://stackoverflow.com/comment/31303433
tagged with: image
type: AnsweredQuestion
type: Question
has title: How to embed ICC_Profile (Adobe98) in IIOMetadata and write PNG with ImageIO?

http://stackoverflow.com/a/20733127
has comment: http://stackoverflow.com/comment/31065581
has comment: http://stackoverflow.com/comment/31064326
has comment: http://stackoverflow.com/comment/31064307
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/20733014
score: 3
has body: For setting the current system date you need: JFormattedTextField ftf = ...; ftf.setValue(new Date()); For setting the right format you need a DefaultFormatterFactory and the DateFormatter: DateFormatter df = new DateFormatter(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); DefaultFormatterFactory factory = new DefaultFormatterFactory(); // other ctors possible factory.setDefaultFormatter(df); // here simple default solution ftf.setFormatterFactory(factory); Note: You should read the javadoc. There are several variations for edit and display mode. So in your scenario you need two fields (and therefore two dates): JFormattedTextField ftfLeft = ...; // create and set the format JFormattedTextField ftfRight = ...; // create and set the format Date now = new Date(); Date nowMinusFiveSeconds = new Date(now.getTime() - 5 *1000); ftfLeft.setValue(nowMinusFiveSeconds); ftfRight.setValue(now);
downvote count: 0

http://stackoverflow.com/q/20714583
answer count: 3
has answer: http://stackoverflow.com/a/20714603
favorite count: 0
has body: So I was trying to create this simple program were a user enters in a month (1-12) and then using switch statements tell them what month it is based upon what they entered. This is my code: import java.util.Scanner; class tests{ public static void main(String args[]){ Scanner monthone = new Scanner(System.in); Double month; System.out.println("What is the numerical value of the month? 1-12"); System.out.print(monthone.nextLine()); month = monthone.nextDouble(); switch (month){ case 1: System.out.println("It's January"); break; case 2: System.out.println("It's Feburary"); break; case 3: System.out.println("It's March"); break; case 4: System.out.println("It's April"); break; case 5: System.out.println("It's May"); break; case 6: System.out.println("It's June"); break; case 7: System.out.println("It's July"); break; case 8: System.out.println("It's August"); break; case 9: System.out.println("It's September"); break; case 10: System.out.println("It's October"); break; case 11: System.out.println("It's November"); break; case 12: System.out.println("It's December"); break; default: System.out.println("I Don't know what month it is.."); break; } } } Can anybody provide a solution or help? I tried using a Int for my variable as well but that failed... :s (Please detail answers.. I am here to learn not to be given an answer in a quick reply.)
upvote count: 1
type: AnsweredQuestion
has title: What is this error in my code? Trying to use userinput for variable and use switch statements
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20714599
has answer: http://stackoverflow.com/a/20714588
downvote count: 0
possible better answer: http://stackoverflow.com/a/20714599
accepted answer: http://stackoverflow.com/a/20714588

http://stackoverflow.com/comment/30991592
has text: I wonder, whether this is a bug, or normal. Should be "B" in both cases?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20692950

http://stackoverflow.com/comment/31009619
type: QuestionComment
comment on: http://stackoverflow.com/q/20703628
has text: you call switch on s and then your first case is s?
score: 0
type: Comment

http://stackoverflow.com/q/20773888
has comment: http://stackoverflow.com/comment/31136827
has comment: http://stackoverflow.com/comment/31136794
possible better answer: http://stackoverflow.com/a/20773923
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20773923
has comment: http://stackoverflow.com/comment/43472633
has answer: http://stackoverflow.com/a/20773910
accepted answer: http://stackoverflow.com/a/20773910
has body: I try compiling it and it says no error. But when i run the program it says: Error: Main method not found in class TextBook, please define the main method as: public static void main(String[] args) so when i add the public static void main, the whole program has so many errors. import java.util.*; public class Book { private int pageNum; private String title; Date today = new Date(); public Book(int pn, String name) { pageNum = pn; title = name; } //Setter/Getter for pageNum public int getpageNum() { return pageNum; } public void setpageNum(int pn) { pageNum = pn; } //Setter/Getter for Title public String getTitle() { return title; } public void setTitle(String name) { title = name; } public void display() { System.out.println("Book.java" + "\nby Tyler " + today); System.out.println("Book Title: " + title + "\nNumber of Pages: " + pageNum); } } for TextBook.java public class TextBook extends Book { private String gradeLevel; public TextBook(int pageNum, String title, String gl) { super(pageNum, title); gradeLevel = gl; } //Setter/Getter for gradeLevel public String getGradeLevel() { return gradeLevel; } public void setGradeLevel(String g) { gradeLevel = g; } public void display() { super.display(); System.out.println("Grade Level: " + gradeLevel); } } for DemoBook.java public class DemoBook { public static void main(String[] args) { Book oneBook = new Book(250, "Awesome Story"); TextBook oneTextBook = new TextBook(350, "Awesomer Story", "12"); oneBook.display(); oneTextBook.display(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/31136823
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31136804
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/31136819
linked to: http://stackoverflow.com/q/19339088
has answer: http://stackoverflow.com/a/39521204
favorite count: 0
score: 0
has title: Error: Main method not found in class TextBook, please define the main method as: public static void main(String[] args)
has comment: http://stackoverflow.com/comment/31136826
has comment: http://stackoverflow.com/comment/31136774
has comment: http://stackoverflow.com/comment/31136790

http://stackoverflow.com/a/20769944
has body: If it's a single char, there is no need to use replaceAll, which uses a regular expression. Assuming "H is the character you want to replace": String line=testingarray.get(index).toString(); String cleanLine = line.replace("H", ""); update (after edit): since you already have an int array of unicodes you want to remove (i'm assuming the Integers are decimal value of the unicodes): String line=testingarray.get(index).toString(); int uniCodes[] = {1611,1614,1615,1616,1617,1618}; StringBuilder regexPattern = new StringBuilder("["); for (int uniCode : uniCodes) { regexPattern.append((char) uniCode); } regexPattern.append("]"); String result = line.replaceAll(regexPattern.toString(), "");
downvote count: 0
answers question: http://stackoverflow.com/q/20769908
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/31089991
comment on: http://stackoverflow.com/q/20746940
type: QuestionComment
has text: @CommonsWare Cmooon ! you are saying floats do not have trailing .0 ??? is this a joke ?
score: 0
type: Comment

http://stackoverflow.com/q/20817898
has title: getResponseCode - skip the actual wait?
has comment: http://stackoverflow.com/comment/31216278
has answer: http://stackoverflow.com/a/20817928
tagged with: java
type: Question
answer count: 1
has body: I paid someone for a little java work (I don't know java well) to send data from a java applet to a php script. She used the below code for this - and it works great, but the problem is that it hangs. It's not bad, but this is sending data every 3 seconds in a game that runs at 60 fps so the freeze is very noticeable. Is there any possible way to salvage this technique and keep the applet running full speed? private String sendHttpRequest(String value, String url) { try { // Use it for GET request. Rename/Add other parameters if you need. URL obj = new URL(url + "?q=" + value); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", "Mozilla/5.0"); // set any user agent that you want int responseCode = con.getResponseCode(); } catch (Exception e) { e.printStackTrace(); } return null; }
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/31211486
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20815261
has text: Can you connect to the port at all?
score: 0

communication
tag name: communication
tags question: http://stackoverflow.com/q/20755906
type: Tag
tags question: http://stackoverflow.com/q/20742652

http://stackoverflow.com/comment/31256536
type: Comment
has text: But my query still remains: Why does it work with old JDBC driver?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20839236

http://stackoverflow.com/comment/31240917
comment on: http://stackoverflow.com/a/20830938
type: AnswerComment
score: 0
type: Comment
has text: (In particular, the Deflater streams which use [DEFLATE](http://en.wikipedia.org/wiki/DEFLATE).)

http://stackoverflow.com/a/20690319
score: 0
type: AcceptedAnswer
type: Answer
has body: Change all the if and else if and put them inside switch(dir) { }. E.g change the `else if (dir == 3)` with case 3 : your code; break; and put them inside switch(dir) { } block.
accepted answer of: http://stackoverflow.com/q/20690273
answers question: http://stackoverflow.com/q/20690273

android-youtube-api
tags question: http://stackoverflow.com/q/20767713
tags question: http://stackoverflow.com/q/20760144
tag name: android-youtube-api
type: Tag

http://stackoverflow.com/comment/31084030
has text: where is your application-context.xml located? In WEB-INF/ or in src/main/resources/ ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20743901

http://stackoverflow.com/q/20708305
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31028241
has answer: http://stackoverflow.com/a/20710337
tagged with: spring
answer count: 1
tagged with: java
has body: I tried out Spring Batch with the Simple Spring Batch Project provided by STS. I added Spring's scheduling functionality and use PostgreSQL for storing metadata. I use a simple configuration and an example implementation of ItemReader and ItemWriter, as you can see below. The Job is defined to run every 15 seconds. While everything works well in the first iteration, reading and writing seems to be skipped in the subsequent iterations. Here is the job-config: &lt;batch:job id="job1"&gt; &lt;batch:step id="step1"&gt; &lt;batch:tasklet start-limit="100" transaction-manager="transactionManager"&gt; &lt;batch:chunk reader="reader" writer="writer" commit-interval="1" /&gt; &lt;/batch:tasklet&gt; &lt;/batch:step&gt; &lt;/batch:job&gt; &lt;!-- Run every 15 seconds --&gt; &lt;task:scheduled-tasks&gt; &lt;task:scheduled ref="testTask" method="run" cron="*/15 * * * * *" /&gt; &lt;/task:scheduled-tasks&gt; There you can see my reader and writer: @Component("reader") public class ExampleItemReader implements ItemReader&lt;String&gt; { private String[] input = {"Hello world!","Wow!", "Thats","cool!",null}; private int index = 0; public String read() throws Exception { if (index &lt; input.length) { return input[index++]; } else { return null; } } } @Component("writer") public class ExampleItemWriter implements ItemWriter&lt;Object&gt; { public void write(List&lt;? extends Object&gt; data) throws Exception { System.out.println("data: " + data); } } And this is the console output for iteration 1 and 2: &lt;Job: [FlowJob: [name=job1]] launched with the following parameters: [{date=Fri Dec 20 17:00:15 CET 2013}]&gt; &lt;Job execution starting: JobExecution: id=18, version=0, startTime=null, endTime=null, lastUpdated=Fri Dec 20 17:00:15 CET 2013, status=STARTING, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=18, version=0,JobParameters=[{date=Fri Dec 20 17:00:15 CET 2013}], Job=[job1]]&gt; &lt;Resuming state=job1.step1 with status=UNKNOWN&gt; &lt;Handling state=jo…
linked to: http://stackoverflow.com/q/18519645
score: 2
accepted answer: http://stackoverflow.com/a/20710337
downvote count: 0
tagged with: spring-tool-suite
tagged with: spring-batch
type: AnsweredQuestion
has title: Simple Spring Batch Job with scheduler: First iteration succeeds. Subsequent iterations fail

http://stackoverflow.com/a/40561698
upvote count: 15
has comment: http://stackoverflow.com/comment/68513191
has body: For those with this problem you to give read permission, add this to AndroidManifest.xml: android:name="android.permission.READ_EXTERNAL_STORAGE" and you should also grant permission from Settings > Apps > "Your app name" > Permissions > storage
type: Answer
answers question: http://stackoverflow.com/q/20714058
has comment: http://stackoverflow.com/comment/91081092
downvote count: 1
score: 14

http://stackoverflow.com/q/20835536
upvote count: 3
downvote count: 2
accepted answer: http://stackoverflow.com/a/20836018
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has body: i am newbie in android.this is JSONString i have stored locally in my project. public class MainActivity extends Activity { MenuFields menuFieldInstance[]; Gson gson = new Gson(); String jsonObjectString = "{\n\n\n [\n \"id\": 22,\n \"menu_id\": 1,\n \"field_type_id\": 1,\n \"c4w_code\": \"1234\",\n \"field_label\": \"Customer No\",\n \"field_values\": \"\",\n \"date_Created\": \"2012-09-16 05:11:23\",\n \"date_modified\": \"2013-11-20 10:33:23\",\n \"is_required\": 0,\n \"is_static\": 1,\n \"field_order\": 1\n ],\n [\n \"id\": 23,\n \"menu_id\": 1,\n \"field_type_id\": 1,\n \"c4w_code\": \"1234\",\n \"field_label\": \"Company Name\",\n \"field_values\": \"\",\n \"date_Created\": \"2012-09-16 05:11:56\",\n \"date_modified\": \"2013-11-20 10:33:23\",\n \"is_required\": 1,\n \"is_static\": 1,\n \"field_order\": 3\n ]\n\n}"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; Log.i("Json String for testing", "" + jsonObjectString); } private void getCustomerMenuFieldsData(String parameter) { menuFieldInstance = gson.fromJson(jsonObjectString, MenuFields[].class); for (int i = 0; i &lt; jsonObjectString.length(); i++) { Log.i("menuField Instance ", "" + menuFieldInstance[i].getId()); } } } please ignore mistakes of curly braces. i am getting Error.Here is the Logcat: 12-30 23:30:29.190: E/AndroidRuntime(15833): FATAL EXCEPTION: AsyncTask #3 12-30 23:30:29.190: E/AndroidRuntime(15833): java.lang.RuntimeException: An error occured while executing doInBackground() 12-30 23:30:29.190: E/AndroidRuntime(15833): at android.os.AsyncTask$3.done(AsyncTask.java:299) 12-30 23:30:29.190: E/AndroidRuntime(15833): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 12-30 23:30:29.190: E/AndroidRuntime(15833): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 12-30 23:30:29.190: E/AndroidRuntime(15833): at java.util.concurrent.FutureTask$S…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/20836018
tagged with: android
has title: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 .....Error when trying to Parse JSON using GSON in Android?

http://stackoverflow.com/comment/31213378
has text: @seb Added outer for loop to shift / rotate SensorEvents to get all combinations - I think ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20774139
type: Comment

http://stackoverflow.com/q/20722652
accepted answer: http://stackoverflow.com/a/20722665
has title: ANR when using ksoap2 to send data to web services
type: Question
has body: I am currently able of sending stuff into a server with ksoap2 library for android. Now I have the need to make sure that this line doesn't block the app and makes it ANR: androidHttpTransport.call(connection.getSOAP_ACTION(), envelope); If by any reason i cant reach the server (for example the server is shutdown) this call blocks the app. how can i treat this?
tagged with: java
tagged with: ksoap2
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/20722665
tagged with: android
type: AnsweredQuestion
tagged with: web-services

http://stackoverflow.com/comment/89708898
type: Comment
has text: See also [How to short-circuit a reduce() operation on a Stream?](https://stackoverflow.com/questions/32495069/how-to-short-circuit-a-reduce-operation-on-a-stream)
type: QuestionComment
comment on: http://stackoverflow.com/q/20746429
score: 0

http://stackoverflow.com/q/20774765
tagged with: date
has comment: http://stackoverflow.com/comment/31138461
type: Question
has comment: http://stackoverflow.com/comment/31138908
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/31138272
answer count: 2
has title: Passing current system time in javascript
has body: I am new to web application making a online examination website and have a script which is currently taking static date and time. I want it to the system current date and time plus(add current time with) a value from jsp variable(i.e the time interval of the examination) Currently my javascript is as follows:- &lt;script language="JavaScript"&gt; TargetDate = "12/26/2013 5:00 AM"; BackColor = "palegreen"; ForeColor = "navy"; CountActive = true; CountStepper = -1; LeadingZero = true; DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; FinishMessage = "It is finally here!"; &lt;/script&gt; Add i have a jsp variable "t" to be added to current time as to make the target time=current time + "t". Note- This is for countdown timer in my webpage. Thankyou.
linked to: http://stackoverflow.com/q/10211145
has comment: http://stackoverflow.com/comment/31138225
has comment: http://stackoverflow.com/comment/31139102
has answer: http://stackoverflow.com/a/20774868
has comment: http://stackoverflow.com/comment/31139276
type: UnansweredQuestion
tagged with: date-format
has answer: http://stackoverflow.com/a/20776802
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31138374

http://stackoverflow.com/comment/30987001
type: Comment
has text: Another Problem is that i just can access the matrix by integer for exampe matrix [0][0] = "Bla" or matrix [1][2] = "Bla1" , but how can I access the matrix like matrix[A][A] = " BlA" ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20689922

http://stackoverflow.com/q/20815987
has answer: http://stackoverflow.com/a/20819903
score: 3
has answer: http://stackoverflow.com/a/20816143
upvote count: 3
has answer: http://stackoverflow.com/a/20839030
tagged with: java
type: Question
tagged with: gwt
tagged with: listbox
has body: Is there a way to apply css style to GWT ListBox drop-down menu (ex: change color of some items) I can't do it by setting a style to whole ListBox because i wanna different style for each item! Result will be like that: &lt;select class="style1" id="test"&gt; &lt;option class="style2" value=""&gt;&amp;nbsp;&lt;/option&gt; &lt;option class="style2" value="AL"&gt;Alabama&lt;/option&gt; &lt;option class="style6" value="AK"&gt;Alaska&lt;/option&gt; &lt;option class="style6" value="AZ" class="red"&gt;Arizona&lt;/option&gt; &lt;option class="style6" value="AR"&gt;Arkansas&lt;/option&gt; &lt;option value="CA"&gt;California&lt;/option&gt; &lt;option value="CO"&gt;Colorado&lt;/option&gt; &lt;option value="CT"&gt;Connecticut&lt;/option&gt; &lt;option value="DE"&gt;Delaware&lt;/option&gt; &lt;/select&gt;
has title: Set style to GWT ListBox items
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22886897
tagged with: css
answer count: 4

http://stackoverflow.com/comment/30997202
score: 0
has text: @SethTisue Yes, thank you; I got confused because Scala requires an explicit type when making an anonymous subclass (which really has nothing to do with it being a constructor).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20696108

http://stackoverflow.com/q/20813737
score: 8
has answer: http://stackoverflow.com/a/20813770
possible better answer: http://stackoverflow.com/a/20813754
has body: &amp;&amp; is a short-circuit operator evaluated from left to right, so if the operand on the left side of &amp;&amp; operator is evaluated to false, evaluation should not continue. BUT I expected that the ++ should be evaluated before &amp;&amp; because it has higher precedence, and (from the link): Operators with higher precedence are evaluated before operators with relatively lower precedence. In that case, why doesn't count increment in the third line of this code? int mask = 2; int count = 0; if( !(mask &gt; 1) &amp;&amp; ++count &gt; 1) { mask += 100; } System.out.println(mask + " " + count);
has answer: http://stackoverflow.com/a/20813754
has answer: http://stackoverflow.com/a/20813884
has answer: http://stackoverflow.com/a/20813774
downvote count: 0
has comment: http://stackoverflow.com/comment/31213133
favorite count: 0
tagged with: operators
has answer: http://stackoverflow.com/a/20813961
accepted answer: http://stackoverflow.com/a/20813770
upvote count: 8
answer count: 5
has comment: http://stackoverflow.com/comment/31213099
tagged with: operator-precedence
type: AnsweredQuestion
tagged with: java
type: Question
has title: Java operator precendece confusion && and ++

http://stackoverflow.com/comment/33319940
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20700360
type: Comment
has text: @aknon, answered in question now.

http://stackoverflow.com/q/20717425
score: 2
type: AnsweredQuestion
tagged with: sql
downvote count: 0
tagged with: jsp
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/20717451
has body: I have 3 combobox defines date, month and year which user will input <%for(i=1;i<32;i++){%> <option value="<%=i%>"><%=i%> <%}%> January February March April May June July August September October November December <%for(i=2000;i<2015;i++){%> <option value="<%=i%>"><%=i%> <%}%> After that, the form post to doinsert.jsp and try to compare user input's date and today's date. If user input's date before today the variable isPast should be <0. However, when I try to input Dec 20,2013 (today is Dec 21,2013) the variable isPast is -1 which is right. When I try to input Dec 25,2013 (today is Dec 21,2013) the variable isPast is still -1 which is wrong (should be 1). When I try to input Jan 1,2014 (today is Dec 21,2013) the variable isPast is 1 which is right. I have the following code in doinsert.jsp: String date=request.getParameter("date"); String month=request.getParameter("month"); String year=request.getParameter("year"); String concatdate=year+"-"+month+"-"+date; SimpleDateFormat ft = new SimpleDateFormat("yyyy-mm-dd"); java.sql.Date newdate= new java.sql.Date(ft.parse(concatdate).getTime()); java.util.Date now=new java.util.Date(); int isPast=0; isPast=newdate.compareTo(now); What's wrong? Is there any mismatch date format between newdate and now?
tagged with: http://stackoverflow.com/tag/html
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/20717451
tagged with: date
has title: Date comparison in JSP

http://stackoverflow.com/a/20740925
score: 3
has body: Here the packaging is jar type, hence you need to use manifest plugin, in order to add dependencies into the Manifest.mf The problem here is that maven could find the dependencies in pom file and compile the source code and create the output jar. But when executing the jar, manifest.mf file contains no details of dependencies. Hence you got this error. This is a case of classpath errors. Here you can find the details on how to do it.
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/20740703
type: Answer

http://stackoverflow.com/comment/31222111
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20820995
type: AnswerComment
has text: Awesome! Works perfect!

http://stackoverflow.com/q/20770236
tagged with: java
has answer: http://stackoverflow.com/a/20774367
has body: I intend to check out all current properties(like fs.default.name, etc.) set for my hadoop. I've already googled on it, but with no luck. Is there any command that I can use? Thanks a lot!
type: Question
tagged with: hadoop
answer count: 2
score: 0
has title: How to see all the current enable properties in Hadoop?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20770677

tcp
type: Tag
tags question: http://stackoverflow.com/q/20720509
tags question: http://stackoverflow.com/q/20775200
tags question: http://stackoverflow.com/q/20774299
tags question: http://stackoverflow.com/q/20823115
tags question: http://stackoverflow.com/q/20732306
tags question: http://stackoverflow.com/q/20831881
tags question: http://stackoverflow.com/q/20760243
tags question: http://stackoverflow.com/q/20777965
tags question: http://stackoverflow.com/q/20840203
tags question: http://stackoverflow.com/q/20730915
tags question: http://stackoverflow.com/q/20777385
tags question: http://stackoverflow.com/q/20795169
tags question: http://stackoverflow.com/q/20717432
tags question: http://stackoverflow.com/q/20820771
tags question: http://stackoverflow.com/q/20751750
tag name: tcp

http://stackoverflow.com/comment/31123398
type: AnswerComment
type: Comment
has text: Actually List l is not even equivalent to List <?>. I messed up with the concept. Apology.
comment on: http://stackoverflow.com/a/20765843
score: 0

http://stackoverflow.com/comment/31087241
score: 0
has text: There seems to be a nice hole where all the documentation for using HTML in a JLabel should be. But, it really depends on how the renderer of the HTML is getting passed sizes. I'd be surprised if the default implementation signaled the HTML renderer every time the JLabel changed size. So... have fun with your custom renderer :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20734361

http://stackoverflow.com/a/20750481
answers question: http://stackoverflow.com/q/20748110
has body: I managed to fix the problem. The issue was that one of the change listeners in a completely different part of the program was synchronized. For some reason, that caused all other change listeners not to get the message, but leaving InvalidationListers in the clear. If anyone provides information on way this might be, I'm happy to accept that as an answer.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31167279
comment on: http://stackoverflow.com/q/20790900
type: Comment
type: QuestionComment
has text: The JVM had a "pre-cursor", it was called [p-code](http://en.wikipedia.org/wiki/P-code_machine). Microsoft's Common Language Runtime is another "platform independent" executable code.
score: 0

http://stackoverflow.com/comment/31265046
score: 1
comment on: http://stackoverflow.com/q/20835752
type: Comment
type: QuestionComment
has text: See my answer for the results of a small performance test I did on 4 of the listed answers.

http://stackoverflow.com/comment/31199364
type: Comment
has text: how do we get or calculate the inverse number ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20808893

http://stackoverflow.com/a/20713249
accepted answer of: http://stackoverflow.com/q/20713054
score: 2
has body: You can get a resource identifer from its name using the getIdentifier() method: for (int i = 0; i &lt;= 150; i++) imagesArray[i] = getResources().getIdentifier(String.valueOf(i), "drawable", "your.package.name");
downvote count: 0
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/20713054
type: Answer

http://stackoverflow.com/q/20827166
has comment: http://stackoverflow.com/comment/31233570
has comment: http://stackoverflow.com/comment/31233572
has comment: http://stackoverflow.com/comment/31233577
has comment: http://stackoverflow.com/comment/31233578
has answer: http://stackoverflow.com/a/20836395
has comment: http://stackoverflow.com/comment/31233533
answer count: 4
favorite count: 0
has body: TTLCache is a special type of cache where users can put objects in the cache with time to live The objects should automatically expire after their time to live Here is the Test code for the cache How can I destroy the object after certain time ? Here's the stub: public static void testTTLCache() throws Exception { TTLCache cache = null; /* replace with new YourClass() */ cache.put("key1", "value1", 5); cache.put("key2", "value2", 10); System.out.println(cache.get("key1")); // should print value1 System.out.println(cache.get("key2")); // should print value2 Thread.sleep(1000*6); System.out.println(cache.get("key1")); // should print NULL System.out.println(cache.get("key2")); // should print value2 Thread.sleep(1000*6); System.out.println(cache.get("key1")); // should print NULL System.out.println(cache.get("key2")); // should print NULL } Here is its interface on the basis of my requirement, offcourse you can add other method if you need any public interface TTLCache { /** * @param key - The key to associate with the cache * @param value - The actual value to store in the cache * @param timeToLiveSeconds - The time to live for this object in the cache */ public void put(String key, Object value, long timeToLiveSeconds); /** * Returns the Object in the cache that is associated with passed key, or NULL if * no value is associated with the key * @param key - The key associated with the value to retrieve * */ public Object get(String key); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20827483
has comment: http://stackoverflow.com/comment/31233752
score: 2
downvote count: 0
has title: Destroy the object in java after certain time
tagged with: java
has answer: http://stackoverflow.com/a/20827224
has answer: http://stackoverflow.com/a/20836255
type: Question
upvote count: 2

http://stackoverflow.com/comment/31197813
comment on: http://stackoverflow.com/q/20807731
score: 0
has text: try running the java executable (or your IDE) as administrator if your on windows. I know that getAbsolutePath() does funky stuff on some flavors of linux.
type: Comment
type: QuestionComment

vlc
tags question: http://stackoverflow.com/q/20728204
tag name: vlc
type: Tag
tags question: http://stackoverflow.com/q/20760900

http://stackoverflow.com/comment/30979226
type: Comment
score: 0
has text: This is some good info. I don't think the application will be complex enough to need that kind of logging, but there will no doubt be a situation I will need this in the future!
type: AnswerComment
comment on: http://stackoverflow.com/a/20686673

http://stackoverflow.com/q/20713673
has title: Random Number Generator - Android - xxx has stopped working
tagged with: random
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/20713690
has comment: http://stackoverflow.com/comment/31028868
tagged with: android
favorite count: 0
tagged with: generator
has comment: http://stackoverflow.com/comment/31028652
score: -3
has answer: http://stackoverflow.com/a/20713690
type: AnsweredQuestion
tagged with: numbers
tagged with: java
downvote count: 3
has body: public class MainActivity extends Activity { int minValue; int maxValue; int rndNum; TextView rndNumText = (TextView) findViewById(R.id.Number); EditText MinVal = (EditText) findViewById(R.id.editTextMin); EditText MaxVal = (EditText) findViewById(R.id.editTextMax); Button btnRandom = (Button) findViewById(R.id.Randomize); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnRandom.setOnClickListener(new View.OnClickListener() { public void onClick(View v){ minValue = Integer.parseInt(MinVal.getText().toString()); maxValue = Integer.parseInt(MaxVal.getText().toString()); Random r = new Random(); rndNum = r.nextInt(maxValue - minValue + 1) + minValue; rndNumText.setText(Integer.toString(rndNum)); } }); } @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; } } I get no errors so eclipse allows me to run the program but when it is about to execute, it gives me an error saying "Unfortunately, PROGRAM NAME has stopped." What did I do wrong? I would really appreciate your insight.
type: Question

http://stackoverflow.com/q/20728847
has body: I am seeing the code Java Builder Pattern. All things are good except below code: public static void main(String[] args) { NutritionFacts cocaCola = new NutritionFacts.Builder(240, 8) .calories(100).sodium(35).carbohydrate(27).build(); } NutritionFacts constructor is private and Builder inner class is static. So we can access this class using NutritionFacts.Builder but why does it uses new keyword like new NutritionFacts.Builder(240, 8)?.
possible better answer: http://stackoverflow.com/a/20728929
has answer: http://stackoverflow.com/a/20728929
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 1
has answer: http://stackoverflow.com/a/20728921
has title: Why does builder pattern use new keyword though its constructor is private?
answer count: 2
accepted answer: http://stackoverflow.com/a/20728921
upvote count: 1
tagged with: design-patterns
tagged with: java

http://stackoverflow.com/comment/31179273
type: Comment
has text: @user3138900 Make Sure this Package imported 1)import android.support.v4.app.FragmentActivity; 2)import com.google.android.gms.maps.SupportMapFragment;
type: AnswerComment
comment on: http://stackoverflow.com/a/20797739
score: 0

http://stackoverflow.com/comment/31112531
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20755416
has text: I don't think that's what the OP wanted - he needs all the transitive dependencies of core and api available at runtime in the combined war.

http://stackoverflow.com/comment/31236324
has text: yeah all of spelling every letter i got correct triple check! but on elseIf they got no Data found
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20828582

http://stackoverflow.com/a/20756882
answers question: http://stackoverflow.com/q/20756822
has body: Can't you just use RemoveList1.removeAll(Arrays.asList(RemoveList)); ?
score: 0
type: Answer

http://stackoverflow.com/comment/31162855
has text: I did what you say and now I have full table, but I need only 4-8 numbers in it. So I tried to solve in on way below, but it still gives me full table.
type: Comment
comment on: http://stackoverflow.com/a/20787779
type: AnswerComment
score: 0

http://stackoverflow.com/q/20799645
accepted answer: http://stackoverflow.com/a/20800610
tagged with: design-patterns
linked to: http://stackoverflow.com/q/20848082
linked to: http://stackoverflow.com/q/5739611
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20800610
tagged with: factory-method
tagged with: abstract-factory
tagged with: java
has comment: http://stackoverflow.com/comment/31182536
has body: I have read about Factory Method where Sub class creates needed Object and Abstract Factory has methods where concrete classes creates needed Object Factory Method public class PizzaStore { public Pizza orderPizza(String type) { Pizza pizza = createPizza(type); pizza.prepare(); pizza.bake(); pizza.cut(); } abstract Pizza createPizza(String type); } public NewYorkPizzaStore extends PizzaStore { public Pizza createPizza(String type) { Pizza pizza = null; if("cheese".equals(type)) { pizza = new CheesePizza(); } else if("onion".equals(type)) { pizza = new OnionPizza(); } return pizza; } } public class pizzaTestDriveByFactoryMethod() { public static void main(String args[]) { PizzaStore ps = new NewYorkPizzaStore(); ps.orderPizza("cheese"); } } Using a Factory public class NewYorkPizzaFactory extends PizzaFactory { public Pizza createPizza(String pizza) { Pizza pizza = null; if("cheese".equals(type)) { pizza = new CheesePizza(); } else if("onion".equals(type)) { pizza = new OnionPizza(); } return pizza; } } public class PizzaStore { PizzaFactory factory; public PizzaStore(PizzaFactory factory) { this.factory = factory } public Pizza orderPizza(String type) { Pizza pizza = factory.createPizza(type) pizza.prepare(); pizza.bake(); pizza.cut(); return pizza; } } public class pizzaTestDriveByAbstractFactory() { public static void main(String args[]) { PizzaFactory nwFactory = new NewYorkPizzaFactory(); PizzaStore ps = new PizzaStore(nwFactory); ps.orderPizza("cheese"); } } Same use case implemented using Factory Method and Abstract Factory. Why there should be a FactoryMethod instead of using Abstract Factory or a Utility Factory (Such as Chicago Factory/NewYorkFactory). In which case Factory method is useful on Abstract Method?
type: Question
has comment: http://stackoverflow.com/comment/31182749
has answer: http://stackoverflow.com/a/20800179
has title: Factory Method Vs Abstract Factory
has comment: http://stackoverflow.com/comment/31351597
score: 0
possible better answer: http://stackoverflow.com/a/20800179
answer count: 2
duplicate of: http://stackoverflow.com/q/5739611
has comment: http://stackoverflow.com/comment/31351555

http://stackoverflow.com/a/20765050
downvote count: 0
has body: What you really want is to have a modulus operation, rather than a remainder operator (What's the difference?). That will have the desired semantics for dealing with negative dividends. Fortunately, getting one from the other isn't too hard: public static int Modulus(int dividend, int divisor) { return (dividend % divisor + dividend) % divisor; } You can now write: int currentIndex = Modulus(currentIndex + 1, message.length); or int currentIndex = Modulus(currentIndex - 1, message.length);
upvote count: 2
answers question: http://stackoverflow.com/q/20764963
type: Answer
has comment: http://stackoverflow.com/comment/31121558
score: 2

http://stackoverflow.com/comment/72031243
type: AnswerComment
comment on: http://stackoverflow.com/a/20811193
type: Comment
has text: Tying a developer's hands like that is just bad library design. You don't know my use cases. Libraries should make it easy to write code, they should never prevent a developer from writing the code he wants to write. Also, almost every use of Espresso I know is for user interaction tests. Nobody uses it for unit testing. I'm not even convinced unit testing of a graphical component without user interactivity testing is remotely useful- a human looking at the component is far superior to an automated test.
score: 5

http://stackoverflow.com/comment/31155438
score: 0
type: AnswerComment
type: Comment
has text: It brings me to another question ( perhaps I should have added this to the title question) - Why did java ignore this CAS operation for concurrency, until java 1.5 , whereas cas instructions were supported by processors since early times, around 1970.
comment on: http://stackoverflow.com/a/20781327

http://stackoverflow.com/q/20767966
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20767985
linked to: http://stackoverflow.com/q/298909
has comment: http://stackoverflow.com/comment/31126792
has answer: http://stackoverflow.com/a/20767987
score: -1
answer count: 2
tagged with: assert
favorite count: 0
possible better answer: http://stackoverflow.com/a/20767985
has comment: http://stackoverflow.com/comment/31126822
has body: probably newbie error here. I copied the assert code directly from the book, but the AssertionError isn't being thrown. If I enter a value lower than 0or higher than 10 execution continues normally. import java.util.Scanner; public class AssertExample { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("enter a number between 0 and 10: "); int number = scanner.nextInt(); assert (number &gt;= 0 &amp;&amp; number &lt;= 10) : "bad number: " + number; System.out.println("You entered " + number); scanner.close(); } } enter a number between 0 and 10: -3 You entered -3
has title: Assert error in java
upvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20767987
downvote count: 1
linked to: http://stackoverflow.com/q/11415160

http://stackoverflow.com/comment/31204219
has text: This question appears to be off-topic because it is about benchmarking and isn't an actual question, just a blog post about how they are incorrectly micro-benchmarking something.
comment on: http://stackoverflow.com/q/20811169
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20751091
has title: Access another class variable in JAVA
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20751129
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31096690
tagged with: variables
has answer: http://stackoverflow.com/a/20751129
has answer: http://stackoverflow.com/a/20751170
has body: I have below Loginscreen for my application; (I use netbeans gui designer) public class loginscreen extends javax.swing.JFrame { /** * Creates new form loginscreen */ public loginscreen() { 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() { Uname_Textfield = new javax.swing.JTextField(); Password_PasswordField = new javax.swing.JPasswordField(); Bağlan_Buton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); Uname_Textfield.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Uname_TextfieldActionPerformed(evt); } }); Bağlan_Buton.setText("Bağlan"); Bağlan_Buton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Bağlan_ButonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(Uname_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(Password_PasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(54, 54, 54) .addComponent(Bağlan_Buton))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short…
possible better answer: http://stackoverflow.com/a/20751170

http://stackoverflow.com/comment/31110036
comment on: http://stackoverflow.com/a/20749334
score: 0
type: Comment
has text: debug string sd_card like Log.d("PATH", sd_card ); and check your log what it returns, and paste it here.
type: AnswerComment

http://stackoverflow.com/q/20847395
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/31271228
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20847477
has answer: http://stackoverflow.com/a/20847636
has comment: http://stackoverflow.com/comment/31271229
has title: Read online document in java
has comment: http://stackoverflow.com/comment/31271301
has answer: http://stackoverflow.com/a/20858309
has body: I am using URL url = new URL("http://www.puzzlers.org/pub/wordlists/pocket.txt"); Scanner s = new Scanner(url.openStream()); to read my document. But when I am trying to output the string then I am getting some unnecessary tags. My requirements is to be able to read the document as it is(i.e. without any unnecessary tags.) Below is the peice of code I have written: URL url = new URL("Link"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String str; String[] wordArray; int wordCount; while ((str = in.readLine()) != null) { System.out.println(str); wordArray = str.split("\\s+"); wordCount = wordArray.length; System.out.println("Word count is = " + wordCount); } in.close(); Below is the output I am getting. I donot want any unneccessary tags which you can see in the below output. I just want the actual text which you can see between tags. Unnecessary tags mean , etc. which you see in the below output snippet. I just want texts like 'UNITED STATES SECURITIES AND EXCHANGE' etc. in my string. Word count is = 1 &lt;P STYLE="font: 10pt/normal Arial, Helvetica, Sans-Serif; margin: 0; padding: 0; text-align: center"&gt;&lt;/P&gt; Word count is = 12 Word count is = 1 &lt;P STYLE="font: 10pt/normal Arial, Helvetica, Sans-Serif; margin: 0; padding: 0; text-align: center"&gt;&lt;B&gt;UNITED STATES SECURITIES AND EXCHANGE Word count is = 16 COMMISSION&lt;/B&gt;&lt;/P&gt; Word count is = 1 Word count is = 1 &lt;P STYLE="font: 10pt/normal Arial, Helvetica, Sans-Serif; margin: 0; padding: 0; text-align: center"&gt;&lt;B&gt;Washington, D.C. 20549&lt;/B&gt;&lt;/P&gt; Word count is = 14 Word count is = 1 &lt;P STYLE="font: 10pt/normal Arial, Helvetica, Sans-Serif; margin: 0; padding: 0; text-align: center"&gt;&lt;B&gt;&amp;nbsp;&lt;/B&gt;&lt;/P&gt; Word count is = 12
has answer: http://stackoverflow.com/a/20847457
score: 0
has comment: http://stackoverflow.com/comment/31271313
linked to: http://stackoverflow.com/q/240546

http://stackoverflow.com/comment/31068314
has text: Fixed it. The NPE is one line below... :P Thanks. I will mark this as the solution, because it would have been the RetentionPolicy overwise.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20735108
score: 0

http://stackoverflow.com/comment/31119361
has text: 1.) No, they don't work on Mac. 2.) Download from Oracle's site and run the installer.
comment on: http://stackoverflow.com/q/20764105
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31007460
has text: this r variable nothing, i edit the question
comment on: http://stackoverflow.com/q/20702370
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31033878
comment on: http://stackoverflow.com/q/20711579
score: 0
type: Comment
type: QuestionComment
has text: @chrylis unfortunately, it didn't in my case and I thought may be `throws Exception` is the culprit.

http://stackoverflow.com/comment/31005579
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20701449
has text: I want to get object not string

http://stackoverflow.com/a/20754558
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20754538
has body: which package name actually identifies your app/APK file? play store will take only Android manifest package. like package="com.example.appName" can the package names in your code be different to the package name in the manifest? yes, you can use different package for your code but need to give the absolute package name when declaring in manifest.xml android:name="org.demo.MyFile"
type: Answer
has comment: http://stackoverflow.com/comment/31102964
downvote count: 0

http://stackoverflow.com/a/20909719
type: Answer
answers question: http://stackoverflow.com/q/20821347
has body: I discovered some compatibility problems between primefaces and twitter bootstrap, so I replaced the primefaces modal with a boostrap modal but keeping the outputPanel in order to get updated the data and changed from r.libroelegito to accionesController.libroelegido. Here is the code: <?xml version="1.0" encoding="UTF-8"?> <h:body> <ui:composition template="./plantilla/plantillaPrincipal.xhtml"> <ui:define name="content"> <h:form id="form"> #{accionesController.tipo} <p:dataGrid var="r" value="#{accionesController.lista}" columns="3" rows="3" paginator="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="3,6,9"> <p:panel header="#{r.title}" style="text-align:center"> <h:panelGrid columns="1" style="width:100%"> <p:graphicImage value="/img/libros/#{r.ubicacion}.jpg"/> <h:outputText value="#{r.book_id}" /> <h:outputText value="#{r.author}" /> <p:commandButton icon="ui-icon-search" update=":form:carDetail" title="View Detail" k:data-toggle="modal" k:data-target="#vermasinformacion"> <f:setPropertyActionListener value="#{r}" target="#{accionesController.libroelegido}" /> </p:commandButton> </h:panelGrid> </p:panel> </p:dataGrid> <!--</p:dialog>--> <p:outputPanel id="carDetail" style="text-align:center;"> #{accionesController.libroelegido.title} <p:graphicImage value="/img/libros/#{accionesController.libroelegido.ubicacion}.jpg"/> <h:panelGrid columns="2" cellpadding="5" style="text-align: left"> <h:outputLabel for="idbook" value="Registro ISBN: " /> <h:outputText id="idbook" value="#{accionesController.libroelegido.book_id}002014" /> <h:outputLabel for="autorlibro" value="Autor :" /> <h:outputText id="autorlibro" value="#{accionesController.libroelegido.author}" /> <h:outputLabel for="preciolibro" value="Precio :" /> <h:outputText id="preciolibro" value="$ #{accionesController.libroelegido.price}" /> <h:commandButton value="Comprar" class="btn btn-primary"/…
accepted answer of: http://stackoverflow.com/q/20821347
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31220475
comment on: http://stackoverflow.com/a/20819316
score: 0
type: AnswerComment
has text: @Sage actually i added swing tag after this answer, this answer is fullcorrect i just append more information for this answer
type: Comment

http://stackoverflow.com/comment/31228173
type: QuestionComment
comment on: http://stackoverflow.com/q/20824022
score: 0
has text: @trashgod *"..the easily overlooked) title"* I'll typically open 9 or ten questions then (when time permits) actually return to each one. At that point, I ignore the titles & get directly into the body of it. The *only* reason I might thereafter notice the title is in searching for '?' in the page (which is a thing I commonly do - mostly because I want to jump direct to the point). ..Continuing my habit of amending posts to add the question into the body. (And prompting people to ensure there is at least one '?' before *"Know someone who can answer?"*.)
type: Comment

http://stackoverflow.com/comment/31270278
score: 0
type: AnswerComment
has text: @kasper_341 1) you cannot use local variables from one method in another; 2) int [] y = new int[ntotal] this is not really initialization, this creates an array with elements which are 0s only; in the other method they are not visible 3) in showGrades you use the class variable y
type: Comment
comment on: http://stackoverflow.com/a/20845424

http://stackoverflow.com/a/20823085
type: Answer
has comment: http://stackoverflow.com/comment/31265888
answers question: http://stackoverflow.com/q/20813645
has comment: http://stackoverflow.com/comment/31226538
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31241351
has comment: http://stackoverflow.com/comment/31240258
has comment: http://stackoverflow.com/comment/31265973
has comment: http://stackoverflow.com/comment/31266114
has body: hmm you're returning wrong cell cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { if (event.getClickCount() &gt; 1) { System.out.println("double clicked!"); // TODO GET THE OBJECT AND MAKE SQL QUERY IN ORDER TO MAKE NEW DIALOG WITH TableCell c = (TableCell) event.getSource(); System.out.println("Cell text: " + c.getText()); } } }); **return new EditingCell(); // replace this with return cell;** } };
downvote count: 0
has comment: http://stackoverflow.com/comment/31235827

http://stackoverflow.com/comment/31051600
type: QuestionComment
comment on: http://stackoverflow.com/q/20726118
has text: @Octopus try putting a "." inside else statement i have, you will see what i mean about the extra space.
score: 0
type: Comment

http://stackoverflow.com/q/20755058
tagged with: regex
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31104121
accepted answer: http://stackoverflow.com/a/20755084
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/20755077
has answer: http://stackoverflow.com/a/20755077
downvote count: 4
has comment: http://stackoverflow.com/comment/31103969
has body: Please help me why this regex is not working when it comes to date 20 in all years.But it works if I take date alone as seperate Regex.thanks in Advance. String regex = "^(0?[1-9]|[12][0-9]|3[01])?" ; checkRegex("02", regex); checkRegex("22", regex); checkRegex("20", regex); String regex1 = "^(((19\\d\\d)|([2-9]\\d\\d\\d))\\d\\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])?" ; checkRegex("19990802", regex1); checkRegex("19990822", regex1); checkRegex("19990820", regex1); Output : 02::::^(0?[1-9]|[12][0-9]|3[01])?::::true 22::::^(0?[1-9]|[12][0-9]|3[01])?::::true 20::::^(0?[1-9]|[12][0-9]|3[01])?::::true 19990802::::^(((19\d\d)|([2-9]\d\d\d))\d\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])?::::true 19990822::::^(((19\d\d)|([2-9]\d\d\d))\d\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])?::::true 19990820::::^(((19\d\d)|([2-9]\d\d\d))\d\d)(0?[1-9]|1[012])(0?[1-9]|[12][0-9]|3[01])?::::false
has comment: http://stackoverflow.com/comment/31103878
favorite count: 0
linked to: http://stackoverflow.com/q/4766845
has answer: http://stackoverflow.com/a/20755084
has title: Java regex yyyymmdd validation
score: -3

http://stackoverflow.com/q/20813661
has comment: http://stackoverflow.com/comment/31208322
favorite count: 0
upvote count: 3
tagged with: io
has answer: http://stackoverflow.com/a/20813888
has title: How can I read a String including new line from InputStream object in Java?
has comment: http://stackoverflow.com/comment/31208331
downvote count: 0
possible better answer: http://stackoverflow.com/a/20813696
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20813711
accepted answer: http://stackoverflow.com/a/20813711
tagged with: java
tagged with: inputstream
has body: I have a ServerSocket in Java: ServerSocket serverSocket = new ServerSocket(1000); which accepts a clientSocket: Socket clientSocket; clientSocket = serverSocket.accept(); Up until now I was reading the input like this: BufferedReader clientSocketInputStream = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while ((inputLine = clientSocketInputStream.readLine()) != null){ String message = inputLine; // Hack the computer connecting to this one after here However if the text sent is something like String stringToBeSent = "Hello\nHowareyou"; then I am in trouble. Because I need this text as it is. 2 different Strings do not help me. How can I read it as it is? Thanks.
answer count: 3
has answer: http://stackoverflow.com/a/20813696

http://stackoverflow.com/comment/31052180
score: 0
type: AnswerComment
has text: Ok I have this. if (ArrayUtils.isEquals(handlebars,input)) but eclipse tells me ArrayUtils isnt resolved. Am I not using this correctly.
type: Comment
comment on: http://stackoverflow.com/a/20726158

http://stackoverflow.com/comment/31311277
type: Comment
has text: Did you really read it? The _proprietory_ API is removed in 8.0, not the new JSR356 API.
comment on: http://stackoverflow.com/a/20837798
score: 0
type: AnswerComment

http://stackoverflow.com/a/20692716
accepted answer of: http://stackoverflow.com/q/20680860
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/42934665
answers question: http://stackoverflow.com/q/20680860
has body: Is there a specific reason to add ?wsdl to your endpoint address? Response from server(http://api.notificationmessaging.com/NMSOAP/NotificationService) is, not what you expected but definitely not WSLD <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:sendObjectsWithFullStatusResponse xmlns:ns2="http://api.service.nsapi.emailvision.com/"> Query random: 4A776E3602000078 doesnt match with notification random: {1} !!! Query random: 4A776E3602000078 doesnt match with notification random: {1} !!! </ns2:sendObjectsWithFullStatusResponse> </soap:Body> </soap:Envelope>
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/20689546
tagged with: jks
upvote count: 4
linked to: http://stackoverflow.com/q/20554567
accepted answer: http://stackoverflow.com/a/20790637
has comment: http://stackoverflow.com/comment/31017289
tagged with: ssl
tagged with: truststore
has body: I am trying to configure my cxf-based client to communicate with a web service I have written (also cxf-based). The web service itself works flawlessly, tested via soapUI. The client, however, builds fine but upon invocation throws a SunCertPathBuilderException. Suspecting this has to do with providing a valid path to a trustore that contains the server's cert, with a valid certificate chain to a trusted cert, I first tried to export that server's certificate to a PFX so that I can import it to the project's own .jks. That turned out to be impossible because it requires a private key which the exporting utility (certmgr.msc) greys out for some reason. So I tried to tackle the problem from a different direction: I know that soapUI has no problem communicating with the web service over SSL, and I didn't install any certificate for it, so it must be satisfied with a root certificate (CA) already present in its cacerts file. But... the http:conduit section my CXF-based application context .xml requires a JKS type keystore... so it looks like I am in a catch 22 situation. Unless a cacerts file is of JKS type? If not, is there a way to convert or export a certificate from a cacerts to a .jks? What is the right way of solving this?
has comment: http://stackoverflow.com/comment/30989342
has comment: http://stackoverflow.com/comment/31021784
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31010959
has comment: http://stackoverflow.com/comment/30990011
downvote count: 0
linked to: http://stackoverflow.com/q/8887434
favorite count: 0
has comment: http://stackoverflow.com/comment/30989259
type: Question
has comment: http://stackoverflow.com/comment/31022143
has answer: http://stackoverflow.com/a/20790637
has comment: http://stackoverflow.com/comment/30989292
score: 4
has comment: http://stackoverflow.com/comment/30990586
tagged with: cxf
has title: cacerts vs. jks in a cxf-based client
tagged with: java
answer count: 1

http://stackoverflow.com/comment/30998242
type: AnswerComment
comment on: http://stackoverflow.com/a/20679979
has text: inside the getView() of your grid adapter.refer edited answer
type: Comment
score: 0

http://stackoverflow.com/comment/31238868
score: 0
has text: You should override hasCode and equals in your `MyDateClass` code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20829871

http://stackoverflow.com/a/20807657
has comment: http://stackoverflow.com/comment/31615366
has comment: http://stackoverflow.com/comment/60254073
has comment: http://stackoverflow.com/comment/76947466
downvote count: 2
has comment: http://stackoverflow.com/comment/31198001
type: Answer
has comment: http://stackoverflow.com/comment/34220714
has comment: http://stackoverflow.com/comment/61363966
has comment: http://stackoverflow.com/comment/31419350
has comment: http://stackoverflow.com/comment/31837112
has comment: http://stackoverflow.com/comment/45746401
has comment: http://stackoverflow.com/comment/58751422
has comment: http://stackoverflow.com/comment/33706025
has comment: http://stackoverflow.com/comment/31995682
has comment: http://stackoverflow.com/comment/33661465
has comment: http://stackoverflow.com/comment/71836004
answers question: http://stackoverflow.com/q/20794751
has comment: http://stackoverflow.com/comment/67129193
has comment: http://stackoverflow.com/comment/32802277
score: 50
has comment: http://stackoverflow.com/comment/32819712
has comment: http://stackoverflow.com/comment/77248683
has comment: http://stackoverflow.com/comment/33661482
upvote count: 52
has comment: http://stackoverflow.com/comment/71836665
has comment: http://stackoverflow.com/comment/74584407
has body: From what I've found online, this is a bug introduced in JDK 1.7.0_45. It appears to also be present in JDK 1.7.0_60. A bug report on Oracle's website states that, while there was a fix, it was removed before the JDK was released. I do not know why the fix was removed, but it confirms what we've already suspected -- the JDK is still broken. The bug report claims that the error is benign and should not cause any run-time problems, though one of the comments disagrees with that. In my own experience, I have been able to work without any problems using JDK 1.7.0_60 despite seeing the message. If this issue is causing serious problems, here are a few things I would suggest: Revert back to JDK 1.7.0_25 until a fix is added to the JDK. Keep an eye on the bug report so that you are aware of any work being done on this issue. Maybe even add your own comment so Oracle is aware of the severity of the issue. Try the JDK early releases as they come out. One of them might fix your problem. Instructions for installing the JDK on Mac OS X are available at JDK 7 Installation for Mac OS X. It also contains instructions for removing the JDK.
has comment: http://stackoverflow.com/comment/33698143
has comment: http://stackoverflow.com/comment/56190055
has comment: http://stackoverflow.com/comment/69884575
has comment: http://stackoverflow.com/comment/81839548

http://stackoverflow.com/comment/31246782
comment on: http://stackoverflow.com/a/20834090
score: 0
type: AnswerComment
type: Comment
has text: @Makoto you are right, what I provide is just an idea to use JSTL, there would be much better solution in using JSTL

http://stackoverflow.com/a/20790393
answers question: http://stackoverflow.com/q/20790360
has comment: http://stackoverflow.com/comment/31376848
accepted answer of: http://stackoverflow.com/q/20790360
score: 5
upvote count: 5
has body: By making a method abstract, it means that people have to implement it. You require people to do so and it is impossible for people to forget to do so, as it will fail to compile if they do. The @override annotation exists for a very similar reason, by marking a method as @override you get an error if (for example) you typed the method name wrong and aren't actually overriding something. In many ways the abstract class is half way between an interface and a normal class - it defines what you need to do to use it in the same way an interface does, but it also handles some of the implementation for you. Classes can only extend one other class. They can implement any number of interfaces. For example you might have MotorVehicle inherited by Car, Motorbike and Train - but then you might have a Steerable interface implemented by Car, Motorbike and Pedalbike. To answer the question in the comments: If there is an Interface "I" having method m() which is implemented by class "A" and another class "B" wants to access the method m(), what is the need of interface here. Can we simply not implement that method in class A? You can - but if on the other hand class B wants to access the method m() in both a class A and class C (where A and C don't inherit from each other or a common class containing m()) then the way to do that is to specify a common interface I and class B uses the interface type, I, not the types A and C at all. Also remember that interfaces can be used between packages and libraries. For example Listener and Strategy patterns make heavy use of interfaces. When the Java developers wrote JButton (for example) the ActionLstener is specified as an Interface to provide maximum flexibility to people using JButtons in the future.
type: AcceptedAnswer
downvote count: 0
type: Answer

arraylist
tags question: http://stackoverflow.com/q/20714869
tags question: http://stackoverflow.com/q/20756822
tags question: http://stackoverflow.com/q/20795040
tags question: http://stackoverflow.com/q/20849657
tags question: http://stackoverflow.com/q/20847997
tags question: http://stackoverflow.com/q/20714238
tags question: http://stackoverflow.com/q/20805233
tags question: http://stackoverflow.com/q/20801248
tags question: http://stackoverflow.com/q/20765148
tags question: http://stackoverflow.com/q/20692500
tags question: http://stackoverflow.com/q/20823808
tags question: http://stackoverflow.com/q/20795411
tags question: http://stackoverflow.com/q/20771106
tags question: http://stackoverflow.com/q/20826015
tags question: http://stackoverflow.com/q/20750746
tags question: http://stackoverflow.com/q/20792111
tags question: http://stackoverflow.com/q/20715537
tags question: http://stackoverflow.com/q/20818500
tags question: http://stackoverflow.com/q/20686653
tags question: http://stackoverflow.com/q/20808673
tags question: http://stackoverflow.com/q/20737541
tags question: http://stackoverflow.com/q/20811036
tags question: http://stackoverflow.com/q/20766430
tags question: http://stackoverflow.com/q/20819937
tags question: http://stackoverflow.com/q/20711789
tags question: http://stackoverflow.com/q/20704202
tags question: http://stackoverflow.com/q/20765227
tags question: http://stackoverflow.com/q/20849120
tags question: http://stackoverflow.com/q/20702071
tags question: http://stackoverflow.com/q/20837053
tags question: http://stackoverflow.com/q/20788265
tags question: http://stackoverflow.com/q/20722516
tags question: http://stackoverflow.com/q/20757988
tags question: http://stackoverflow.com/q/20800231
tags question: http://stackoverflow.com/q/20684485
tags question: http://stackoverflow.com/q/20680674
tags question: http://stackoverflow.com/q/20847436
tags question: http://stackoverflow.com/q/20818552
tags question: http://stackoverflow.com/q/20829473
tags question: http://stackoverflow.com/q/20829975
tags question: http://stackoverflow.com/q/20688281
tags question: http://stackoverflow.com/q/20739346
tags question: http://stackoverflow.com/q/20832814
tags question: http://stackoverflow.com/q/20757016
tags question: http://stackoverflow.com/q/20782867
tags question: http://stackoverflow.com/q/20806460
tags question: http://stackoverflow.com/q/20736420
tags question: http://stackoverflow.com/q/20749896
tags question: http://stackoverflow.com/q/20773850
tags question: http://stackoverflow.com/q/20708358
tags question: http://stackoverflow.com/q/20753178
tags question: http://stackoverflow.com/q/20836369
tags question: http://stackoverflow.com/q/20825467
tags question: http://stackoverflow.com/q/20839090
tags question: http://stackoverflow.com/q/20691757
tags question: http://stackoverflow.com/q/20847980
tags question: http://stackoverflow.com/q/20769904
tags question: http://stackoverflow.com/q/20747191
type: Tag
tags question: http://stackoverflow.com/q/20705826
tags question: http://stackoverflow.com/q/20829001
tags question: http://stackoverflow.com/q/20787047
tags question: http://stackoverflow.com/q/20755432
tags question: http://stackoverflow.com/q/20772190
tags question: http://stackoverflow.com/q/20826972
tags question: http://stackoverflow.com/q/20821112
tag name: arraylist
tags question: http://stackoverflow.com/q/20702635
tags question: http://stackoverflow.com/q/20683894
tags question: http://stackoverflow.com/q/20826190
tags question: http://stackoverflow.com/q/20748848
tags question: http://stackoverflow.com/q/20738079
tags question: http://stackoverflow.com/q/20690104
tags question: http://stackoverflow.com/q/20814002
tags question: http://stackoverflow.com/q/20823527
tags question: http://stackoverflow.com/q/20709690

http://stackoverflow.com/comment/31032013
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20696299
type: QuestionComment
has text: @DanielC.Sobral, there is other error occurring sometimes.

http://stackoverflow.com/comment/31161560
has text: i will try that but can you tell me why i got this exception and why i need to use the proxyMode solution, i have lots of view beans scoped by spring and implements serializable but only this bean gives exception and i am curious to know the reason and should i do that for all my view beans scoped by spring ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20788020

http://stackoverflow.com/comment/31007437
comment on: http://stackoverflow.com/q/20702370
has text: i want the source from a url request. If i go in my browser and view the source it works i see the source and in the source there is a table with a id=shortlist. So i try in Java to get this source but not works in my way
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/20686081
answers question: http://stackoverflow.com/q/20686040
has comment: http://stackoverflow.com/comment/30978387
upvote count: 2
type: Answer
score: 2
has body: This block else if (????????) {str="Word not found!";} //Remove this line should be like this move this code out of for loop for (int i = 0; i &lt; argi.length; i++){ } str="Word not found!";
downvote count: 0

http://stackoverflow.com/q/20745387
has comment: http://stackoverflow.com/comment/31085702
has answer: http://stackoverflow.com/a/56841103
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20745456
type: Question
tagged with: java
has title: Xor of binary strings in java
has body: i am using the following code to XOR 2 strings String lseq = "0011111111101111111111111100101101111100110000001011111000010100"; String tseq = "0011111111100000110011001100110011001100110011001100110011001100"; StringBuilder sb = new StringBuilder(); for(int i = 0; i &lt; lseq.length(); i++) sb.append((lseq.charAt(i) ^ tseq.charAt(i))); String result = sb.toString(); System.out.println(result); The above code gives me correct output : 0000000000001111001100110000011110110000000011000111001011011000 I need to XOR one more string String hseq = "0011111111110010010111110100010111100000101101001110000100011110"; if i try sb.append((lseq.charAt(i) ^ tseq.charAt(i) ^ hseq.charAt(i)); I am getting result : 48484848484848484848484948484948494848494848494949484848494848494848494849494848484949494948484848484948494948494949484948484948 which is wrong. I need help in doing xor of 3 binary strings
answer count: 3
has comment: http://stackoverflow.com/comment/31085681
accepted answer: http://stackoverflow.com/a/20745456
downvote count: 0
favorite count: 0
upvote count: 8
possible better answer: http://stackoverflow.com/a/56841103
has answer: http://stackoverflow.com/a/20745413

http://stackoverflow.com/comment/31071626
comment on: http://stackoverflow.com/q/20737099
has text: Sure. Please edit and show us your code.
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/69656729
answers question: http://stackoverflow.com/q/20773850
score: 1
upvote count: 1
has body: This is straightforward &amp; simple in Kotlin. val typeDataModelClass = Array&lt;DataModelClass&gt;::class.java
downvote count: 0
type: Answer

http://stackoverflow.com/q/20815388
tagged with: itext
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31211520
score: 0
answer count: 2
has body: I already created table using iText in java. But I want to create two parallel tables for one of my projects. Can anyone tell me the solution to create two parallel tables using iText please?
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/20815705
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20819096
has title: Does anyone know how to create two parallel tables using iText in JAVA?

http://stackoverflow.com/comment/31148106
type: QuestionComment
comment on: http://stackoverflow.com/q/20779743
has text: Yes Rafa El. after pressing ENTER the studID+=1 must be executed in order for the student number to increase. but after I press ENTER nothing happen..
score: 0
type: Comment

http://stackoverflow.com/comment/31187641
comment on: http://stackoverflow.com/q/20802147
has text: Edited original post.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/20775858
type: Question
has answer: http://stackoverflow.com/a/20776483
possible better answer: http://stackoverflow.com/a/20776116
has answer: http://stackoverflow.com/a/20775885
has title: finally-block and thread suspension
has body: I've noticed that in Java if the current thread is beeing suspended within a try-block the corresponding finally block is not being executed such as in Semaphore lock = new Semaphore(0); try { lock.acquire(); } finally { // do something } Can this observation be generalized to the suspension of threads i.e. is it true what the Oracle doc says that it can only used to bypass return, break and continue? Oracle doc. says: But finally is useful for more than just exception handling — it allows the programmer to avoid having cleanup code accidentally bypassed by a return, continue, or break.
has answer: http://stackoverflow.com/a/20776116
answer count: 3
downvote count: 0
linked to: http://stackoverflow.com/q/12430642
tagged with: finally
favorite count: 0
accepted answer: http://stackoverflow.com/a/20775885
linked to: http://stackoverflow.com/q/464098
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: multithreading
upvote count: 7

http://stackoverflow.com/comment/36140929
score: 0
type: Comment
has text: Upvoting clear answer that manages to both reference the documentation and solve the problem within a few lines. :)
comment on: http://stackoverflow.com/a/20814331
type: AnswerComment

ms-access-2013
tags question: http://stackoverflow.com/q/20816947
type: Tag
tag name: ms-access-2013

http://stackoverflow.com/a/20709231
has comment: http://stackoverflow.com/comment/31020636
type: Answer
has comment: http://stackoverflow.com/comment/31020984
has comment: http://stackoverflow.com/comment/31020876
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20709050
answers question: http://stackoverflow.com/q/20709050
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31020464
downvote count: 0
has body: You should be able to use Direct Mapping, something like; import com.sun.jna.*; public class MyClass { public static native boolean isDisconnected(); static { Native.register("theDLL"); } public static void main(String[] args) { MyClass.isDisconnected(); } }

http://stackoverflow.com/a/20827626
answers question: http://stackoverflow.com/q/20827522
has body: You should use a floating view. For instance, to display a square view with 3dp margin top and 40dp margin right (wm is the WindowManager instance): private void addMyView(int height) { int marginTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, getResources().getDisplayMetrics()); int marginRight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, getResources().getDisplayMetrics()); try { WindowManager.LayoutParams params = new WindowManager.LayoutParams( width, height,marginRight,marginTop, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT); params.gravity = Gravity.RIGHT | Gravity.TOP; wm.addView(view, params); }catch(Exception e){ } } EDIT: To remove the view you can call: wm.removeViewImmediate(view); EDIT: Dont forget the permission: &lt;uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/&gt; Hope it helps.
score: 0
type: Answer

http://stackoverflow.com/a/20790193
answers question: http://stackoverflow.com/q/20790109
type: Answer
score: 2
upvote count: 2
has body: There are two ways to do that, the first is to check the source on the event object and see which combo box it matches to. The alternative is to add a different listener into each combo box, then you know that any calls going into one listener are from the corresponding control. This is a good use for an anonymous inner class.
downvote count: 0

http://stackoverflow.com/comment/31073513
has text: Sharing you PATH variable value is a good idea to have 5his fixed asap.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20738264

http://stackoverflow.com/a/20740559
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/20705773
has body: I solved it by using a normal Activity instead of PreferenceActivity.
accepted answer of: http://stackoverflow.com/q/20705773

http://stackoverflow.com/a/20782073
answers question: http://stackoverflow.com/q/20780096
downvote count: 0
type: Answer
upvote count: 1
has body: I Used this link to resolve the solution &amp; ansewr of saa also helped i just selected all the options in the screenshot below
score: 1

http://stackoverflow.com/comment/31110013
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20758505
has text: it is pretty easy, except whatever I do it's either an error or just doesn't work
score: 0

http://stackoverflow.com/q/20784531
answer count: 4
has answer: http://stackoverflow.com/a/20790524
favorite count: 0
has comment: http://stackoverflow.com/comment/51254660
has comment: http://stackoverflow.com/comment/31155298
tagged with: tomcat7
has answer: http://stackoverflow.com/a/20817810
has comment: http://stackoverflow.com/comment/31155279
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/51254659
tagged with: java
has title: Jersey Services with Tomcat and Eclipse
has comment: http://stackoverflow.com/comment/31155241
has comment: http://stackoverflow.com/comment/31155342
tagged with: eclipse
type: Question
upvote count: 4
tagged with: jersey
has comment: http://stackoverflow.com/comment/31155519
has body: I'm developing a rest service with Jersey 2.0 (I downloaded from http://repo1.maven.org/maven2/org/glassfish/jersey/bundles/jaxrs-ri/2.5/jaxrs-ri-2.5.zip) and I'm using Tomcat 7.0.47. I run Tomcat from Eclipse and my machine is a Mac. I'm using the Eclipse tool to generate a WAR and to deploy the service. This is my web.xml: <?xml version="1.0" encoding="UTF-8"?> MyServices Jersey REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.service.services.Services 1 Jersey REST Service /services/* I include all Jersey jars into WEB-INF/lib, except javax.servlet-api-3.0.1.jar that it is into Apache/lib When I deploy in Tomcat, it shows a very strange error caused by: Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.ClientConfig at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) ... 70 more
score: 4
has answer: http://stackoverflow.com/a/20799996
has comment: http://stackoverflow.com/comment/31155361
has answer: http://stackoverflow.com/a/25116632
has comment: http://stackoverflow.com/comment/51254661
accepted answer: http://stackoverflow.com/a/20799996
has comment: http://stackoverflow.com/comment/31155555
downvote count: 0
tagged with: jersey-2.0
linked to: http://stackoverflow.com/q/20762707
possible better answer: http://stackoverflow.com/a/20790524

http://stackoverflow.com/comment/98033559
type: AnswerComment
has text: come to think of it. I'm pretty sure that I have the right code and debugging this for hours, and changing my codes along the way. Turns out I was just missing the square brackets to indicate my post is an array.Arrg. Well I guess this is a newbies curse, LOL. To anyone new to JSON and Spring Data, don't follow my footsteps. :(
comment on: http://stackoverflow.com/a/20838816
type: Comment
score: 0

http://stackoverflow.com/a/78253918
has comment: http://stackoverflow.com/comment/137980525
has comment: http://stackoverflow.com/comment/137972861
score: 0
answers question: http://stackoverflow.com/q/20694915
type: Answer
has body: Try this one. Its working for me File file = new File(path); FileInputStream fis = new FileInputStream(file); XSSFWorkbook wb = new XSSFWorkbook(fis); XSSFSheet sh = wb.getSheetAt(0); Row row1 = sh.createRow(row); Cell cell = row1.createCell(column); if(cell == null) { cell = sh.getRow(row).createCell(column); } else{ sh.getRow(row).createCell(column).setCellValue(value); }

jbutton
tags question: http://stackoverflow.com/q/20725180
tags question: http://stackoverflow.com/q/20734738
tags question: http://stackoverflow.com/q/20818906
tags question: http://stackoverflow.com/q/20737099
tags question: http://stackoverflow.com/q/20772847
tags question: http://stackoverflow.com/q/20726028
tags question: http://stackoverflow.com/q/20810798
tags question: http://stackoverflow.com/q/20737064
tags question: http://stackoverflow.com/q/20823511
tags question: http://stackoverflow.com/q/20831759
type: Tag
tags question: http://stackoverflow.com/q/20688329
tags question: http://stackoverflow.com/q/20832462
tags question: http://stackoverflow.com/q/20723581
tags question: http://stackoverflow.com/q/20799131
tags question: http://stackoverflow.com/q/20706952
tags question: http://stackoverflow.com/q/20820685
tags question: http://stackoverflow.com/q/20716356
tags question: http://stackoverflow.com/q/20733251
tag name: jbutton
tags question: http://stackoverflow.com/q/20758250
tags question: http://stackoverflow.com/q/20774628
tags question: http://stackoverflow.com/q/20715095

http://stackoverflow.com/comment/31236808
score: 0
type: Comment
has text: but on my database have many staff accounts only staff can't recognice on PS
comment on: http://stackoverflow.com/a/20828582
type: AnswerComment

http://stackoverflow.com/q/20757966
favorite count: 0
has comment: http://stackoverflow.com/comment/31110064
tagged with: download
tagged with: android
has comment: http://stackoverflow.com/comment/31110043
answer count: 0
has comment: http://stackoverflow.com/comment/31113266
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31109085
type: Question
has comment: http://stackoverflow.com/comment/31110227
has comment: http://stackoverflow.com/comment/31109040
has title: how to send file from pc to android device with socket coding server side code with delphi
tagged with: delphi
has body: I wrote a simple code in Delphi to send and receive wav file between server and client and it works fine. and i wrote a simple code in android to receive file from server but it does not work. Here is the code: this my server code in Delphi: procedure TfrmServer.TCPServerExecute(AThread: TIdPeerThread); var InputString:String; FFilePath,AFullFileName:string; AFileStream:TStream; begin FFilePath:='D:\pic1\'; InputString := AThread.Connection.ReadLn; if InputString = 'WAV' then begin Edit1.Text:=inttostr(strtoint(Edit1.Text)+1); Edit2.Text:='connected'; AFullFileName := FFilePath + 'ad.wav'; AFileStream := TFileStream.Create(AFullFileName, fmOpenRead or fmShareDenyNone); try AThread.Connection.WriteStream(AFileStream, True, True); // AThread.Connection.Write(UTF8Encode(TempStr)); finally AFileStream.Free; end; end; AThread.Connection.Disconnect; end; and client code in delphi work fine: procedure TForm2.Button1Click(Sender: TObject); var FFilePath:string; AFileStream:TStream; begin if TCPClient.Connected then TCPClient.Disconnect; TCPClient.Host := '127.0.0.1'; TCPClient.Port := 8090; FFilePath:='.\'; if FileExists(FFilePath + '1.wav') then DeleteFile(FFilePath + '1.wav'); AFileStream := TFileStream.Create(FFilePath + '1.wav', fmCreate); try try TCPClient.Connect; try TCPClient.WriteLn('PIC'); TCPClient.ReadStream(AFileStream, -1, False); finally TCPClient.Disconnect; end; finally AFileStream.Free; end; except DeleteFile(FFilePath + '1.wav'); end; end; and this my Java code for Android: final Button send = (Button) findViewById(R.id.bSend); final TextView status = (TextView) findViewById(R.id.tvStatus); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Socket s = null; // BufferedInputStream get = null; try { s = new Socket("192.168.1.2", 8090); status.setText("74"); get = new BufferedReader(new InputStreamReader(s.getInputStream(),"UTF-")); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(s.getOutputStream(…
has comment: http://stackoverflow.com/comment/31109148
has comment: http://stackoverflow.com/comment/31110441
tagged with: delphi-6
downvote count: 0

http://stackoverflow.com/comment/31164757
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/20789699
has text: You can use the black and white as an alpha mask (whiter means ligher green, black means darker green or vice-versa). See http://stackoverflow.com/questions/221830/set-bufferedimage-alpha-mask-in-java for one approach

http://stackoverflow.com/comment/30991800
type: Comment
has text: :) You are very attentive!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20693259

http://stackoverflow.com/a/20717478
has comment: http://stackoverflow.com/comment/31070720
has comment: http://stackoverflow.com/comment/31035785
type: Answer
answers question: http://stackoverflow.com/q/20717402
has comment: http://stackoverflow.com/comment/31035607
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31035711
has comment: http://stackoverflow.com/comment/31035970
has body: UPDATE Solution if the timer needs to start from beginning every second time: public class YourOuterClass extends Activity { private YourTimerTask mTimerTask; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button button; button.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (mTimerTask != null &amp;&amp; mTimerTask.isTaskActive()) { mTimerTask.deactivateTimer(); mTimerTask = null; } else { startTask(); } } }); ... } private class YourTimerTask extends TimerTask { private boolean mIsTimerActive; public YourTimer() { mIsTimerActive = true; } public void deactivateTimer() { mIsTimerActive = false; } public boolean isTaskActive() { return mIsTimerActive; } @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { String workingTime = "Your effort is " + format.format(Double.valueOf(hr)) + ":" + format.format(Double.valueOf(min)) + ":" + format.format(Double.valueOf(sec)) + " till now for the day"; if (!mIsTimerActive) { cancel(); // will cancel this timer instance } sec++; if (sec &gt; 59) { sec = 0; min = min + 1; } if (min &gt; 59) { min = 0; hr = hr + 1; } } }); } } ... private void startTask() { Timer T = new Timer(); mTimerTask = new YourTimertask(); T.scheduleAtFixedRate(mTimerTask, 1000, 1000); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/31035548
has comment: http://stackoverflow.com/comment/31035905

http://stackoverflow.com/comment/31235925
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20828452
has text: im not sure - is it the correct thing to try? I could try many things but by posting here I'm trying to determine what i should actually be doing?
score: 0

http://stackoverflow.com/comment/30988143
has text: You probably need to make `isExit` be `volatile` since it is being shared between threads. Also, you should consider using an `ExecutorService` instead of forking your threads by hand.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20691216
score: 1

http://stackoverflow.com/comment/31070853
has text: *"is returned to me like this: java.io.BufferedInputStream@16e31e37"* ... because **that** is what is in your database. That text, not actual data representing an image. You're not storing your images correctly.
score: 3
comment on: http://stackoverflow.com/q/20736688
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31004534
score: 2
has text: Post your logcat error.
comment on: http://stackoverflow.com/q/20700880
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31240036
score: 0
type: Comment
has text: And also this: although point forwarding may increase performance its seems that is is not as significant in the young gen due the the generational hypothesis. (small amount of 'incoming' pointers). The hotspot compiler maintains a remembered set as it is, so in case of moving an object- pointers can be fixed pretty quick. Which brings me back to my original question...
comment on: http://stackoverflow.com/a/20829893
type: AnswerComment

http://stackoverflow.com/q/20716017
has answer: http://stackoverflow.com/a/20716367
score: 0
answer count: 1
has title: Connection pooling in java using c3p0
tagged with: c3p0
type: UnansweredQuestion
has body: I want to using c3p0 for connection pooling in none-web application java program that i wrote. I used traditional singleton connection and I am not satisfied with its performance, so I decided to go for connection pooling. I take a look at c3p0 website and here is what they told about using c3p0: ComboPooledDataSource cpds = new ComboPooledDataSource(); cpds.setDriverClass( "org.postgresql.Driver" ); //loads the jdbc driver cpds.setJdbcUrl( "jdbc:postgresql://localhost/testdb" ); cpds.setUser("swaldman"); cpds.setPassword("test-password"); // the settings below are optional -- c3p0 can work with defaults cpds.setMinPoolSize(5); cpds.setAcquireIncrement(5); cpds.setMaxPoolSize(20); // The DataSource cpds is now a fully configured and usable pooled DataSource I want to know how could i use that for ms sql windows authentication connection, but I could not figure it how? Also how can I set my query through that connection? It seems that using connection pooling is a whole different world than traditional database connection and I am new to that. Here is what i figure out: public class DatabaseManager { private static DataSource dataSource; private static final String DRIVER_NAME; private static final String URL; private static final String UNAME; private static final String PWD; private static final String dbName; static { dbName="SNfinal"; DRIVER_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; URL = "jdbc:sqlserver://localhost:1433;" + "databaseName="+dbName+";integratedSecurity=true"; UNAME = ""; PWD = ""; dataSource = setupDataSource(); } public static Connection getConnection() throws SQLException { return dataSource.getConnection(); } private static DataSource setupDataSource() { ComboPooledDataSource cpds = new ComboPooledDataSource(); try { cpds.setDriverClass(DRIVER_NAME); } catch (PropertyVetoException e) { e.printStackTrace(); } cpds.setJdbcUrl(URL); cpds.setUser(UNAME); cpds.setPassword(PWD); cpds.setMinPoolSize(1000); cpds.setAcquireIncrement(1000); …
tagged with: connection-pooling
has comment: http://stackoverflow.com/comment/31032805
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31037409

http://stackoverflow.com/a/77151189
has body: This is working in Gradle 8.3. If you are doing it on Windows then refer below repositories { flatDir { dirs 'D:/path/of/jar/lib' } } dependencies { implementation ':json-resource2.4.0' }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/20700053

cocos2d-x
tags question: http://stackoverflow.com/q/20798594
tag name: cocos2d-x
type: Tag
tags question: http://stackoverflow.com/q/20841693

http://stackoverflow.com/q/20733014
upvote count: 1
possible better answer: http://stackoverflow.com/a/20733127
has comment: http://stackoverflow.com/comment/31064129
favorite count: 0
has body: How can i automatically write current system date as "YYYY-MM-DD HH:MM:SS" to formatted text field after program is launched in JAVA? Actually i have two formatted text field. One of must be shown current system date - 5 Min second must be shown current system date after program is launched. When i run this program Jpanel comes. Ihave these 2 formattedtextfield in this panel. Left one: must be show current system date - 5min (2013-12-22 21:00:00.000) Right one: must be show current system date (2013-12-22 21:05:00.000) How can i code it for automaticly appear this values to fields? P.S: sorry i dont attach image because i dont have 10 rep yet :(
has comment: http://stackoverflow.com/comment/31063931
tagged with: datetime
has title: Formattedtextfield and DateTime in JAVA
tagged with: jformattedtextfield
downvote count: 0
has answer: http://stackoverflow.com/a/20733127
tagged with: swing
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/20733276
accepted answer: http://stackoverflow.com/a/20733276

http://stackoverflow.com/a/20824753
answers question: http://stackoverflow.com/q/20823798
score: 5
has body: This is not nested transactions, JavaEE / JTA does not support nested transaction. If #method2() is called from #method1() it runs in the same transaction. If you want to have a different transaction you need #REQUIRES_NEW. EJBContext.setRollbackOnly() only works on the current transaction. Note there is a chance that after calling EJBContext.setRollbackOnly() all operations on the transactional resource including reads will throw an exception (JBoss AS 5.1 did this, don't know the current behaviour). Update: }catch(Throwable th){ context.setRollbackOnly(); } You don't need this for runtime exceptions, this is the default behaviour of EJBs.
has comment: http://stackoverflow.com/comment/31229019
downvote count: 0
has comment: http://stackoverflow.com/comment/31254437
type: Answer
has comment: http://stackoverflow.com/comment/124947254
upvote count: 5

http://stackoverflow.com/q/20772486
score: 13
tagged with: abstract-data-type
tagged with: c++
has answer: http://stackoverflow.com/a/20772587
type: AnsweredQuestion
has title: Data type in c++ or java for holding 20 digit integer
downvote count: 0
has answer: http://stackoverflow.com/a/20772509
tagged with: java
has answer: http://stackoverflow.com/a/20772616
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/20773810
linked to: http://stackoverflow.com/q/117429
upvote count: 13
has answer: http://stackoverflow.com/a/20772583
has answer: http://stackoverflow.com/a/20780416
has body: Is there any data type available in Java or C++ which can hold integer values of 20 digits or more? The long long data type can hold only till 18 digits.
has answer: http://stackoverflow.com/a/20772573
favorite count: 0
accepted answer: http://stackoverflow.com/a/20772587
has answer: http://stackoverflow.com/a/23166271
possible better answer: http://stackoverflow.com/a/20772509

http://stackoverflow.com/comment/105445098
type: Comment
comment on: http://stackoverflow.com/a/20737954
score: 0
type: AnswerComment
has text: how can we do it recursively?.

http://stackoverflow.com/comment/31099939
type: QuestionComment
has text: At what line is the exception?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20752799

http://stackoverflow.com/a/20805333
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/20805233
type: Answer
accepted answer of: http://stackoverflow.com/q/20805233
has body: You need to remove the &lt;E&gt; in the constructor declaration: public &lt;E&gt; set(E[] inputArray){ ^^^ Get rid of this As things stand, you are creating a second unrelated generic type parameter called E that shadows the E in set&lt;E&gt;.
downvote count: 0

http://stackoverflow.com/q/20848291
has comment: http://stackoverflow.com/comment/31283916
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31498179
has comment: http://stackoverflow.com/comment/31280096
tagged with: mysql
has answer: http://stackoverflow.com/a/20848375
type: Question
has comment: http://stackoverflow.com/comment/31284153
tagged with: java
has comment: http://stackoverflow.com/comment/31446416
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31273164
score: 0
has body: When i use this code i get message "EROARE" from else clause else {out.println("EROARE"); &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ page import="java.sql.*,java.util.*,models.*,database.*,controllers.*"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Inregistrare&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;% String user = (String)session.getAttribute("Nick"); String Serie = request.getParameter("Serie"); Class.forName("com.mysql.jdbc.Driver"); try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ppauto","root", "k474lin BLASIC"); Statement st = con.createStatement(); // ResultSet rs; int i = st.executeUpdate("insert into favorite(IDfav, Producator, Model, Proprietar, An_fabricatie, Combustibil, Culoare, Detalii, User) SELECT Serie, ProducatorM, ModelM, ProprietarM, An_fabricatie, Combustibil, Culoare, Detalii,'"+user+"' from masina where Serie='" + Serie + "'"); if (i &gt; 0) { // session.setAttribute("Nick", Nick); response.sendRedirect("succes.jsp"); // out.print("Registration Successfull!"+"&lt;a href='index.jsp'&gt;Go to Login&lt;/a&gt;"); } else { out.println("EROARE"); } } catch (Exception ex) { } %&gt; &lt;/body&gt; &lt;/html&gt; When i change line int i = st.executeUpdate("insert into favorite(IDfav, Producator, Model, Proprietar, An_fabricatie, Combustibil, Culoare, Detalii, User) SELECT Serie, ProducatorM, ModelM, ProprietarM, An_fabricatie, Combustibil, Culoare, Detalii,'"+user+"' from masina where Serie='" + Serie + "'"); to int i = st.executeUpdate("insert into favorite(IDfav, Producator, Model, Proprietar, An_fabricatie, Combustibil, Culoare, Detalii, User) SELECT Serie, ProducatorM, ModelM, ProprietarM, An_fabricatie, Combustibil, Culoare, Detalii,'"+user+"' from masina where …
tagged with: sql
answer count: 1
tagged with: jsp
has title: error when insert data from one table to another

http://stackoverflow.com/a/20697772
answers question: http://stackoverflow.com/q/20697440
upvote count: 3
type: Answer
has body: In Facebook: Go to Mannage App-> Select your App-> Settings- Change Sandbox Mode to off. It works.
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/20697440
type: AcceptedAnswer

http://stackoverflow.com/comment/31035968
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20717516
type: AnswerComment
has text: What does "it didn't work" mean"? Did the TCP connection complete? Did they get error messages?

stemming
tags question: http://stackoverflow.com/q/20718913
tag name: stemming
type: Tag

http://stackoverflow.com/q/20751119
favorite count: 0
tagged with: nullpointerexception
tagged with: exception
has comment: http://stackoverflow.com/comment/31096730
has comment: http://stackoverflow.com/comment/31097083
accepted answer: http://stackoverflow.com/a/20751174
has title: Exception in thread "main" java.lang.NullPointerException (eclipse)
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31096713
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31096723
tagged with: java
score: -1
has body: my code is : import ir.sbu.nlp.wordnet.data.model.FNSense; import ir.sbu.nlp.wordnet.data.model.FNSynset; import ir.sbu.nlp.wordnet.data.model.FNSynsetsRelation; import ir.sbu.nlp.wordnet.service.FNSynsetService; import java.util.Vector; public class sample2 { public static void main(String[] args) { FNSynsetService service=new FNSynsetService(); service.findAll(); } } and when I run it display this error Data Load Started... Exception in thread "main" java.lang.NullPointerException at ir.sbu.nlp.wordnet.data.dao.FNWordDao.getTextNode(FNWordDao.java:513) at ir.sbu.nlp.wordnet.data.dao.FNWordDao.loadWords(FNWordDao.java:438) at ir.sbu.nlp.wordnet.data.dao.FNWordDao.&lt;init&gt;(FNWordDao.java:76) at ir.sbu.nlp.wordnet.data.dao.FNDaoManager.&lt;init&gt;(FNDaoManager.java:25) at ir.sbu.nlp.wordnet.data.dao.FNDaoManager.getInstance(FNDaoManager.java:40) at ir.sbu.nlp.wordnet.service.FNSynsetService.&lt;init&gt;(FNSynsetService.java:51) at sample2.main(sample2.java:12) Can every one help me? I copy every file needed for installation
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/20751174
tagged with: program-entry-point
answer count: 1

http://stackoverflow.com/comment/31560191
type: Comment
score: 1
has text: beware: model's setValueAt must fire a cellUpdated!
comment on: http://stackoverflow.com/a/20829961
type: AnswerComment

http://stackoverflow.com/q/20794016
has answer: http://stackoverflow.com/a/20794344
accepted answer: http://stackoverflow.com/a/20794344
tagged with: android-alertdialog
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31172953
score: 0
answer count: 1
has body: this is my code in my adapter.. the int which indicates the id of the item, but how can i get the text value of the item? i want to display it to my button after selecting the item from the dialog.. builder.setSingleChoiceItems(adapter,-1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch(which) { case 0: } dialog.dismiss(); } }); is there a way to use this code? but from my research onItemSelected can be implemented only to listview and spinner.. but in my case how can i use it in my custom alert dialog adapter? @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { // On selecting a spinner item String label = parent.getItemAtPosition(position).toString(); // Showing selected spinner item Toast.makeText(parent.getContext(), "You selected: " + label, Toast.LENGTH_LONG).show(); }
has comment: http://stackoverflow.com/comment/31173337
has title: Android Dialog how to get the text from the Custom adapter Dialog adapter
tagged with: android

http://stackoverflow.com/q/20754557
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31145291
score: 16
has title: Difference between Application and Service in Dropwizard
type: Question
has comment: http://stackoverflow.com/comment/31121014
has body: I'm new to Dropwizard. In the newest documentation, it refers to "Service" as the main entry point of any application. But in the example code, it actually uses "Application". I'm assuming that "Application" is a new name for "Service", since I can't find "Service" in the new source code. I also noticed that the namespace has changed from "com.yammer" to "com.codehaus" to "io.dropwizard". I'm assuming it reflects the evolution of the project itself. Just out of curiosity, can anyone add some context to how this came about?
has answer: http://stackoverflow.com/a/20860866
tagged with: dropwizard
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 16
accepted answer: http://stackoverflow.com/a/20860866

http://stackoverflow.com/a/20701860
has comment: http://stackoverflow.com/comment/31006412
upvote count: 1
has comment: http://stackoverflow.com/comment/31009646
has comment: http://stackoverflow.com/comment/31008111
answers question: http://stackoverflow.com/q/20701686
downvote count: 0
has body: First of all you don't need that I guess: ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); String string = (String) objectInputStream.readObject(); ... and your loop should look more like that: final byte[] temp = new byte[1000]; while (fileInputStream.available() &gt; 0){ int i = fileInputStream.read(temp); bufferedOutputStream.write(temp, 0, i); }
type: Answer
score: 1

http://stackoverflow.com/q/20827779
type: Question
linked to: http://stackoverflow.com/q/513832
tagged with: paint
accepted answer: http://stackoverflow.com/a/20827828
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/20827897
has comment: http://stackoverflow.com/comment/31234755
has comment: http://stackoverflow.com/comment/31234698
tagged with: graphics
tagged with: java
has comment: http://stackoverflow.com/comment/31234807
has comment: http://stackoverflow.com/comment/31234803
possible better answer: http://stackoverflow.com/a/20827897
has title: Java game: Sprite won't display
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20827828
has body: As most of my previous questions have noted, I'm working on a simple 2D game in Java. It's a "Pong" clone. Currently I have on the screen two blue 'paddles' (one on the top of the screen and one on the bottom), controlled by the left and right arrow keys and the 'a' and 'd' keys to move on the x axis. There's also the "ping pong" ball flying around, and reacting to collisions with the paddles and the walls. Now I'm trying to make the paddles shoot a missile, whenever a button is pressed. The bottom paddle shoots a missile when VK_SPACE is pressed, and the top paddle shoots a missile whenever VK_SHIFT is pressed. I succeded with the bottom paddle. It indeed shoots a missile when the space button is pushed. But it won't happen with the top paddle. Here's some code: In the Board class, which runs most of the game. It implements KeyListener: public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key==KeyEvent.VK_LEFT || key==KeyEvent.VK_RIGHT) bPaddle.keyPressed(e); if(key==KeyEvent.VK_A || key==KeyEvent.VK_D) tPaddle.keyPressed(e); if(key == KeyEvent.VK_SPACE) bPaddle.keyPressed(e); if(key == KeyEvent.VK_SHIFT) tPaddle.keyPressed(e); } In the Paddle class public void keyPressed(KeyEvent e){ int key = e.getKeyCode(); // Some code that happens when the arrow keys or a/d keys are pushed. // .......... // .......... if(key == KeyEvent.VK_SPACE){ missiles.add(new Missile(x, 300, "bottom")); } if(key == KeyEvent.VK_SHIFT){ missiles.add(new Missile(x, 400, "bottom")); } } The Constructor of the Missile class: public Missile(int x, int y, String type){ this.x = x; this.y = y; image = new ImageIcon(this.getClass().getResource("sprites/missile.png")).getImage(); width = image.getWidth(null); height = image.getHeight(null); dx = 0; if(type=="top")dy=3; if(type=="bottom")dy=-3; visible = true; } What could be the problem? (If I need to post here more of the code, let me know). Thanks :)
has comment: http://stackoverflow.com/comment/31234777

http://stackoverflow.com/a/20721112
has body: you can set The opacity of your JWindow that will make it transparent setUndecorated(true); setOpacity(0.5f); I am using JFrame and it will remove the titlebar too, it worked for me
type: Answer
answers question: http://stackoverflow.com/q/20720673
score: 0

http://stackoverflow.com/comment/31122980
type: QuestionComment
comment on: http://stackoverflow.com/q/20765773
score: 0
has text: It seems to be failing here: `sp.load(this, R.raw.gunshot, 1);` Does `R.raw` and `R.raw.gunshot` exist? What about the `Context` (`this`)?
type: Comment

http://stackoverflow.com/comment/31216328
type: Comment
has text: U+062E isn’t really an isolated-form character but a generic character, with its position abstracted away. Its glyph typically reflects isolated position, since the glyph is normally not used when the character is rendered in normal text context.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20817327

http://stackoverflow.com/q/20826671
tagged with: dependency-injection
score: 0
answer count: 2
has title: Java EE dependency Injection when to use?
tagged with: cdi
type: UnansweredQuestion
has body: I'm new to this and I want to understand when is it appropriate to use DI in Java. Suppose I need to ping different networks with different ping parameters: The class PingParams: public class PingParams { int timeout; int retries; } The class PingResult: public class PingResult { int ttl; boolean available; } The class PingService: public class PingService { private PingParams pingParams; @Inject public PingService(PingParams pingParams) { this.pingParams = pingParams; } public PingResult ping(String ip) { // ping using timeout and retries from pingParams return new PingResult(); } } The client: public class Client { @Inject PingService pingService; private List&lt;PingResult&gt; doPing() { List&lt;PingResult&gt; ret = new ArrayList&lt;&gt;(); String[] ips = new String[] {"127.0.0.1","127.0.0.2"}; for (String ip : ips) { PingResult pr = pingService.ping(ip); ret.add(pr); } return ret; } public static void main(String[] args) { List&lt;PingResult&gt; prs = new Client().doPing(); System.out.println(prs); } } I have 2 injection points: I inject PingParams in the constructor of PingService. Is this correct? I mean, the DI container can not know the timeout and retries to inject into the PingParams unless you create some "Produces" annotated method, even in this case, it seams a looot of work just to create an object! But of course you need to create several, one for every network, how do you do that with DI? I inject PingService in the client. Seems legitimate, but PingService depends on PingParams, which takes us to injection point number 1. Seems to me like the only appropriate way to use DI is with classes which have no dependencies (therefore useless) or with very simple service classes where you pass all the dependencies as parameters to service methods. For example a PingService which accepts the ip and the PingParams in the ping method, again this class would have no dependencies... Am I missing something? How can you use DI with these "data" classes, classes whi…
tagged with: weld
tagged with: java
has answer: http://stackoverflow.com/a/20826862
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/20832489

http://stackoverflow.com/comment/31275593
type: QuestionComment
score: 2
has text: Code style, if you follow example 1 is the good choice
comment on: http://stackoverflow.com/q/20849551
type: Comment

http://stackoverflow.com/comment/120475738
comment on: http://stackoverflow.com/a/20820202
type: AnswerComment
has text: why would u select * into memory just to see if something exists
score: 0
type: Comment

http://stackoverflow.com/comment/31042430
score: 0
has text: Sure you can use an inner class but why would you want to create 28 instances of the class when you can just create a single instance and write generic code by using the source Object of the MouseEvent to get the JLabel?
type: Comment
comment on: http://stackoverflow.com/a/20721200
type: AnswerComment

http://stackoverflow.com/a/77731726
answers question: http://stackoverflow.com/q/20784407
has body: In the Official documentation, it says to use this: String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName=AdventureWorks;integratedSecurity=true;" + "encrypt=true;trustServerCertificate=true"; But it didn't work for me, I had to remove integratedSecurity=true for it work. Final connection URL was: spring.datasource.url=jdbc:sqlserver://888.000.999.666;database=mydatabase;encrypt=true;trustServerCertificate=true
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/20808290
has title: Spring JPA (Hibernate) No qualifying bean of type: javax.persistence.EntityManagerFactory
has comment: http://stackoverflow.com/comment/31277372
accepted answer: http://stackoverflow.com/a/20849275
has answer: http://stackoverflow.com/a/20871058
tagged with: spring
possible better answer: http://stackoverflow.com/a/20850535
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/20850535
type: AnsweredQuestion
upvote count: 19
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31277263
has comment: http://stackoverflow.com/comment/31277456
score: 19
type: Question
has comment: http://stackoverflow.com/comment/31277207
has answer: http://stackoverflow.com/a/20849275
answer count: 3
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/31277320
has body: I'm using Spring-boot, so a war deployed in Tomcat 7. When I start the app I get the following: Dec 30, 2013 7:41:06 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring FrameworkServlet 'dispatcherServlet' 2013-12-30 19:41:06 INFO DispatcherServlet:461 - FrameworkServlet 'dispatcherServlet': initialization started 2013-12-30 19:41:06 INFO SimpleUrlHandlerMapping:315 - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2013-12-30 19:41:06 INFO RequestMappingHandlerMapping:181 - Mapped "{[/user],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.cloudfordev.controlpanel.orm.User com.cloudfordev.controlpanel.GetController.getUser(int) 2013-12-30 19:41:07 INFO SimpleUrlHandlerMapping:315 - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2013-12-30 19:41:07 INFO SimpleUrlHandlerMapping:315 - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2013-12-30 19:41:08 INFO DispatcherServlet:480 - FrameworkServlet 'dispatcherServlet': initialization completed in 1957 ms Dec 30, 2013 7:41:08 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-nio-8080"] Dec 30, 2013 7:41:08 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector INFO: Using a shared selector for servlet write/read Dec 30, 2013 7:41:08 PM org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["http-nio-8080"] Dec 30, 2013 7:41:08 PM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["http-nio-8080"] Dec 30, 2013 7:41:08 PM org.apache.catalina.core.StandardService stopInternal INFO: Stopping service Tomcat Dec 30, 2013 7:41:08 PM org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["http-nio-8080"] Dec 30, 2013 7:41:08 PM org.apache.coyote…
favorite count: 0

http://stackoverflow.com/comment/31151791
has text: What is AdaptApproverObject ?
comment on: http://stackoverflow.com/q/20782403
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20723127
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31045949
downvote count: 0
tagged with: layout-manager
favorite count: 0
has body: Thanks Guys! I got it to work. The links to the tutorials were very helpful. I am trying to align 4 panels from top to bottom on my frame, I am just learning java. I can get 3 of them on there but want to add some texts above my buttons. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class ShowWindow extends JFrame { final int WIDTH = 650; final int HEIGHT = 550; private static JPanel buttonpanel; private JButton button1; private JButton button2; private JButton button3; public ShowWindow() { GreetingPanel banner = new GreetingPanel(); Display getName = new Display(); Select select = new Select(); Select1 message = new Select1(); setSize(WIDTH, HEIGHT); setTitle("This is my window"); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setIconImage((new ImageIcon("logo.jpg")).getImage()); getContentPane().setBackground(Color.white); add(banner, BorderLayout.NORTH); add(getName, BorderLayout.CENTER); Here is the part I need help with. add(message); add(select, BorderLayout.SOUTH); pack(); } }
has comment: http://stackoverflow.com/comment/31045674
has title: How do I add 4 Panels to my Frame ordered from top to bottom in java?
has answer: http://stackoverflow.com/a/20723367
tagged with: jframe
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31045654
score: 1
has answer: http://stackoverflow.com/a/20723189
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31046005

http://stackoverflow.com/comment/31202356
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20810284
has text: Maybe I worded that wrong. You don't need to explain others' answers. Anyway, that second link is posted seems to contradict your answer: it says that the value assigned in the constructor is not necessarily the one threads that call methodCalledByOtherThreads() sees.

http://stackoverflow.com/comment/31233183
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20826993
score: 1
has text: can you show `activity_main.xml`?

http://stackoverflow.com/a/20716519
score: 0
has body: It looks like there maybe something wrong with your setup. In your project properties, under libraries have you by chance added synthetica.jar as a required jar. but m not sure try it but you can simply do, you could create lib folder manually in your project folder and then paste that jar in that folder then through netbeans go to your project then right click on libraries and then browse to find your project folder open that then click on lib folder that you have created open it then click on jar that you have pasted and that jar file will be added to your project.
type: Answer
answers question: http://stackoverflow.com/q/20705848
has comment: http://stackoverflow.com/comment/31128012

http://stackoverflow.com/comment/31034218
comment on: http://stackoverflow.com/q/20710970
score: 0
type: Comment
type: QuestionComment
has text: For the algorithm suggestion part, see this question - [What algorithm gives suggestions in a spell checker?](http://stackoverflow.com/q/2294915)

http://stackoverflow.com/comment/31087245
has text: Maybe you can put some sort of "loading" image like [this](http://sierrafire.cr.usgs.gov/images/loading.gif) in the placeholder an when you have your real image put it there
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/20746009
type: Comment

http://stackoverflow.com/a/57266584
upvote count: 9
answers question: http://stackoverflow.com/q/20789441
has body: If you need to pass an array of parameters where you don't know the size of the array then you can use: https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#messages-1
score: 9
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31193186
type: AnswerComment
comment on: http://stackoverflow.com/a/20801851
has text: I might be overly sensitive on the issue of what Handlers belong to. Its easy for people to get the idea that each Activity or Service has its own event loop, which is not true, but could easily appear to be the case until someone codes in a bug and it because very clear that something does not match expectations.
score: 0
type: Comment

http://stackoverflow.com/q/20809421
score: 0
has answer: http://stackoverflow.com/a/20885193
answer count: 1
tagged with: android-support-library
tagged with: android
has title: Add an actionbar to tabbed layout
tagged with: android-tabhost
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/20885193
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/31203993
tagged with: java
type: Question
has body: I tried to add to my application, developed with version 2.3 of Android (tabhost) an action bar (via appcompat v7 lib, not a navigation bar...but an action bar), and failed. Can anyone help me in this task? I also tried to change the tabactivity with fragment (support lib v4) but again no results. my main activity public class ProjectActivity extends FragmentActivity implements TabHost.OnTabChangeListener { private TabHost mTabHost; private HashMap mapTabInfo = new HashMap(); private TabInfo mLastTab = null; private class TabInfo { private String tag; private Class clss; private Bundle args; private Fragment fragment; TabInfo(String tag, Class clazz, Bundle args) { this.tag = tag; this.clss = clazz; this.args = args; } } class TabFactory implements TabContentFactory { private final Context mContext; /** * @param context */ public TabFactory(Context context) { mContext = context; } /** (non-Javadoc) * @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String) */ public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; } } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Step 1: Inflate layout setContentView(R.layout.layout_project); // Step 2: Setup TabHost initialiseTabHost(savedInstanceState); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); //set the tab as per the saved state } } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle) */ protected void onSaveInstanceState(Bundle outState) { outState.putString("tab", mTabHost.getCurrentTabTag()); //save the tab selected super.onSaveInstanceState(outState); } /** * Step 2: Setup TabHost */ private void initialiseTabHost(Bundle args) { mTabHost = (TabHost)findViewById(android.R.id.tabhost); m…

http://stackoverflow.com/comment/33651383
type: QuestionComment
has text: Is the aim here to implement your own GUI, or just to get it working in >a< GUI? If the latter, I might suggest implementing a chess protocol such as [Winboard](http://www.open-aurec.com/wbforum/WinBoard/engine-intf.html) or [UCI](http://www.wbec-ridderkerk.nl/html/UCIProtocol.html‎), then plugging it into one of the many existing chess GUIs such as [Arena](http://www.playwitharena.com/‎). This has the additional advantage of making it much easier to pit your engine against other engines!
score: 1
type: Comment
comment on: http://stackoverflow.com/q/20811180

http://stackoverflow.com/comment/31217699
score: 0
type: AnswerComment
has text: So are you saying that I should use Selenium or something similar?
type: Comment
comment on: http://stackoverflow.com/a/20818534

http://stackoverflow.com/comment/30994267
type: Comment
comment on: http://stackoverflow.com/q/20694498
score: 0
has text: What makes you say _"it gets over written"_?
type: QuestionComment

http://stackoverflow.com/comment/31199889
comment on: http://stackoverflow.com/q/20804981
type: QuestionComment
has text: You could repeatedly call the [`plusWeeks( 1 )`](http://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html#plusWeeks(int)) method on DateTime instance in [Joda-Time](http://www.joda.org/joda-time/) 2.3.
score: 0
type: Comment

http://stackoverflow.com/q/20832322
answer count: 1
has comment: http://stackoverflow.com/comment/31243782
has comment: http://stackoverflow.com/comment/31243680
has comment: http://stackoverflow.com/comment/31243642
accepted answer: http://stackoverflow.com/a/20832386
score: 0
has body: So I'm working through interview problems, and I'm given the following: /** Give a circularly linked list, implement an algorithm which returns * the node at the beginning of the loop. */ I've seen the fastrunner &amp; slowrunner / tortoise &amp; hare method with two pointers and some clever math to find the beginning node, but I just came up with the following solution, and am wondering if theres anything wrong with it or any criticism you guys can see in comparison to the usual method of solving this. It seems too easy to me, but it makes sense that it would work: Just go through the list, and if you ever hit a node that you've previously seen, that means you're at the start of your loop. /** Give a circularly linked list, implement an algorithm which returns * the node at the beginning of the loop. */ public static Node firstInLoop(Node n) { HashSet&lt;Node&gt; visited = new HashSet&lt;&gt;(); while (n != null) { if (visited.contains(n)) { return n; } else { visited.add(n); n = n.tail; } } return null; }
has title: Returning start of a circularly linked list Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31243730
has answer: http://stackoverflow.com/a/20832386
tagged with: java
type: Question

http://stackoverflow.com/a/20794554
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31173784
accepted answer of: http://stackoverflow.com/q/20794401
has body: Maybe you want something more like this, Where the show series method actually sets the array, so the other methods can use the array static int[] series = new int[100]; static int seriesLength = 0; ... // Get the input for range public static void showSeries(int range) { seriesLength = range; series = new int[seriesLength]; for (int i = 0; i &lt; series.legnth; i++) { series[i] = i; System.out.print(series[i] + " "); } } Because this first method needs to be the first one called before anything, the array will be set. Then the other methods shouldn't have to take any arguments, as the array is already set, and they can just use the static array.
answers question: http://stackoverflow.com/q/20794401
type: Answer
score: 2

http://stackoverflow.com/comment/31110043
comment on: http://stackoverflow.com/q/20757966
has text: I am sorry this correct:
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/20837543
type: Answer
score: 0
has body: There are many issues with your code so not easy to say where to begin. First: Your public void deleteContact(String name)-method is broken. It compares Strings using == instead of equals(). And worse: It creates null pointers mid in your array which will cause problems in your writer()-method. Second: Why do you use arrays? You should use java.util.ArrayList which offers out-of-the-box implementations for adding, getting and deleting contacts. Third: If you are missing your text file, you might have overlooked it because of missing path so you don't know where to look for this file. So please add a full path to file name. Fourth: I would also use scanner.hasNextLine() instead of scanner.hasNext() if you then call scanner.nextLine(). Since you said you are not allowed to use ArrayList you should study its source code especially for removing elements. It does not only nullify the array bucket, but also to shift all following elements one index backwards so you don't have any null gap until the index given by element count. And two breaks in deleteContact()-method are really not necessary.
answers question: http://stackoverflow.com/q/20837308

http://stackoverflow.com/a/20720594
type: Answer
has comment: http://stackoverflow.com/comment/31041231
answers question: http://stackoverflow.com/q/20720439
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: I think I know what you are trying to do (If I understand your question correctly). The reason for this is that the else block is attached to the high level if block, rather than it's internal logic. If the if#1 returns false, nothing will happen, if it is true it will test if#2 -> if this is false, it will execute the else statement. If this is not your question, please supply the stack trace as rattmuff requested if ((day&gt;=1 &amp;&amp; month&gt;=4) &amp;&amp; (day&lt;=30 &amp;&amp; month&lt;=9)) { if((hour&lt;=16 &amp;&amp; min&lt;30)||(hour&gt;=23 &amp;&amp; min&gt;0)) { message="something"; }//if#2 else { Log.d("baja", "before if#3 "); }//else }//if#1 else if((hour&lt;=16 &amp;&amp; min&lt;30)||(hour&gt;=21 &amp;&amp; min&gt;0)) { Log.d("baja", "if#3"); message="something2"; }//if#3
accepted answer of: http://stackoverflow.com/q/20720439

http://stackoverflow.com/q/20754538
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20754576
tagged with: java
has answer: http://stackoverflow.com/a/20754561
downvote count: 0
answer count: 6
has title: Android app package name
favorite count: 0
has answer: http://stackoverflow.com/a/24446415
has answer: http://stackoverflow.com/a/36933939
has body: When creating an Android application using Java, you place your classes into packages such as com.example.appName However, in the Android XML manifest file, you also specify the package there. It is my understanding that the Google Play Store, where Android apps are uploaded, uses the package name as a unique identifier for your app. So, which package name actually identifies your app/APK file? And can the package names in your code be different to the package name in the manifest?
tagged with: android
accepted answer: http://stackoverflow.com/a/20754561
has answer: http://stackoverflow.com/a/20754558
has answer: http://stackoverflow.com/a/20754567
upvote count: 3
tagged with: android-manifest
type: Question
possible better answer: http://stackoverflow.com/a/20754576

http://stackoverflow.com/q/20734110
linked to: http://stackoverflow.com/q/2367381
has comment: http://stackoverflow.com/comment/31066016
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/31066024
type: UnansweredQuestion
has title: Get a number from a string
has answer: http://stackoverflow.com/a/20737571
tagged with: java
type: Question
answer count: 2
score: -2
has body: I have this convertor which is used to get or set label from a combo box: public class GroupConverter extends StringConverter&lt;ListGroupsObj&gt; { @Override public String toString(ListGroupsObj obj) { return obj.getGroupId() + " - " + obj.getGroupName(); } @Override public ListGroupsObj fromString(String obj) { Scanner fi = new Scanner(obj); //anything other than alphanumberic characters, //comma, dot or negative sign is skipped fi.useDelimiter("[^\\p{Alnum},\\.-]"); while (true) { if (fi.hasNextInt()){ //System.out.println("Int: " + fi.nextInt()); return ListGroupsObj.newInstance().groupId(fi.nextInt()); } break; } //TODO when you type for example "45 - NextGroup" you want to take only tyhe number" return ListGroupsObj.newInstance().groupId(fi.nextInt()); } } For example when I type "45 - NextGroup" I would like to get only the number from the value. Can you help me implement this?
downvote count: 2
has answer: http://stackoverflow.com/a/20734211

http://stackoverflow.com/a/20799477
has comment: http://stackoverflow.com/comment/31182178
score: 1
has comment: http://stackoverflow.com/comment/31182839
has comment: http://stackoverflow.com/comment/31182239
answers question: http://stackoverflow.com/q/20799426
has comment: http://stackoverflow.com/comment/31182284
downvote count: 0
has body: There are two things you can do. Either (1) You can make fact a static method, by putting the word static after public in its declaration. Or (2) You can make an object of the Looping class and use it to run the calls to fact, like this. public static void main(String[] args) { Looping looping = new Looping(); for(int i=0;i&lt;=21;i++){ System.out.printf("%d!=%d\n", i, looping.fact(i)); } } It doesn't make any difference which you choose, because an object of the Looping class doesn't have any fields, which means it doesn't carry around any data with it. It doesn't matter whether you make such an object or not; except for the fact that to use a non-static method, you need an object. If the object had some fields, then a non-static method would be one that can refer to those fields. But since there are no fields, it makes no difference whether a method is static or not. Therefore, I'd probably choose option (1) here - just make the method static. However, if, in the future, I want to have variations on the Looping class - that is, subclasses, each with a slightly different implementation of the fact method; then I really need to pick option (2). You can't really have different versions of a static method, within a subclass. When you write a class, you don't really know whether, in the future, you'll want some subclasses of it with slightly different behaviour. These may be subclasses that are going to be used in your program, or they may be things like mock subclasses that you use for testing. Therefore, as a matter of course, it's always worth avoiding static methods. The only static method that any class ever needs to have is the main method. Any other static methods are likely to cause you problems, as your program grows and you have more and more classes. Static methods can make testing harder. They definitely make it more difficult to implement polymorphism. I realise that this argument might be beyond where your current Java knowledge is. But it would be worthw…
type: Answer
upvote count: 1

buttonclick
type: Tag
tags question: http://stackoverflow.com/q/20822227
tag name: buttonclick

http://stackoverflow.com/q/20696213
has title: Addition of Integer 2D array elements using multi-threading in java slower than sequential addition
has comment: http://stackoverflow.com/comment/30997889
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/30998822
linked to: http://stackoverflow.com/q/2117072
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/30997862
possible better answer: http://stackoverflow.com/a/20705206
favorite count: 0
has body: So, I am practicing multi threading in java and trying to add the elements of a randomly generated 2D integer array both sequentially and using 4 threads. I measured the performance of my code and for some reason sequential part is a lot faster than multi-threaded. Here is the code for sequential addition: public class ArraySum2DNonMT { private int[][] arrayToSum; private int totalSum; public ArraySum2DNonMT(int[][] arr){ this.arrayToSum = arr; this.setTotalSum(0); } public void runSequential(){ for(int i = 0; i &lt; arrayToSum[0].length; i++){ for(int j = 0; j &lt; arrayToSum.length; j++){ setTotalSum(getTotalSum() + arrayToSum[j][i]); } } } public int getTotalSum() { return totalSum; } public void setTotalSum(int totalSum) { this.totalSum = totalSum; } } Here is the code for Multi-threaded version: package multiThreaded; /** * * @author Sahil Gupta * * This class takes in a 2D integer array and adds it's contents. This * addition will be concurrent between several threads which will divide * the work of the array based on the threadID assigned to thread by the * programmer. Assume that the passed in 2D array to the constructor is a * matrix with each array in the main array having same length. */ public class ArraySum2D implements Runnable{ private int[][] arrayToSum; private int threadID; private int totalSum; public ArraySum2D(int[][] arr, int threadID){ this.arrayToSum = arr; this.threadID = threadID; this.setTotalSum(0); } @Override public void run() { int arrayCol = arrayToSum[0].length; int arrayRow = arrayToSum.length; int colStart = (int)((threadID%2) * (arrayCol/2)); int rowStart = (int)((int)(threadID/2) * (arrayRow/2)); int colEnd = colStart + (int)(arrayCol/2); int rowEnd = rowStart + (int)(arrayRow/2); for(int i = colStart; i &lt; colEnd; i++){ for(int j = rowStart; j &lt; rowEnd; j++){ setTotalSum(getTotalSum() + arrayToSum[j][i]); } } } public int getTotalSum() { return totalSum; } public void setTotalSum(int totalSum) { this.totalSum = totalSum; } …
has answer: http://stackoverflow.com/a/20705206
has answer: http://stackoverflow.com/a/20696790
has comment: http://stackoverflow.com/comment/30998770
tagged with: multithreading
upvote count: 1
accepted answer: http://stackoverflow.com/a/20696790
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java

http://stackoverflow.com/q/20762595
has comment: http://stackoverflow.com/comment/31117419
upvote count: 2
accepted answer: http://stackoverflow.com/a/20764318
tagged with: java
has title: Getting java.lang.IllegalStateException on output = new BufferedOutputStream(response.getOutputStream())
has comment: http://stackoverflow.com/comment/31119546
type: Question
has comment: http://stackoverflow.com/comment/31116517
has comment: http://stackoverflow.com/comment/31154625
tagged with: servlets
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/31116649
has answer: http://stackoverflow.com/a/20764318
type: AnsweredQuestion
score: 2
has body: I am trying to display an image on jsp from local drive. I set the img src as src = "../../../ImageServlet" in jsp but I am getting a java.lang.IllegalStateException at org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:63) at DisplayImageServlet.doPost(ImageServlet.java:95) at DisplayImageServlet.doGet(ImageServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) exception. My Servlet Code is: protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { String applicationNumber = (String)session.getAttribute("APPLICATIONNUMBER"); File file = new File("C:/photos/"+applicationNumber+".jpg"); response.setContentType(getServletContext().getMimeType(file.getName())); response.setHeader("Content-Length", String.valueOf(file.length())); response.setHeader("Content-Disposition", "inline; filename=\"" + file.getName() + "\""); BufferedInputStream input = null; BufferedOutputStream output = null; try { input = new BufferedInputStream(new FileInputStream(file)); output = new BufferedOutputStream(response.getOutputStream()); byte[] buffer = new byte[10240]; int length; while ((length = input.read(buffer)) > 0) { output.write(buffer, 0, length); } } finally { if (output != null) try { output.close(); } catch (IOException logOrIgnore) {} if (input != null) try { input.close(); } catch (IOException logOrIgnore) {} } } catch(Exception ex){ ex.printStackTrace(); } } and my jsp img tag is like- Photo Please help me out or is there any other way to do the same. Thanks.

http://stackoverflow.com/q/20802529
has title: How to compile a Java program using another Java program and print the output using Java compiler API?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31187816
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/20808748
has body: I wrote a simple program using compiler API and store a string which contains simple Java program into a file and compiles that file. Its working fine, now I need to print the output generated by the sample class. How can I do it? String program="public class MyClass{ public static void main(String args[]) {System.out.println(\"My Method Called\");}}"; File newTextFile = new File("D:\\MyClass.java"); FileWriter fw = new FileWriter(newTextFile); fw.write(program); fw.close(); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); FileOutputStream err = new FileOutputStream("Error.txt"); FileOutputStream out = new FileOutputStream("output.txt"); int results = compiler.run(null,err,out,"newtextfile"); if(results== 0){ System.out.println("Compilation is successful"); }else{ System.out.println("Compilation Failed"); } } It print only the result as Compilation is successful. How can I print the message in the sample class which is compiled.Please advice. Now it creates output and error file but only errors are written in the error file if program has any error in it.If program compiles without any mistake then output is not written in the output file,empty file is created.
upvote count: 2
tagged with: java
answer count: 3
downvote count: 1
linked to: http://stackoverflow.com/q/14282726
has comment: http://stackoverflow.com/comment/31187602
has answer: http://stackoverflow.com/a/70359620
possible better answer: http://stackoverflow.com/a/27576417
has answer: http://stackoverflow.com/a/27576417
has answer: http://stackoverflow.com/a/20808748

http://stackoverflow.com/comment/31218827
score: 3
has text: What don't you understand about the error message? It's pretty clear. Character case matters in Java, but also you can't reduce the visibility of a method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20819295

http://stackoverflow.com/comment/31207827
type: AnswerComment
comment on: http://stackoverflow.com/a/20812898
type: Comment
has text: @JavaCuriousღ: Did you know this: `'\0'`?
score: 0

http://stackoverflow.com/q/20745964
accepted answer: http://stackoverflow.com/a/20754222
score: 13
upvote count: 16
has comment: http://stackoverflow.com/comment/31098224
has comment: http://stackoverflow.com/comment/31086798
has comment: http://stackoverflow.com/comment/31103849
possible better answer: http://stackoverflow.com/a/20749770
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31086945
has comment: http://stackoverflow.com/comment/31089026
has answer: http://stackoverflow.com/a/20749770
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31093435
type: Question
has comment: http://stackoverflow.com/comment/31095183
has comment: http://stackoverflow.com/comment/31095764
tagged with: debugging
answer count: 2
has comment: http://stackoverflow.com/comment/31094660
has body: I just encountered something that defies my understanding of logic. How can the situation below occur? I've tried all the usual approaches to remedy this; clean/build, restart netbeans, etc. but the problem persists. Variable complete is always true, no matter what I do. I even replaced left and right with true and false boolean values respectively, but no change. What did work, was a refactor rename of the variable, but when I changed it back to the original, the problem resurfaced. There are no class members named the same way. What's going on? Have I finally lost my mind, or should that variable have a value of false? This is with Netbeans 7.3.1 on Windows. Edit01 I'll try to prove it to the unbelievers that this is actually happening, when I get access to my work computer in a week or so. In the mean while, just take my word for it. THIS IS NOT A PRANK nor did it happen due to my lack of knowledge of debugging with Netbeans. I do remember doing a bunch of svn switch-to-copy commands before this occurred, but not for the project where this code resides in (dependencies). A clean/build should have taken care of any inconsistencies anyways. I also did not remember to clear the Netbeans cache, which I now regret. Edit02 Haters gonna hate, but as I feared, after returning to my workstation, I can no longer reproduce this issue. It pisses me off to admit this, but I have no proof whatsoever that this had ever happened. All I did was: woke up my pc from hibernation, undid a refactor rename of my variable, which was the last thing I had done before finishing my work, a clean/build and then another debug run. Everything just..works.
has title: Netbeans Java Debugger claims that ((true && false) == true)
has comment: http://stackoverflow.com/comment/31100714
has answer: http://stackoverflow.com/a/20754222
has comment: http://stackoverflow.com/comment/31102569
has comment: http://stackoverflow.com/comment/31099480
has comment: http://stackoverflow.com/comment/31095906
has comment: http://stackoverflow.com/comment/31102221
has comment: http://stackoverflow.com/comment/31111604
has comment: http://stackoverflow.com/comment/31140417
has comment: http://stackoverflow.com/comment/31098428
favorite count: 0
tagged with: netbeans

http://stackoverflow.com/a/20752426
has comment: http://stackoverflow.com/comment/31099496
answers question: http://stackoverflow.com/q/20752253
downvote count: 0
has comment: http://stackoverflow.com/comment/31099096
type: Answer
score: 2
upvote count: 2
has body: You only need to close the outermost output stream or Writer that you've wrapped around the socket output stream. That ensures it gets flushed. Closing any of the streams or the socket closes the others. EOFException is normal. It means you've reached the end of the stream.

http://stackoverflow.com/q/20770006
has comment: http://stackoverflow.com/comment/31130407
tagged with: java
score: 10
has body: My perception for defining string constants in Java is that one should define a string constant, when the same string is used at multiple places. This help in reducing typo errors, reduce the effort for future changes to the string etc. But how about string that are used at a single place. Should we declare string constant even in that case. For eg. Logging Some counter (random example). CounterLogger.addCounter("Method.Requested" , 1) Is there an advantage of declaring constant rather than using raw string? Does the compiler does any optimization?
has comment: http://stackoverflow.com/comment/31131060
has comment: http://stackoverflow.com/comment/31130401
has comment: http://stackoverflow.com/comment/31130421
has comment: http://stackoverflow.com/comment/31130372
has title: Programming practice for defining string constants in Java
linked to: http://stackoverflow.com/q/6667243
tagged with: string
has answer: http://stackoverflow.com/a/20770313
favorite count: 0
type: UnansweredQuestion
upvote count: 10
has answer: http://stackoverflow.com/a/20770029
answer count: 4
tagged with: constants
downvote count: 0
has answer: http://stackoverflow.com/a/20770186
has answer: http://stackoverflow.com/a/20770092
type: Question

http://stackoverflow.com/q/20847467
tagged with: jtableheader
tagged with: swing
tagged with: tablecellrenderer
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/20847798
tagged with: jtable
has title: JTable- How to change Font for a specific column header
answer count: 1
downvote count: 0
has body: I want to change the font for the header of the selected column on JTable. I tried to do that on my ColumnHeaderRenderer as follow : public class ColumnHeaderRenderer extends JLabel implements TableCellRenderer { public ColumnHeaderRenderer(JTable table) { JTableHeader header = table.getTableHeader(); setOpaque(true); setBorder(BorderFactory.createEtchedBorder()); setHorizontalAlignment(CENTER); setForeground(header.getForeground()); setBackground(header.getBackground()); setFont(header.getFont()); setPreferredSize(new Dimension(0, 25)); } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Color bg = UIManager.getColor("TableHeader.background"); int selectedColumn = table.getSelectedColumn(); if (selectedColumn == column){ bg = new Color(107, 142, 35); setFont(getFont().deriveFont(Font.BOLD));// !!!!trying to do it here!!!! } setBackground(bg); setText(value.toString()); return this; } } But as result all column headers font is changed. So how can only change it for the selected column ?
favorite count: 0
accepted answer: http://stackoverflow.com/a/20847798
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/31132749
comment on: http://stackoverflow.com/q/20771106
type: Comment
has text: Maximum limit is 50000.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31219966
score: 0
has text: try running the app on an AVD first and post the logcat information
type: Comment
comment on: http://stackoverflow.com/q/20819890
type: QuestionComment

http://stackoverflow.com/q/20681348
upvote count: 1
has title: error in starting hbase with Hadoop-2.2.0
score: 1
tagged with: java
type: Question
tagged with: hadoop
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/12940239
favorite count: 0
has body: I have installed and configured Hbase-0.94.14 with hadoop-2.2.0. I'm getting following error while starting HBase. Error: Could not find or load main class org.apache.hadoop.util.PlatformName I have not found any reasonable material that explains me, why is this happening. I believe I'm missing some .jar file, but don't know which one. there is a huge change in Hadoop structure. With hadoop-1.x only one hadoop-core.x.jar file was enough. But in hadoop.2.x I have not found hadoop-core jar. If any body knows why it is happening, please help me. NOTE: I'm having this error while starting HBase. Hadoop is running fine.
has answer: http://stackoverflow.com/a/20841049
tagged with: hbase
type: UnansweredQuestion

http://stackoverflow.com/a/20740781
answers question: http://stackoverflow.com/q/20740678
has comment: http://stackoverflow.com/comment/31078261
has comment: http://stackoverflow.com/comment/31103671
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31078076
accepted answer of: http://stackoverflow.com/q/20740678
has body: You have to do those operations as a part of a method... public class RefCheckForStrings { StringBuilder sb=new StringBuilder("abc"); sb.append("def"); // You can do this only inside a method //System.out.println(sb); String s="abc"; s.concat("def"); // You can do this only inside a method //System.out.println(s);*/ } Possibly as below... to take an example of doing these in a constructor public class RefCheckForStrings { StringBuilder sb; String s; public RefCheckForStrings() { sb=new StringBuilder("abc"); s = "abc"; sb.append("def"); s.concat("def"); } } There is another way of doing the same thing without using a method in Java 7... it is as shown below... public class RefCheckForStrings { StringBuilder sb=new StringBuilder("abc"); { sb.append("def"); System.out.println(sb); } String s="abc"; { s.concat("def"); System.out.println(s); } } To answer your second question... Strings are immutable, in other words. Once you assign address of a string to a variable, the string located in that address cannot be changed. if you do s.concat() when s is a string, a new string will be created in memory which is a concatenated form. But address of s doesn't directly change. So, you have explicitly tell s.concat() as s = s.concat("abc");. Where as the way String builders are developed, they can be directly changed in the location where they are created without having to create a new copy in the memory. So they are mutable and don't have to assign any reference back to the string builder object. If you create a string s and if you assume the string "abc" is assigned to it, assume "abc" is stored at address 1001 if you do s+"def" the resulting string may be stored at address 2001, but s will still be pointing to 1001. instead if you do s = s + "def", the location of where s is pointed to will also change, so now s is pointing to 2001. The string "abc" will still be located at 1001 and it will be cleaned by garbage collector if not used for some time.

http://stackoverflow.com/a/20844578
type: Answer
score: 1
upvote count: 1
has body: As per the JavaDoc: ITALIAN Useful constant for language. ITALY Useful constant for country. Basically same as with GERMANY and GERMAN. http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html A language can be spoken in many countries. A country is just a particular country.
downvote count: 0
answers question: http://stackoverflow.com/q/20844525

http://stackoverflow.com/q/20846492
upvote count: 1
tagged with: arabic
has answer: http://stackoverflow.com/a/20846558
favorite count: 0
has answer: http://stackoverflow.com/a/20846712
has comment: http://stackoverflow.com/comment/31270023
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14876287
has body: I want to make it possible to write in Arabic in my server. It works but from left to right so I used that StringUtils.reverse(_text) now my text is written from RTL but the problem is this: the text is written separately ( e x a m p l e ) In my logger Log.LogChat(_type.name(), activeChar.getName(), _target, _text); the chat is written correctly in my log.txt, but in the game it's written with spaces // arabic chat Say2 cs = new Say2(activeChar.getObjectId(), _type, activeChar.getName(), StringUtils.reverse(_text)); Does anyone know why?
tagged with: java
has title: Writing arabic letters in Java
type: Question
has comment: http://stackoverflow.com/comment/31269514
score: -1
has comment: http://stackoverflow.com/comment/31269699
downvote count: 2
answer count: 2

http://stackoverflow.com/comment/30981800
comment on: http://stackoverflow.com/q/20687980
type: QuestionComment
type: Comment
has text: Please, be kind and format your code. It's quite hard to read with no indentation.
score: 0

http://stackoverflow.com/comment/93962207
has text: This answers needs more explanation.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20713657

http://stackoverflow.com/comment/31206409
has text: Well, in C++ this is called the Curiously Reoccurring Template Pattern. Maybe look into that?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/20812622

http://stackoverflow.com/q/20691262
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/30988431
tagged with: youtube-api
has title: Youtube Data Api V3.0 .NET samples issues
has body: I'm trying to move from Youtube Data API V2 to V3 .NET. There are some samples here, but they are not up-to-date so I think that I need to convert those samples from PHP or Java Python. If somebody is already converted those samples from PHP or Java Python to .NET, can you please provide me with the information?
tagged with: c#
tagged with: java
has comment: http://stackoverflow.com/comment/30988549
type: Question
downvote count: 0
tagged with: asp.net
favorite count: 0
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/a/20779272
has comment: http://stackoverflow.com/comment/31146726
downvote count: 0
accepted answer of: http://stackoverflow.com/q/20779239
answers question: http://stackoverflow.com/q/20779239
has comment: http://stackoverflow.com/comment/31146675
upvote count: 2
has body: You could design your DatabaseOperator class to support chained invocations, by returning the this object in the different methods. Each of these methods will update the state of the DatabaseOperator in order to facilitate proper execution of other methods (such as initiateConnection()) down the line. As Jordao pointed out, this looks more like a Fluent Interface (that uses a Builder pattern under the hood). One possible implementation could be: public class DatabaseOperator { private Configuration configuration = Configuration.DEFAULT; private AuthDetails authDetails = AuthDetails.DEFAULT; public DatabaseOperator withConfigurationsFrom(String fileName) { //Get the configurations from the file, and initialize the 'Configuration' object configuration = initializeFrom(fileName); return this; } public DatabaseOperator withAuthenticationDetailsFrom(String fileName) { // Get authentication details from the file, and initialize AuthenticationDetails authDetails = initializeAuthDetailsFrom(fileName); return this; } //.. and so on public void initiateConnection() { //Uses configuration and authDetails } }
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31146920
has comment: http://stackoverflow.com/comment/31146712
score: 2

int
tags question: http://stackoverflow.com/q/20782301
tags question: http://stackoverflow.com/q/20794401
tags question: http://stackoverflow.com/q/20806803
type: Tag
tags question: http://stackoverflow.com/q/20808664
tags question: http://stackoverflow.com/q/20773938
tags question: http://stackoverflow.com/q/20725365
tags question: http://stackoverflow.com/q/20759301
tags question: http://stackoverflow.com/q/20720186
tags question: http://stackoverflow.com/q/20776371
tags question: http://stackoverflow.com/q/20787520
tag name: int
tags question: http://stackoverflow.com/q/20808782
tags question: http://stackoverflow.com/q/20791240
tags question: http://stackoverflow.com/q/20829733
tags question: http://stackoverflow.com/q/20791211

http://stackoverflow.com/comment/31180611
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20798586
type: AnswerComment
has text: That will not give exact memory usage of hash map it will also include memory of intermediate POJO's , variables, iterators etc.. what i need is memory occupied by hash map only

http://stackoverflow.com/a/20753193
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20753136
has body: In Log4J 1.x : Use BasicConfigurator.configure(); Taken from Log4J manual: The log4j environment is fully configurable programmatically. However, it is far more flexible to configure log4j using configuration files. Currently, configuration files can be written in XML or in Java properties (key=value) format. Let us give a taste of how this is done with the help of an imaginary application MyApp that uses log4j. import com.foo.Bar; // Import log4j classes. import org.apache.log4j.Logger; import org.apache.log4j.BasicConfigurator; public class MyApp { // Define a static logger variable so that it references the // Logger instance named "MyApp". static Logger logger = Logger.getLogger(MyApp.class); public static void main(String[] args) { // Set up a simple configuration that logs on the console. BasicConfigurator.configure(); logger.info("Entering application."); Bar bar = new Bar(); bar.doIt(); logger.info("Exiting application."); } } Class Bar is as follows: package com.foo; import org.apache.log4j.Logger; public class Bar { static Logger logger = Logger.getLogger(Bar.class); public void doIt() { logger.debug("Did it again!"); } } The invocation of the BasicConfigurator.configure method creates a rather simple log4j setup. This method is hardwired to add to the root logger a ConsoleAppender. The output will be formatted using a PatternLayout set to the pattern "%-4r [%t] %-5p %c %x - %m%n". Note that by default, the root logger is assigned to Level.DEBUG. The output of MyApp is: 0 [main] INFO MyApp - Entering application. 36 [main] DEBUG com.foo.Bar - Did it again! 51 [main] INFO MyApp - Exiting application. In Log4J 2.x : The example would be the same but *without the call *BasicConfigurator.configure(); and also Logger.getLogger would be LogManager.getLogger
type: Answer

http://stackoverflow.com/q/20741128
score: -1
tagged with: http://stackoverflow.com/tag/xml
downvote count: 2
accepted answer: http://stackoverflow.com/a/20741408
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31078806
has title: Fetch tag names from XML
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31078075
has answer: http://stackoverflow.com/a/20741408
favorite count: 0
has comment: http://stackoverflow.com/comment/31078256
has body: I have some XML: <Details> sam 18 Using the code below, I'm able to read the values values sam and 18. I also need to retrieve the element names name and age. How do I get it? My current code: Element root = XMLDocument.getDocumentElement(); NodeList nodelist = root.getChildNodes(); String[] rowdata = new String[2]; for (int nodeIndex = 0; nodeIndex < nodelist.getLength(); nodeIndex++) { Node node = nodelist.item(nodeIndex); for(int elementIndex=0; elementIndex<node.getChildNodes().getLength(); elementIndex++){ rowdata[0] = node.getChildNodes().item(elementIndex).getNodeName().toString(); rowdata[1] = node.getChildNodes().item(elementIndex).getTextContent(); System.out.println(rowdata[0] + " - " + rowdata[1]); } }
has comment: http://stackoverflow.com/comment/31078090
type: Question
has comment: http://stackoverflow.com/comment/31078186

http://stackoverflow.com/comment/31064681
has text: What are you trying to do? You should write a helper class that does the XML handling for you and bind an instance of that to your scriptengine.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20705162
type: QuestionComment

http://stackoverflow.com/a/27180097
type: Answer
has comment: http://stackoverflow.com/comment/59747407
has comment: http://stackoverflow.com/comment/59751267
upvote count: 7
answers question: http://stackoverflow.com/q/20707543
downvote count: 0
has body: I realised that providedCompile sometimes introduced dependencies issues for me, e.g. some classes are not found. I then figured out a more flexible solution. We can just configure required dependencies as 'compile' and then exclude specific jars from the war file by using the following war configuration: war { classpath = classpath.filter { file -&gt; println file.name ( !file.name.startsWith('gwt-dev') &amp;&amp; !file.name.startsWith('gwt-user') &amp;&amp; !file.name.startsWith('guava-gwt') &amp;&amp; !file.name.startsWith('gwtbootstrap3') &amp;&amp; !file.name.startsWith('gwtbootstrap3-extras') &amp;&amp; !file.name.startsWith('servlet-api') ) } } So far, I found this is the cleanest solution for me. I hope it helps.
score: 7
has comment: http://stackoverflow.com/comment/59844471

http://stackoverflow.com/a/20783554
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31153709
type: Answer
downvote count: 0
has body: The error says: A location step was expected following the '/' or '//' token. The problem is that after slash, the brackets are not enough. An element or @attribute, potentially prefixed with some_axis:: is expected. The predicate in brackets further filters the set of matched nodes. To match any element, use *, like //div[@class='master_container']/*[@id='netspidersosh'] By the way, why so long XPath? In HTML, the id value should be unique, so potentially this expression might suffice: //*[@id='cmt']/div/span Update: An introductory-level tutorial to XPath can be found at: http://zvon.org/xxl/XPathTutorial/Output/example1.html
accepted answer of: http://stackoverflow.com/q/20783331
score: 3
answers question: http://stackoverflow.com/q/20783331

http://stackoverflow.com/q/20783506
type: Question
has answer: http://stackoverflow.com/a/20783787
has body: Is it possible to parse an XML and get all the leaf nodes ? <name>abc<name> 12 cse My output should be name age branch
has title: Get leaf nodes - XML parsing in Java
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/77899272
downvote count: 0
has answer: http://stackoverflow.com/a/20786610
has comment: http://stackoverflow.com/comment/31153381
favorite count: 0
accepted answer: http://stackoverflow.com/a/20786610
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/20783639
has answer: http://stackoverflow.com/a/20783639
tagged with: java
has comment: http://stackoverflow.com/comment/31153397
linked to: http://stackoverflow.com/q/12831530
has comment: http://stackoverflow.com/comment/31158837

http://stackoverflow.com/q/20751115
type: Question
has comment: http://stackoverflow.com/comment/31097147
has comment: http://stackoverflow.com/comment/31099900
has answer: http://stackoverflow.com/a/40517257
has comment: http://stackoverflow.com/comment/31099988
tagged with: reactive-programming
possible better answer: http://stackoverflow.com/a/20752832
has comment: http://stackoverflow.com/comment/31099786
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/20752832
has answer: http://stackoverflow.com/a/21333797
has title: Is it possible to build a Reactive Application using a non-Functional language?
has comment: http://stackoverflow.com/comment/31099814
downvote count: 0
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/31155946
answer count: 3
tagged with: functional-programming
accepted answer: http://stackoverflow.com/a/21333797
has comment: http://stackoverflow.com/comment/31099864
type: AnsweredQuestion
score: 3
favorite count: 0
has body: I would like to understand if the principles behind the Reactive Application manifesto can be achieved using a non-functional language. Some people say that since FP use immutable states and free side-effects functions, they are easier to implement concurrent, distributed and resilient systems. But how can we achieve that using Java for example? There are some frameworks like Apache Camel, that have some components to work with, like Camel RX, and Camel SEDA. Are these frameworks enough? I will try to clarify my question: I think of reactive programming as new programming paradigm, and a new programming paradigm requires new tools and frameworks. Functional languages deals with objects differently, that's why there's a lot of articles about FRP working with things event-based and asynchronously. But now, backing to Java, or other Object Oriented language, let's think in a Web Application: How can we create a java web application that makes use of good event-based frontend. These events then pass information asynchronously in a smooth way to the backend. The backend can scale easily and be resilient as well. I know that is possible to create an application that accomplish these requirements using java, and servlets, and EJBs, but my question is, can we do it differently? More close to a reactive approach? I thought something like this: A nice ajax framework in the frontend, that makes the "passing information" with the backend smoothly. In the backend a way to use a framework or library (Camel SEDA ou Camel RX) to execute things in parallel. Do you think this is a good approach?
has comment: http://stackoverflow.com/comment/31096868
has comment: http://stackoverflow.com/comment/31115296

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/20791925
type: Tag

http://stackoverflow.com/q/20757728
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: org.ksoap2.serialization.SoapSerializationEnvelope
tagged with: soap
downvote count: 0
score: 1
tagged with: java
has body: Can any one help me out to clear this error? I have done all the settings... Selected the jar file in the java build path also.. my folder also in the name of libs only... when I connect my webservice with my android app using a login button the error shows it up always.... my app contains the certificate problem with a expired certificate webpage.. and I added the code to bypass the certificate error... But this SoapSerialization error always occurs when I click the login button.. and here Is my code package com.test.mqilynx; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.os.Bundle; import android.os.StrictMode; import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } Button loginb = (Button) findViewById(R.id.button1); loginb.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub EditText uname = (EditText) findViewById(R.id.editText1); EditText pwd = (EditText) findViewById(R.id.editText2); String ustr = uname.getText().toString(); String pstr = pwd.getText().toString(); if (ustr.isEmpty() &amp;&amp; pstr.isEmpty()){ Toast to = Toast.makeText(MainActivity.this,"Please Login …
has comment: http://stackoverflow.com/comment/31113308
type: Question
has comment: http://stackoverflow.com/comment/31135661
has answer: http://stackoverflow.com/a/20757764
answer count: 2
has answer: http://stackoverflow.com/a/20760839
tagged with: ksoap
upvote count: 1
has comment: http://stackoverflow.com/comment/31111249
has comment: http://stackoverflow.com/comment/31109024
has comment: http://stackoverflow.com/comment/31112491

http://stackoverflow.com/comment/31268917
comment on: http://stackoverflow.com/a/20846115
type: AnswerComment
has text: I'm not at my PC, but from memory, they might be.
score: 0
type: Comment

http://stackoverflow.com/comment/56190055
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20807657
has text: The problem is there on jdk1.7.0_79
score: 1

http://stackoverflow.com/comment/31003638
comment on: http://stackoverflow.com/q/20700038
has text: Why are you giving the same name 'user_submit' to the input elements. When you submit form the form data is sent as name-value pairs and at server you retrieve the value using the name.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20783152
accepted answer: http://stackoverflow.com/a/20783386
score: 5
has body: We've got 2 pieces of code: int a = 3; while (a &lt;= n) { a = a * a; } And: public void foo(int n, int m) { int i = m; while (i &gt; 100) i = i / 3; for (int k = i ; k &gt;= 0; k--) { for (int j = 1; j &lt; n; j*=2) System.out.print(k + "\t" + j); System.out.println(); } } What is the time complexity of them? I think that the first one is: O(logn), because it's progressing to N with power of 2. So maybe it's O(log2n) ? And the second one I believe is: O(nlog2n), because it's progressing with jumps of 2, and also running on the outer loop. Am I right?
has title: Time complexity for two pieces of code
type: AnsweredQuestion
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/20783376
type: Question
answer count: 2
tagged with: time-complexity
downvote count: 0
has answer: http://stackoverflow.com/a/20783386
possible better answer: http://stackoverflow.com/a/20783376
has comment: http://stackoverflow.com/comment/31152952
favorite count: 0

http://stackoverflow.com/a/20747721
score: -2
answers question: http://stackoverflow.com/q/20747693
downvote count: 3
has body: Add this method in your class, but outside the onCreate() method @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.action_bar, menu); setTitle(""); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch(item.getItemId()) { case android.R.id.home: PreferenceActivity.this.onBackPressed(); break; } return true; } Now, after your comments. you may have to create a file called action_bar.xml in your res/menu folder, and add the following to it &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;/menu&gt;
accepted answer of: http://stackoverflow.com/q/20747693
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31090975
has comment: http://stackoverflow.com/comment/31090302
has comment: http://stackoverflow.com/comment/31091871
has comment: http://stackoverflow.com/comment/31090524
type: Answer
has comment: http://stackoverflow.com/comment/31090679
has comment: http://stackoverflow.com/comment/31092035
has comment: http://stackoverflow.com/comment/31091919
has comment: http://stackoverflow.com/comment/31090818

http://stackoverflow.com/comment/31214603
comment on: http://stackoverflow.com/a/20810676
score: 0
type: AnswerComment
type: Comment
has text: Yep, it's working now! Your solution was definitely the answer, but when I first declared "Task task" inside the main class, I forgot to say "private". I added that in and it works. Thanks very much for all your help!

http://stackoverflow.com/q/20767191
tagged with: java
tagged with: mysql
has body: I am trying to make an app that's gonna require user login and user can sign up there. I am using mySQL. My tables are okay. my code doesnt give any compile time error but it gives a lot of run time error AND force Closes whenever click create button which executes HttpPost. Dont know what to do. I am posting my code. Please help with the code and error. package com.example.learning2; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.ToggleButton; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button crtButton = (Button) findViewById(R.id.button1); crtButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), newUser.class); startActivity(i); } }); } @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; } } //newUser.java package com.example.learning2; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class newUser extends Activity{ JSONParser jsonParser = new JSONParser(); EditText idForm; EditText nameForm; EditText passForm; final String url_of_post = "http://loca…
type: Question
has answer: http://stackoverflow.com/a/20868596
has comment: http://stackoverflow.com/comment/31125331
score: 0
has comment: http://stackoverflow.com/comment/31125224
answer count: 1
accepted answer: http://stackoverflow.com/a/20868596
has title: force Closes sign up activity in android using mySQL and php
has comment: http://stackoverflow.com/comment/31126490
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/31210754
has comment: http://stackoverflow.com/comment/31126461
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

overloading
tags question: http://stackoverflow.com/q/20692950
tags question: http://stackoverflow.com/q/20699306
type: Tag
tags question: http://stackoverflow.com/q/20783266
tags question: http://stackoverflow.com/q/20784493
tags question: http://stackoverflow.com/q/20730680
tags question: http://stackoverflow.com/q/20732451
tag name: overloading

http://stackoverflow.com/comment/31233577
type: Comment
comment on: http://stackoverflow.com/q/20827166
score: 0
has text: `cache.remove("key1")` would be an educated guess. You can't expect anything smarter based on the wealth of information you gave here.
type: QuestionComment

http://stackoverflow.com/comment/31232563
comment on: http://stackoverflow.com/q/20826688
score: 1
type: Comment
type: QuestionComment
has text: What is the use case? Why do you want to CREATE a database when launching your program? Such a task is something for a system administrator, not for users of your software.

http://stackoverflow.com/q/20823070
has comment: http://stackoverflow.com/comment/31225777
linked to: http://stackoverflow.com/q/2065184
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/20823328
has comment: http://stackoverflow.com/comment/31225773
answer count: 2
has title: How to pass object over a URL in JSP?
tagged with: jsp
has answer: http://stackoverflow.com/a/20823311
has body: I have an object which I get in the jsp file from the servlet. I want to pass this object over to another jsp file and display the contents in the other jsp file. 1st Jsp file: ChangeRoomVO vo=(ChangeRoomVO)request.getAttribute("booking"); &lt;a href="ChangeValidate.jsp?booking=&lt;%=vo%&gt;"&gt;&lt;input type="button" value="Change"&gt;&lt;/a&gt; 2nd jsp file: ChangeRoomVO vo=(ChangeRoomVO)request.getAttribute("booking"); out.print(vo.getBookingId()); The error says: &gt; org.apache.jasper.JasperException: An exception occurred processing &gt; JSP page /ChangeValidate.jsp at line 14 &gt; &gt; 11: &lt;body&gt; 12: &lt;% 13: ChangeRoomVO vo=(ChangeRoomVO)request.getAttribute("booking"); 14: out.print(vo.getBookingId()); root cause java.lang.NullPointerException the URL is able to pass the object but is not able to retrieve the data stored in it. Is there a work around which allows passing objects over URL?
tagged with: servlets
has comment: http://stackoverflow.com/comment/31225877
score: 0
possible better answer: http://stackoverflow.com/a/20823311
has comment: http://stackoverflow.com/comment/31225785
has answer: http://stackoverflow.com/a/20823328

http://stackoverflow.com/comment/31114143
comment on: http://stackoverflow.com/q/20761226
type: Comment
has text: Then what is the error/exception ?
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31105500
type: Comment
comment on: http://stackoverflow.com/q/20754727
type: QuestionComment
has text: Wild guess is `propertySupport` is null
score: 0

http://stackoverflow.com/comment/31572085
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20921857
has text: Can you post example with `@SpringApplicationConfiguration`? This not works for me.
type: AnswerComment

http://stackoverflow.com/comment/30998694
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20696519
type: Comment
has text: After Adding the JVM parameter i am getting as "EUR100011510Ã¾GBP100011200Ã¾GBP100011250Ã¾GBP100011500Ã¾GB"

http://stackoverflow.com/comment/31111927
score: 1
comment on: http://stackoverflow.com/q/20758032
type: Comment
type: QuestionComment
has text: Is port a Integer (and not a string ? Just guessing :P) ? Also try replacing getDefaultInstance with Session.getInstance(props). Also if that doesn't help. Try props "mail.smtp.connectiontimeout" and "mail.smtp.timeout" and set a limit to get a stacktrace. Often it is a firewall/Port/Network issue

http://stackoverflow.com/comment/31208484
type: Comment
score: 0
comment on: http://stackoverflow.com/a/20812771
has text: Refer to the article link I have provided, it's work. I have tried that one so many times.
type: AnswerComment

http://stackoverflow.com/comment/31183586
has text: So, you say AbstractFactory has more advantages on factoryMethod. Then what is the use of factory method over Abstract Factory.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/20800179

http://stackoverflow.com/q/20790272
tagged with: scope
has comment: http://stackoverflow.com/comment/31166162
score: 0
has comment: http://stackoverflow.com/comment/31189560
has comment: http://stackoverflow.com/comment/31165771
has comment: http://stackoverflow.com/comment/31165937
type: UnansweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/31165820
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31189679
type: Question
has title: How can I pull an object's data into an event handler
has comment: http://stackoverflow.com/comment/31169985
has body: I am trying to bring a String from an Item object named pt created in the class ReadAndSearch into the event class. I have not been able to get the program to return data, only NULL for the object's time field. There is data in the object's fields in the ReadAndSearch class. The error occurs where the &lt;&lt;== notes are shown. This is my first program in Java, I am learning as I go here. I am not sure what I have missed and cannot find it searching the Java 7 API or from Googling. Below are the three classes involved; Item, ReadAndSearch and Event. public class Item { private String name; private String time; public String getName() { return this.name; } public String setName(String name){ this.name = name; return name; } public String getTime() { return this.time; } public String setTime(String time){ this.time = time; return time; } } public class Event implements ActionListener { //wiring for action listener Item pt; //Put item assignment here, I think scope is part of the problem. @Override public void actionPerformed(ActionEvent e) { newProductCode = parttextfield.getText(); //This is where I assign the input to a String object. ReadAndSearch rs = new ReadAndSearch(); //Sending keyboard input to method readIt of class ReadAndSearch rs.readIt(newProductCode); //Sending keyboard input to method readIt of class ReadAndSearch String t = pt.getTime(); // &lt;&lt;== **This keeps pulling a NULL** int convertedtime = Integer.parseInt(t); // &lt;&lt;== Added this line to convert String to int **Failed System.out.println("If you can see this, " + convertedtime + " has been retrieved"); timerLabel.setText(" "+ convertedtime); //This is the first displayed element, then it is passed to TimeClass. TimeClass tc = new TimeClass(convertedtime); timer = new Timer(1000, tc); //tc is the actionListener the timer is waiting on. timer.start(); } } public class ReadAndSearch { public String line; public String name; public String time; Item pt = new Item(); public void readIt(Stri…

http://stackoverflow.com/a/20739632
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/20739600
upvote count: 3
type: Answer
has body: The data structure HashSet is unordered and unsorted collection. If you want your elements to be sorted using natural order, you can use TreeSet If you want to maintain using insertion order, use LinkedHashSet

http://stackoverflow.com/q/20683502
accepted answer: http://stackoverflow.com/a/20683614
type: Question
linked to: http://stackoverflow.com/q/16482488
tagged with: java
has answer: http://stackoverflow.com/a/20683670
answer count: 6
has answer: http://stackoverflow.com/a/20683767
tagged with: jtable
downvote count: 0
has body: I'm trying to implement an AbstractTableModel for a collection named "clients" but I keep receiving the error "required variable found value" for the "add" method. Here is my code: I'm sorry for the confusion created. The add method is meant to add a new client in the table (by that I mean a new row). I don't want to add a new client to the collection. class ModelTabel extends AbstractTableModel{ public int getRowCount() { return clients.size(); } public int getColumnCount() { return 4; } public Object getValueAt(int row, int column) { Client c = clients.get(row-1); switch(column){ case 0: return c.getName(); case 1: return c.getSurname(); case 2: return c.getID(); case 3: return c.getPhone(); default:return "ERROR"; } } public void add(Client c) { clients.get(clients.size()++) = a; fireTableDataChanged(); } }
has comment: http://stackoverflow.com/comment/30974988
has answer: http://stackoverflow.com/a/20683554
favorite count: 0
has answer: http://stackoverflow.com/a/20683614
possible better answer: http://stackoverflow.com/a/20683627
has title: implement AbstractTableModel for a Java collection
has answer: http://stackoverflow.com/a/20683627
has answer: http://stackoverflow.com/a/20683751
score: 2
tagged with: tablemodel
type: AnsweredQuestion
upvote count: 2
tagged with: swing

http://stackoverflow.com/comment/31085277
comment on: http://stackoverflow.com/q/20744737
score: 0
has text: it should works but better use some kind of array pooling
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/120276768
score: 0
type: Comment
type: QuestionComment
has text: anybody got the solution to question 1?
comment on: http://stackoverflow.com/q/20787957

http://stackoverflow.com/comment/31019447
comment on: http://stackoverflow.com/a/20708701
type: AnswerComment
score: 0
type: Comment
has text: @user944513 Ok so now explain why is this question is tagged with jQuery and Java when obviously is none of them?

http://stackoverflow.com/comment/106732673
has text: Very nicely explained. Follow this image to understand more of what is explained above. https://www.geeksforgeeks.org/wp-content/uploads/Blank-Diagram-Page-1-12.jpeg
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20696809
type: Comment

http://stackoverflow.com/q/20801248
score: 3
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/28050051
type: Question
has answer: http://stackoverflow.com/a/20801727
downvote count: 0
has comment: http://stackoverflow.com/comment/49439371
linked to: http://stackoverflow.com/q/17359830
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31185239
answer count: 3
favorite count: 0
has title: convert Arraylist into json
type: UnansweredQuestion
has body: please help how could we convert the below Arraylist method into Json public ArrayList&lt;String&gt; helloName(String patentno) { ArrayList&lt;String&gt; bibo = new ArrayList&lt;String&gt;(); for (int row = 2; row &lt; rowsize; row++) { pno = driver.findElement( By.xpath("//*[@id='body']/table/tbody/tr[" + row + "]/td")) .getText(); bibo.add(pno); } return bibo; }
has answer: http://stackoverflow.com/a/20801312

http://stackoverflow.com/a/20747145
score: 0
answers question: http://stackoverflow.com/q/20745189
type: Answer
has body: The way you implement your function insertRating is not the good approach. What you can do is to simply change your sql query as follow : "insert into movie_preferences(userID,movieID,preference,timestamp)values(1001,1067,5,10000000)". Also, you should put an Auto ID for the primary key.

http://stackoverflow.com/a/20680234
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/20680145
type: AcceptedAnswer
has body: You sort the characters in each word alphabetically to form key in a map whose values are the lists of words for that key. When you're given a word to find the anagrams for, you sort the characters in that word alphabetically and do a lookup in the map. From your example and adding the word POOL, you'd get: LOOP -&gt; [LOOP, POOL, POLO] OPST -&gt; [STOP, POST] The Java code would be something like: public class AnagramGenerator { private Map&lt;String, Collection&lt;String&gt;&gt; indexedDictionary; public AnagramGenerator(List&lt;String&gt; dictionary) { this.indexedDictionary = index(dictionary); } public Collection&lt;String&gt; getAnagrams(String word) { return indexedDictionary.get(sort(word)); } private Map&lt;String, Collection&lt;String&gt;&gt; index(List&lt;String&gt; dictionary) { MultiMap&lt;String, String&gt; indexedDictionary = HashMultimap.create(); for (String word : dictionary) { indexDictionary.put(sort(word), word); } return indexedDictionary.asMap(); } private String sort(String word) { List&lt;Character&gt; sortedCharacters= Arrays.asList(word.toCharArray()); Collections.sort(sortedCharacters); StringBuilder builder = new StringBuilder(); for (Character character : sortedCharacters) { builder.append(character); } return builder.toString(); } }
downvote count: 0
answers question: http://stackoverflow.com/q/20680145

http://stackoverflow.com/comment/31462833
type: QuestionComment
has text: I already have those lines in my project but that doesn't change, i have still the same error
comment on: http://stackoverflow.com/q/20700481
score: 0
type: Comment

http://stackoverflow.com/comment/31090814
type: Comment
has text: So what do i do instead of putting null
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20747980

http://stackoverflow.com/a/20692927
downvote count: 0
has body: Here: System.out.println("Course List: "+getCourse()); You're printing out the default toString() returned by an array of String. Don't do that. Iterate through the array and print each item or else use java.util.Arrays.toString(...). System.out.println("Course List: "+ java.util.Arrays.toString(getCourse())); You will also need to give your Course class a valid toString() method, one that returns the courseName and perhaps the credit hours. Also I would change the course field to courses or courseList to reflect that it does not represent one single course but rather a collection of courses. Likewise the getter method should reflect the field name change.
answers question: http://stackoverflow.com/q/20692900
type: Answer
upvote count: 6
score: 6

http://stackoverflow.com/q/20847599
has answer: http://stackoverflow.com/a/20906459
tagged with: robospice
answer count: 1
downvote count: 0
favorite count: 0
tagged with: google-http-client
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
has title: Robospice Cached Object is Always null
type: Question
accepted answer: http://stackoverflow.com/a/20906459
has body: For some reason pulling a cached object back from the cache in Robospice is always null. Is there something I'm doing wrong? getSpiceManager().execute(cardRequest, Card.class.getName(), DurationInMillis.ONE_DAY, new CardRequestListener()); Is how it's executed. The spice manager is created as follows: mSpiceManager = new SpiceManager(JacksonGoogleHttpClientSpiceService.class); And the card class is as follows: @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "iosThumbHighRes", "iosThumb", "iosLargeHiRes", "iosLargeHighRes", "iosLarge" }) public class Card { @JsonProperty("iosThumbHighRes") private String iosThumbHighRes; @JsonProperty("iosThumb") private String iosThumb; @JsonProperty("iosLargeHiRes") private String iosLargeHiRes; @JsonProperty("iosLargeHighRes") private String iosLargeHighRes; @JsonProperty("iosLarge") private String iosLarge; private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;(); @JsonProperty("iosThumbHighRes") public String getIosThumbHighRes() { return iosThumbHighRes; } @JsonProperty("iosThumbHighRes") public void setIosThumbHighRes(String iosThumbHighRes) { this.iosThumbHighRes = iosThumbHighRes; } @JsonProperty("iosThumb") public String getIosThumb() { return iosThumb; } @JsonProperty("iosThumb") public void setIosThumb(String iosThumb) { this.iosThumb = iosThumb; } @JsonProperty("iosLargeHiRes") public String getIosLargeHiRes() { return iosLargeHiRes; } @JsonProperty("iosLargeHiRes") public void setIosLargeHiRes(String iosLargeHiRes) { this.iosLargeHiRes = iosLargeHiRes; } @JsonProperty("iosLargeHighRes") public String getIosLargeHighRes() { return iosLargeHighRes; } @JsonProperty("iosLargeHighRes") public void setIosLargeHighRes(String iosLargeHighRes) { this.iosLargeHighRes = iosLargeHighRes; } @JsonProperty("iosLarge") public String getIosLarge() { return iosLarge; } @JsonProperty("iosLarge") public void setIosLarge(String iosLarge) { this.iosLarge = iosLarge; } @Override public Strin…

http://stackoverflow.com/q/20843431
has answer: http://stackoverflow.com/a/20843469
tagged with: eclipse
has answer: http://stackoverflow.com/a/20843590
tagged with: import
downvote count: 0
possible better answer: http://stackoverflow.com/a/20843576
score: 1
has answer: http://stackoverflow.com/a/20843576
has title: Manifest file doesn't contain the correct activites in my project
type: Question
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/20843469
favorite count: 0
has body: basically, I imported a project from a laptop. This apparently worked alright, but the default project files were still there. I deleted these. However the manifest file didn't change/update for the new activities from the imported project. Is there a way to update the manifest file through Eclipse?? (I have already tried cleaning the project, to no success). It currently only contains the single default activity. Or do I need to manually update it, by adding entries for each activity?? Thanks for the help!!! :)
answer count: 3
upvote count: 1
tagged with: android-manifest
tagged with: java

http://stackoverflow.com/q/20802349
tagged with: java
has comment: http://stackoverflow.com/comment/31187689
type: Question
tagged with: jsp
accepted answer: http://stackoverflow.com/a/20802577
tagged with: servlets
score: 0
tagged with: requestdispatcher
has comment: http://stackoverflow.com/comment/31187408
answer count: 1
has answer: http://stackoverflow.com/a/20802577
has comment: http://stackoverflow.com/comment/31187431
has title: Dispatching requests from a servlet to jsp
has comment: http://stackoverflow.com/comment/31187368
has body: I have a jsp page which display some records in a table and each record has a link called update next to it. When update is clicked , the jsp page will call a servlet which gets some information from the url , such as the record ownername , record title , etc. (When the link is clicked , these information are attached to url). The servlet which is called by the jsp page , will then dispatch its request and response to another jsp page , it will display "OK". (This is just a simple program which i have setup) My problem is, the sevlet cannot dispatch to the other jsp page. Here is what i have done : This is the First Jsp page which will display the records (Works perfectly) Project Owner Project Supervisor Project Title Project Description Start-Date End-Date Approval Status <c:forEach items="${nominationList}" var="Iter"> ${Iter.projectOwner} ${Iter.projectSupervisor} ${Iter.projectTitle} ${Iter.projectDescription} ${Iter.startDate} ${Iter.endDate} ${Iter.acceptStatus} Update //Above is the link to update each record </c:forEach> This is the servlet code which it will call RequestDispatcher updateDispatcher=request.getRequestDispatcher("testing.jsp"); updateDispatcher.forward(request, response); //this servlet dispatches to the other jsp page I found that if i remove the extra things in the url to update (In first jsp page code) , it works but the problem is i need those extra things to implement something else in the future. Thank you for your time.
type: AnsweredQuestion

http://stackoverflow.com/comment/30972479
score: 1
has text: Generics are compile time. In run-time it does not behave as you think. Cast it to `String`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20682958

http://stackoverflow.com/a/20726489
has comment: http://stackoverflow.com/comment/31065419
has comment: http://stackoverflow.com/comment/31130114
has comment: http://stackoverflow.com/comment/31101681
has comment: http://stackoverflow.com/comment/31129956
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20725365
score: 1
has comment: http://stackoverflow.com/comment/31053079
has comment: http://stackoverflow.com/comment/31064356
has comment: http://stackoverflow.com/comment/31130080
has comment: http://stackoverflow.com/comment/31101967
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/20725365
type: Answer
has comment: http://stackoverflow.com/comment/31130007
has body: You only need two lines: int num = Integer.parseInt(str.replaceAll("\\D", "")); String letter = str.replaceAll("\\d", ""); The order of letters and digits in the string is irrelevant - this will work either way. Edited to cater for requirements as per comments below To process a series of letter-digit pairs in larger string, parsing the letter to an int x (where A=1, B=2, etc) and assigning the digit(s) to int y, you can split the string up on whitespace and use code similar to above: for (String pair : command.toUpperCase().split("\\s+")) { int x = pair.replaceAll("\\d", "").charAt(0) - '@'; int y = Integer.parseInt(pair.replaceAll("\\D", "")); } Using split() means not having to sully yourself with the tedium of using a loop variable. The reason for subtracting '@' is that is the character one before 'A', so subtracting that will convert A to 1, B to 2, etc. Here's some test code: String command = "A5 B10 11C 20D"; for (String pair : command.split("\\s+")) { int x = pair.replaceAll("\\d", "").charAt(0) - '@'; int y = Integer.parseInt(pair.replaceAll("\\D", "")); System.out.format("X = %d, Y = %d\n", x, y); } Output: X = 1, Y = 5 X = 2, Y = 10 X = 3, Y = 11 X = 4, Y = 20
has comment: http://stackoverflow.com/comment/31053119
has comment: http://stackoverflow.com/comment/31130377

http://stackoverflow.com/comment/31170962
comment on: http://stackoverflow.com/a/20792895
has text: I updated my code and when the thumb is at 190, `tvOne` is showing 260 instead of 190 :/ I think that's where the issue is... When the thumb is over 110, it works fine the first time and then when going back to 70, and I slide the thumb to higher number, that's when it seems to mess up.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/30969957
has text: But with this I for example could not write: `AbstractService<FirstResponse> myservice = new SecondService();` if `class SecondService<SecondResponse>`. I'd like to chose the service based on a condition, and then run `myservice.process` whatever the service is.
comment on: http://stackoverflow.com/a/20681502
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/20743766
has answer: http://stackoverflow.com/a/20743825
favorite count: 0
has body: So i'am using graphics2d to draw a grid on a JPanel. But when i resize the window it will end with weird results. @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); /* * Draw the background */ boolean isWhite = false; for(int x = 0; x &lt; getSize().width/8; x++){ for(int y = 0; y &lt; getSize().height/8; y++){ if(isWhite){ g2d.setColor(Color.white); isWhite = false; }else{ g2d.setColor(Color.LIGHT_GRAY); isWhite = true; } g2d.fillRect(8*x, 8*y, 8, 8); } } g2d.dispose(); } So instead of drawing 8x8 squares it will draw horizontal rectangles (getSize().width()x8). Update I'am drawing a grid that will fill an entire JPanel. So when the window is resizing the grid will expand and that works. But it will draw weird shapes(Sometimes). The grid-cell have a constant size of 8x8
has title: Swing drawing a grid. Wierd result
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: swing
possible better answer: http://stackoverflow.com/a/20743825
type: Question
tagged with: java
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/20744198
accepted answer: http://stackoverflow.com/a/20744198

http://stackoverflow.com/q/20843815
has title: What does StringTokenizer(str," .,?!"); function do?
tagged with: java
tagged with: stringtokenizer
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/20843886
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/31264302
upvote count: 0
has body: I was wondering what does the following function do for the following input: String s=" HELLO!THIS IS A TEST.OK?"; StringTokenizer stk=StringTokenizer(s," .,?!"); And also, can anyone explain about this function too? Thanks!
has comment: http://stackoverflow.com/comment/31264193
favorite count: 0
has comment: http://stackoverflow.com/comment/31264141
possible better answer: http://stackoverflow.com/a/20843886
has answer: http://stackoverflow.com/a/20843930
accepted answer: http://stackoverflow.com/a/20843930
type: AnsweredQuestion

http://stackoverflow.com/comment/31196470
score: 0
has text: I got it. There's one more misunderstanding: All the statements are executed then the update is performed?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/20807303

http://stackoverflow.com/q/20800791
score: 0
has comment: http://stackoverflow.com/comment/31184869
has comment: http://stackoverflow.com/comment/31188167
has comment: http://stackoverflow.com/comment/31188183
has title: Runnables in Spring's Task Scheduler
answer count: 0
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31187977
has body: I'm using the below snippet in Spring to schedule job executions. A job is found by querying the database. Once a new job is found (which has not yet been scheduled), it is scheduled programmatically. My question is, is this the way to create Runnables for task execution? Is it accessing taskScheduler in the right way or should it access it by fetching an instance from application context? @Service public class TimeOfDayScheduler { @Autowired private JobExecutor jobExecutor; @Autowired private TaskScheduler taskScheduler; @Scheduled(cron = "${scheduler.interval}") @PostConstruct public void findNewJobs() { // Checks the database if any new jobs should be scheduled // ... // If found: scheduleJob(somejob); // ... } public void scheduleJob(final Job job) { Runnable task = new Runnable() { @Override public void run() { try { jobExecutor.execute(job); } catch (Exception e) { logger.error("Scheduler error", e); } } }; taskScheduler.schedule(task, new CronTrigger(job.getCronPattern()) } }

http://stackoverflow.com/a/20751054
downvote count: 0
has body: Make sure you dont have any space between b1.addActionListener(this); add and ActionListener. addActionListener is the method for adding the actionlistener.
has comment: http://stackoverflow.com/comment/31096925
type: Answer
answers question: http://stackoverflow.com/q/20751023
score: 1
upvote count: 1

http://stackoverflow.com/comment/31075637
type: QuestionComment
comment on: http://stackoverflow.com/q/20739491
has text: @sanjeevmk yes it does.
score: 0
type: Comment

http://stackoverflow.com/a/38442770
score: 0
has body: Had the same error log as yours. Solved by adding -Djava.net.preferIPv4Stack=true to the last line in the asadmin script
answers question: http://stackoverflow.com/q/20776798
type: Answer

http://stackoverflow.com/q/20686072
has comment: http://stackoverflow.com/comment/30980603
has comment: http://stackoverflow.com/comment/30979229
has comment: http://stackoverflow.com/comment/30982106
type: Question
has comment: http://stackoverflow.com/comment/30980354
tagged with: java
has answer: http://stackoverflow.com/a/25203419
tagged with: corba
score: 0
has comment: http://stackoverflow.com/comment/30980656
answer count: 1
tagged with: distributed-transactions
tagged with: jacorb
has comment: http://stackoverflow.com/comment/30980198
has body: My IDL looks like: interface TransactionResource { void prepare() raises (NotPreparedException); void commit() raises(TransactionException); void rollback() raises(TransactionException); }; interface ManageDemand : TransactionResource { string createDemand(in string demand); }; interface ManageAccount : TransactionResource { string createDemand(in string demand); }; I create the ManageDemand distributed object on Server , I make it persistent, and it's reachable through the CORBALOC address. On my client I have: Object obj = orb.string_to_object(url.toString()); TransactionResource transactionResource = null; if (obj._is_a("IDL:transaction/ManageDemand:1.0")){ transactionResource = ManageDemandHelper.narrow(obj); } else { transactionResource = ManageAccountHelper.narrow(obj); } When I try to test if the transactionResource object (distributed reference) is an instance of ManageDemand, the result is true. But if I invoke Transaction object, defined like this: interface Transaction { ProxyStream addResource(in TransactionResource resource); } And I pass in parameter the transactionResource distributed reference, in this method when I test if this resource is an instance of ManageDemand, the result is false. What I have to do, to recognize that this transactionResource is instance of ManageDemand on the addResource method?
has title: How can I recognize that the object is instance of an interface when passed in parameter ? [Corba, Java]
tagged with: idl
has comment: http://stackoverflow.com/comment/30982073
type: UnansweredQuestion

http://stackoverflow.com/comment/71242273
type: QuestionComment
has text: We've been searching for a Google Wallet web API as well and can't find it. We'd like to send money to users, and know this would work via their Android API, but need to do this from our website, not an Android app. https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/
score: 0
type: Comment
comment on: http://stackoverflow.com/q/20680842

bit-manipulation
tags question: http://stackoverflow.com/q/20790746
tags question: http://stackoverflow.com/q/20750346
type: Tag
tags question: http://stackoverflow.com/q/20805015
tag name: bit-manipulation
tags question: http://stackoverflow.com/q/20711347

http://stackoverflow.com/comment/31072711
score: 0
has text: post the code relevant to opening the socket
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20737753

http://stackoverflow.com/a/20713190
has body: Implement your own method that iterate over all the constants and returns the appropriate one or null/some exception. public VideoBandwidth valueOf(int bandwidth) { for (VideoBandwidth videoBandwidth : values()) { if (videoBandwidth.bandwidth == bandwidth) return videoBandwidth; } throw new RuntimeException(); }
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20713160

http://stackoverflow.com/q/20790704
accepted answer: http://stackoverflow.com/a/21333979
linked to: http://stackoverflow.com/q/13121914
has comment: http://stackoverflow.com/comment/31770130
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31169988
has body: The essence of question briefly: 1) How to pun one xml, which should be wrapped by CDATA, inside other xml in Jersey? 2) How to avoid converting "<" into "& lt;" and ">" into "& gt;" during Marshalling? More details: I need to send XML to external server This XML should be in the following format: some value <?xml version="1.0" encoding="UTF-8" ?> 1 1 ... n n That is one of the elements inside of external XML should be another XML, wrapped by CDATA. First of all I made following bean: import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "root") public class Req { protected String element1; protected Element2 element2; @XmlElement(name = "element1") public String getElement1() { return element1; } public void setElement1(String element1) { this.element1 = element1; } @XmlElement(name = "element2") public Element2 geElement2() { return element2; } public void setElement2(Element2 element2) { this.element2 = element2; } public static class Element2{ protected InnerXlmElement innerXlmElement; @XmlElement(name = "innerXlmElement") public InnerXlmElement getInnerXlmElement() { return innerXlmElement; } public void setInnerXlmElement(InnerXlmElement innerXlmElement) { this.innerXlmElement = innerXlmElement; } public static class InnerXlmElement{ protected Item[] item; @XmlElement(name = "item") public Item[] getItem() { return item; } public void setItem(Item[] item) { this.item = item; } public static class Item{ protected String itemElement1; protected String itemElement2; @XmlElement(name = "itemElement1") public String getItemElement1() { return itemElement1; } public void setItemElement1(String itemElement1) { this.svcId = itemElement1; } @XmlElement(name = "itemElement2") public String getItemElement2() { return itemElement2; } public void setItemElement2(String itemElement2) { this.itemElement2 = itemElement2; } } } Generated XML, which have been sent to external server during request, looked like: <?xm…
has title: Jersey: marsheling and unmarsheling xml within other xml
tagged with: marshalling
type: Question
has answer: http://stackoverflow.com/a/21333979
tagged with: java
tagged with: jaxb
score: 0
tagged with: jersey
linked to: http://stackoverflow.com/q/3136375
has comment: http://stackoverflow.com/comment/31349848
answer count: 1

http://stackoverflow.com/comment/31153978
type: Comment
has text: my map and reduce classes are in the same file with main method.
comment on: http://stackoverflow.com/q/20781120
score: 0
type: QuestionComment

http://stackoverflow.com/a/20841113
answers question: http://stackoverflow.com/q/20841038
has body: Use Scanner#hasNextLine() method to do a check before you read the next line if(in.hasNextLine()) String numbers = in.nextLine(); NoSuchElementException is thrown when in.nextLine() is invoked when there is no line found
downvote count: 0
has comment: http://stackoverflow.com/comment/31262816
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/20707543
has answer: http://stackoverflow.com/a/29258629
has answer: http://stackoverflow.com/a/31704538
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/20707576
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/66775264
tagged with: war
has body: I have a multi-project Gradle build structure, where child project depends on a JAR, which I don't want to be in WAR file. I tried "exclude" but it does not work. The main project script: apply plugin: 'war' war { dependencies { runtime (project(':childProject')) { exclude group: 'javax.servlet.jsp', module: 'jsp-api' } } } The childProject script: apply plugin: 'java' dependencies { compile 'javax.servlet.jsp:jsp-api' }
score: 21
tagged with: java
upvote count: 21
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/31016930
has answer: http://stackoverflow.com/a/27180097
tagged with: jar
has title: Gradle: How to exclude JAR from a WAR?

http://stackoverflow.com/a/20688988
type: Answer
answers question: http://stackoverflow.com/q/20688705
has body: Use a JTextPane instead of a JTextArea. You need a Document object also. There way there's much more versatility also. Then You can use a one liner to write the entire document to a file BufferedWriter bw = new BufferedWriter(new FileWriter(file)); textPane.getEditorKit().write(bw, doc, 0, doc.getLength()); &lt;-- one line javadoc public abstract void write(OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException Writes content from a document to the given stream in a format appropriate for this kind of content handler. Parameters: out - The stream to write to doc - The source for the write. pos - The location in the document to fetch the content from &gt;= 0. len - The amount to write out &gt;= 0. JTextPane javadoc | EditorKit javadoc | Text Components Tutorial &lt;-- I really recommend this.
score: 0

http://stackoverflow.com/comment/30983914
type: Comment
type: QuestionComment
has text: @Raghunandan is right - you need to make sure both your project and the google play services API are using the same dependency. I would recommend not only copying one into the other, but also take this time to verify that you're using the latest jar and put it in both places. Alternatively, you could put it ONLY in google play (or leave the one that's there) and point your eclipse project to the google maps jar within google play services, deleting the one in your libs folder.
comment on: http://stackoverflow.com/q/20688820
score: 0

http://stackoverflow.com/q/20735122
type: UnansweredQuestion
tagged with: maven
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/20735191
upvote count: 7
tagged with: eclipse
type: Question
has title: Learning Maven: "Unable to parse configuration" for jar plugin
downvote count: 0
has answer: http://stackoverflow.com/a/20735160
has answer: http://stackoverflow.com/a/58438474
answer count: 3
tagged with: jar
favorite count: 0
has body: I am attempting to learn maven on a small project of my own, using eclipse. I converted the existing project to the maven standard directory configuration, and it was building; now I'm trying to get maven to produce the jar for the application. The following is pom.xml: 4.0.0 com.rc SpaceCheck 0.9.1-SNAPSHOT SpaceCheck jar <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.apache.maven.plugins maven-jar-plugin 2.3.2 **/src/* true lib/ spacecheck.SpaceCheck I didn't use to have the 'includes' clause; as near as I can tell, that's what the example I got pointed to told me to do to fix the problem. It does not. When I attempt to build, I get: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar (default-jar) on project SpaceCheck: Unable to parse configuration of mojo org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar for parameter includes: Cannot assign configuration entry 'includes' with value '*/src/' of type java.lang.String to property of type java.lang.String[] -> [Help 1] The "Help 1" link points me to the tutorial that I followed to get this far. The problem I have with the tutorial is that it doesn't explain how things work -- it gives you an example and expects you to extract general workings from the example. There's nothing wrong with examples, but they rarely match exactly what one wants to do. I'm sure many people can tell me what's wrong, and I would appreciate it. But it would be even better if they could ALSO tell me where this is explained, not just where there is an example that does something similar. The explanation, to be complete, would explain what element needs to be added, just where in the XML that goes, and what the various options are for the thing that goes there.

http://stackoverflow.com/comment/31110582
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/20738712
type: Comment
has text: that should just be `abstract class Parent<T>`

http://stackoverflow.com/a/20685084
has comment: http://stackoverflow.com/comment/30976454
has comment: http://stackoverflow.com/comment/30976543
score: 0
answers question: http://stackoverflow.com/q/20685017
has body: I assume that T is the input of Funcn, and K the return type of it. It then has to return a list of K to work, else the generic signature of Funcn is useless. public java.util.ArrayList&lt;K&gt; map(Funcn&lt;T,K&gt; fn){ ArrayList&lt;K&gt; lst = new ArrayList&lt;K&gt;(); for(T value:this){ lst.add( fn.eval(value) ); } return lst; }
type: Answer

http://stackoverflow.com/comment/31119073
type: Comment
type: QuestionComment
has text: It's a command line utility program, proided by default on most Unix/Linux (including Mac OS X). http://www.thegeekstuff.com/2012/04/curl-examples/
comment on: http://stackoverflow.com/q/20702884
score: 0

http://stackoverflow.com/q/20778011
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31144557
has answer: http://stackoverflow.com/a/20778059
tagged with: database
has answer: http://stackoverflow.com/a/20778109
score: 0
tagged with: nullpointerexception
has title: Working with Java database
has comment: http://stackoverflow.com/comment/31144526
tagged with: connection
type: UnansweredQuestion
has body: I'm creating a java program which requires a user to provide login details before gaining access. i'm working with a javaDB which i stored the data in a table named LOGIN_DETAILS, i have a successful connection but the problem is whenever i run the program i get this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Classes.Login.bActionPerformed(Login.java:188) and login.java:188 code is: Statement st = con.createStatement(); Below is my complete code; public void connect(){ try{ String host = "jdbc:derby://localhost:1527/db1"; String uName = ""; String uPass = ""; con = DriverManager.getConnection(host, uName, uPass); } catch(SQLException ex){ } } try{ Statement st = con.createStatement(); Menu MM = new Menu(); String user = t.getText().trim(); String pass = t1.getText().trim(); String sql = "SELECT USERNAME, PASSWORD FROM " + "APP.LOGIN_DETAILS WHERE " + "USERNAME ='"+user+"'PASSWORD ='"+pass+"'"; ResultSet rs = st.executeQuery(sql); int count = 0; while(rs.next()){ count = count + 1; } if(count ==1){ JOptionPane.showMessageDialog(null, "User Found, Access Granted"); this.dispose(); MM.setVisible(true); } else if(count &gt; 1){ JOptionPane.showConfirmDialog(null, "Duplicate User, Access Denied"); this.setVisible(true); } else{ JOptionPane.showMessageDialog(null,"User not Found"); this.setVisible(true); } } catch(SQLException | HeadlessException ex){ } Please help me in resolving the problem, thank you.

http://stackoverflow.com/comment/31107033
type: QuestionComment
score: 1
has text: wat api u r using and how
comment on: http://stackoverflow.com/q/20756883
type: Comment

http://stackoverflow.com/q/20707052
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20707145
has title: Stop a network receiver thread
answer count: 1
tagged with: android
has body: Assume I have an object of type NetThread (defined below), called nt. I have initialized and started it nt = new NetThread(port, rs); nt.setDaemon(true); nt.setPriority(Thread.MAX_PRIORITY); nt.start(); Now I want to be able to stop this thread at any point during its execution. I can do this by calling nt.interrupt(). However, I thought I would try to do something that made more sense to me: create a method within NetThread called StopListening(). While nt is running, I call nt.StopListening(). Nothing. The thread just keeps running. What did I miss? Why doesn't this work? public class NetThread extends Thread { int port; private static int PAYLOAD_MAX = 10000; private static int NET_SO_TIMEOUT = 0; private RunStats rs; private boolean stopflag = false; private StageCode stage; NetThread(int port_number, RunStats runstats) { rs = runstats; port = port_number; stage = StageCode.STAGE_WAIT; } public synchronized void stopListening() { Log.d(C.DTAG, "stopListening() was called..."); stopflag=true; } @Override public void run() { receiveData(); Log.d(C.DTAG, "Network thread is finished."); } public void receiveData() { // request permission to do network operations in manifest file...done Log.d(C.DTAG, "network thread has started."); // start the network side of things DatagramSocket sock = null; DatagramPacket pkt = null; try { byte[] data = new byte[PAYLOAD_MAX]; sock = new DatagramSocket(port); sock.setSoTimeout(NET_SO_TIMEOUT); pkt = new DatagramPacket(data, 0, PAYLOAD_MAX); while (!stopflag) { Thread.sleep(0); // allow for an interrupt try { sock.receive(pkt); int length = pkt.getLength(); processPayload(pkt.getData(), length); } catch (InterruptedIOException e) { // thrown when a timeout occurs Log.d(C.DTAG, "net: no packets yet"); } } Log.d(C.DTAG, "done receiving."); if (sock != null) sock.close(); } catch (InterruptedException x) { Log.d(C.DTAG, "net: was interrupted."); } catch (SocketException e) { Log.d(C.DTAG, "net: SocketException"); e.printStackTrace(); …
accepted answer: http://stackoverflow.com/a/20707145

http://stackoverflow.com/a/20712364
answers question: http://stackoverflow.com/q/20712322
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: What you're trying to accomplish, is to treat the fileoutput and the consoleoutput the same. This is possible, because System.out is a PrintStream, and you can create a PrintStream for a file like this new PrintStream(yourFile) or insert a BufferedOutputStream in between new PrintStream(new BufferedOutputStream(new FileOutputStream(yourFile))). Note that this is not needed, because PrintStream does buffer its output itself. I would create a variable (global or not), representing the current output. This might be a PrintStream, either System.out, or a PrintStream around a FileOutputStream, whatever you desire. You would then pass this stream to the write method or call the print methods on it directly. The advantage is that you can easily switch this without much code modification, you can redirect it wherever you wan't. It's no problem to redirect it to a file and System.out! You wouldn't get that pure flexibility with the way you're writing the method currently. You could (not saying you should), also redirect System.out directly, using System.setOut. This however is bad style, because it is quite uncommon and might confuse everyone else, if they have not seen the call to System.setOut.
accepted answer of: http://stackoverflow.com/q/20712322
score: 3

http://stackoverflow.com/q/20724591
tagged with: gregorian-calendar
type: UnansweredQuestion
tagged with: date
has answer: http://stackoverflow.com/a/20724762
linked to: http://stackoverflow.com/q/13084651
upvote count: 0
duplicate of: http://stackoverflow.com/q/13084651
has answer: http://stackoverflow.com/a/20724987
favorite count: 0
type: Question
answer count: 2
tagged with: android
has title: to get amount of months between dates date1 and date2
score: -1
tagged with: java
has comment: http://stackoverflow.com/comment/31048626
downvote count: 1
has body: I have two dates. Wants to get amount of months between dates DOD and DDO. Best if I do it in a for loop, increasing the date of every month. I need all the months, which are between date1 and date2. For example, when I have a date: d1 = 2013-07-28, d2 = 2013-09-02 I want to get 3 (to July, August and September). String przekazaneDataOd = "2013-10-26" ; String przekazaneDataDo = "2014-03-11" ; SimpleDateFormat dfIn = new SimpleDateFormat("yyyy-MM-dd"); Date d1 = null; Date d2 = null; try { d1=dfIn.parse(przekazaneDataOd); d2=dfIn.parse(przekazaneDataDo); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } GregorianCalendar DOD = new GregorianCalendar(); DOD.setTime(d1); GregorianCalendar DDO = new GregorianCalendar(); DDO.setTime(d2);

http://stackoverflow.com/a/20757475
type: Answer
score: 0
has body: Updated to changed question Probably not simplest solution, but works String url = "http://www.abc.com/ABC/ABC-Boots-in-Leather/Prod/product.aspx?iid=34487"; String u = "http:/" + url.replaceAll("(http://)|/.*/", "/"); Result: http://www.abc.com/product.aspx?iid=34487
upvote count: 1
answers question: http://stackoverflow.com/q/20757414
downvote count: 1

http://stackoverflow.com/q/20705848
linked to: http://stackoverflow.com/q/20614347
accepted answer: http://stackoverflow.com/a/33251363
has answer: http://stackoverflow.com/a/20716519
has answer: http://stackoverflow.com/a/20714938
answer count: 6
possible better answer: http://stackoverflow.com/a/34157626
tagged with: netbeans
has answer: http://stackoverflow.com/a/20710201
has answer: http://stackoverflow.com/a/34157626
tagged with: java
upvote count: 1
tagged with: swing
has title: jar file is not working in the dist (swing project by netbeans )
has answer: http://stackoverflow.com/a/20710091
tagged with: themes
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31013633
downvote count: 0
tagged with: jar
score: 1
has answer: http://stackoverflow.com/a/33251363
favorite count: 0
has body: I set a lookAndFeel synthetica theme for the project.After that it is not working(jar file in the dist). Again I removed it and tried.Then it worked. I did clean and build. Tried several themes. They all workedd in the project. But did not run in the dist. What should I do? Please help me..
has comment: http://stackoverflow.com/comment/37345801
type: Question

http://stackoverflow.com/a/20782671
downvote count: 0
type: Answer
upvote count: 2
has body: Now Oncreate1() is your own method it is not override by Activity you have to call Oncreate1()
answers question: http://stackoverflow.com/q/20782539
score: 2

http://stackoverflow.com/q/20808200
has title: Android - addView() doesn't work after removeAllViews()
tagged with: java
type: UnansweredQuestion
has body: I have a LinearLayout ll inside the other LinearLayout inside the ScrollView &lt;ScrollView android:layout_width="270px" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal" android:orientation="vertical" &gt; &lt;LinearLayout android:id="@+id/gifcreator_thumbs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical" /&gt; &lt;Button android:id="@+id/gifcreator_add" android:layout_width="250px" android:layout_height="125px" android:layout_margin="10px" android:textColor="#000000" android:text="Добавить кадр" /&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; In onCreate I'm running the update_frames() method: public void update_frames(String a) { Log.e("EmSy", "Updating Frame @ " + a); try { File f = new File(a); tag = ll.getChildCount(); View v = getLayoutInflater().inflate(R.layout.gifcreator_item, null); v.setTag(tag); v.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(View v) { delete_frame(Integer.parseInt(v.getTag().toString())); return true; } }); ImageView thumb = (ImageView)v.findViewById(R.id.gircreator_item_thumb); TextView desc = (TextView)v.findViewById(R.id.gifcreator_item_desc); Bitmap t = BitmapFactory.decodeFile(a); Bitmap t2 = Bitmap.createScaledBitmap(t, 110, 110, false); thumb.setImageBitmap(t2); desc.setText("Кадр №" + tag); data.add(new GIFFrame(t, 42, a)); ll.addView(v); } catch (Exception e) { Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } } Here's the delete_frame method: public void delete_frame(int tag_for_deleting) { try { ll.removeAllViews(); data.remove(tag_for_deleting); temp_data = data; data.clear(); for (GIFFrame gf : temp_data) { update_frames(gf.p); frames.notify(); } temp_data.clear(); } catch (Exception e) { Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); e.pri…
score: 2
has comment: http://stackoverflow.com/comment/94193030
has answer: http://stackoverflow.com/a/20808448
has answer: http://stackoverflow.com/a/53667992
downvote count: 0
favorite count: 0
type: Question
tagged with: android
upvote count: 2
answer count: 2

http://stackoverflow.com/q/20759652
type: Question
has answer: http://stackoverflow.com/a/20760278
has comment: http://stackoverflow.com/comment/31111872
has body: As I know, intern method is supposed to return the String from the String pool if the String is found in String pool, otherwise a new string object will be added in String pool and the reference of this String is returned. String s = "a"; s = "b"; String str = new String("a").intern(); What will happen in this scenario... Is there two case exists Till "a" is not garbage collected, and String str = new String("a").intern(); executes str will refer this "a" If "a" is Gc'ed then a new object will be created and str will refer a new "a"; Or "a" is never eligible for garbage collection?
has comment: http://stackoverflow.com/comment/31111660
has answer: http://stackoverflow.com/a/20759754
downvote count: 0
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/20759754
has comment: http://stackoverflow.com/comment/31111612
has answer: http://stackoverflow.com/a/20759796
tagged with: garbage-collection
answer count: 4
possible better answer: http://stackoverflow.com/a/20759791
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/20759791
upvote count: 3
linked to: http://stackoverflow.com/q/15324143
linked to: http://stackoverflow.com/q/1481178
tagged with: java
has title: Is String literal declared but not referenced anymore is eligible for G'ed?

http://stackoverflow.com/comment/31134038
type: QuestionComment
comment on: http://stackoverflow.com/q/20763619
has text: Update your post with a sample dialog you would generate every time...
score: 0
type: Comment

http://stackoverflow.com/q/20818737
has answer: http://stackoverflow.com/a/21115437
answer count: 5
has answer: http://stackoverflow.com/a/20838961
upvote count: 23
has answer: http://stackoverflow.com/a/33637535
has answer: http://stackoverflow.com/a/20818942
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: Have put the persistence.xml in the classpath of the project in eclipse because before the error was that the file was not found. Now gives this error: Caused by: javax.persistence.PersistenceException: Invalid persistence.xml. Error parsing XML [line : -1, column : -1] : cvc-elt.1: Can not find the declaration of element 'persistence' org.hibernate.ejb.HibernatePersistence <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/Automoveis" /> <property name="javax.persistence.jdbc.user" value="postgres" /> <property name="javax.persistence.jdbc.password" value="1234" /> <property name="javax.persistence.jdbc.driver" value="org.postgresql.jdbc.Driver" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.hbm2ddl.auto" value="create" />
has comment: http://stackoverflow.com/comment/31218268
score: 23
type: Question
accepted answer: http://stackoverflow.com/a/20838961
tagged with: jpa
downvote count: 0
tagged with: persistence
has answer: http://stackoverflow.com/a/76887261
has comment: http://stackoverflow.com/comment/31217845
has title: Can not find the declaration of element 'persistence'
favorite count: 0
possible better answer: http://stackoverflow.com/a/21115437

http://stackoverflow.com/comment/31072492
comment on: http://stackoverflow.com/q/20736366
score: 0
type: Comment
type: QuestionComment
has text: @sasanked i tried it but still the same error !

http://stackoverflow.com/comment/31096053
comment on: http://stackoverflow.com/q/20750749
score: 0
type: QuestionComment
type: Comment
has text: File.getCanonicalPath() will get absolute path to a file. However, this all depends on whatever you use to cross-compile your Java code and whether it uses the correct native method to get the file path.

http://stackoverflow.com/q/20801546
tagged with: exception
has title: Error pages not working as expected on jboss as 7.1.1
answer count: 1
has body: I have configured my web app to show some error pages based on the exception type, but the problem is that if I configure a generic error page for java.lang.Exception, every exception is redirected to this generic error page. My web.xml file: org.apache.shiro.authz.UnauthorizedException /acesso-nao-autorizado javax.faces.application.ViewExpiredException /login/ java.lang.Exception /erro As you can see, I have two specific exception types, than I have java.lang.Exception as a last resource. If I remove this last entry, then every exception redirects the user to the correct view. But with this last entry, it does not matter what type is the exception thrown, the user will always get redirected to /error. Any ideas?
tagged with: web.xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20802711
tagged with: java
tagged with: jboss
tagged with: servlets
type: Question
score: 0

http://stackoverflow.com/a/59507993
answers question: http://stackoverflow.com/q/20740703
has body: Clearing metadata helped me or change the workspace.
score: 0
type: Answer

http://stackoverflow.com/comment/31070020
has text: Thank you for your answer. See implementation in my answer below.
type: Comment
comment on: http://stackoverflow.com/a/20735579
type: AnswerComment
score: 0

http://stackoverflow.com/a/20821136
has comment: http://stackoverflow.com/comment/31222673
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31222437
has comment: http://stackoverflow.com/comment/31222407
has comment: http://stackoverflow.com/comment/31222532
has comment: http://stackoverflow.com/comment/31222596
type: Answer
has comment: http://stackoverflow.com/comment/31222547
has comment: http://stackoverflow.com/comment/31222467
downvote count: 0
score: 1
has body: You shouldn't have a constructor in an Activity. public SecondClass(){ setContentView(R.layout.activity_info); //HERE &lt;---- } Remove that and put it inside onCreate() like you have in your first Activity. And this isn't how you create a new instance of an Activity new SecondClass(); Create an instance of an Activity with an Intent. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //HERE &lt;----- Intent i = new Intent(MainActivity.this, SecondClass.class); startActivity(i); } } I'm not quite sure what you are doing but you typically wouldn't do this because it would start the second Activity as soon as the first is created.
accepted answer of: http://stackoverflow.com/q/20821109
answers question: http://stackoverflow.com/q/20821109
has comment: http://stackoverflow.com/comment/31222392

http://stackoverflow.com/q/20813030
has comment: http://stackoverflow.com/comment/31207248
type: Question
tagged with: jpa
tagged with: sql-server
score: 0
tagged with: jdbc
answer count: 1
has answer: http://stackoverflow.com/a/20813101
accepted answer: http://stackoverflow.com/a/20813101
has body: I don't know if this is really a bug ... it seems that something remains "open". I'm using EclipseLink 2.5 with com.microsoft.sqlserver.jdbc.SQLServerDriver. In the second call at the createEntityManagerFactory method a wrong password is ignored and everything works as well ... Do I have to reset or clean some kind of Connection or Session Object ? String userId = "sa"; String psw = "rightPassword"; Map&lt;String, Object&gt; paramsConnect = new HashMap&lt;String, Object&gt;(); paramsConnect.put("javax.persistence.jdbc.user", userId); paramsConnect.put("javax.persistence.jdbc.password", psw); EntityManagerFactory emf = Persistence.createEntityManagerFactory("PU", paramsConnect); EntityManager em = emf.createEntityManager(); Query q = em.createNativeQuery("SELECT * FROM Tab1"); List&lt;Object[]&gt; rows = q.getResultList(); System.err.println(rows.get(0)); em.clear(); em.close(); emf.close(); psw = "wrongPassword"; EntityManagerFactory emf1 = Persistence.createEntityManagerFactory("PU", paramsConnect); EntityManager em1 = emf1.createEntityManager(); Query q1 = em1.createNativeQuery("SELECT * FROM Tab2"); List&lt;Object[]&gt; rows1 = q1.getResultList(); System.err.println(rows1.get(0));
has title: JPA reuse some "previous" JDBC login credentials
type: AnsweredQuestion
tagged with: java
tagged with: authentication

http://stackoverflow.com/comment/31224186
comment on: http://stackoverflow.com/a/20822150
has text: Yes I am sure I have Installed java. The path for it is /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin. The problem I have is that when I am setting the paths the way you have recommended (I am using same commands) I am not able to change the paths.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31082373
type: Comment
has text: sure, it is almost the same
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/20743157

http://stackoverflow.com/q/20729317
has comment: http://stackoverflow.com/comment/31063545
has title: Java Printing on thermal printer cutts off content from either side
type: UnansweredQuestion
has body: I am trying to print content from a bean object to a thermal printer with the code above, it works perfectly on other printers but not on a thermal printer, Content is cutt-off from either side and only incomplete content placed in the middle of the paper roll is visible. I am using barbacue to generate a bar-code and draw the image to the graphic as well, Any help would be highly appreciated. package com.iwar.utility; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.print.Book; import java.awt.print.PageFormat; import java.awt.print.Paper; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JOptionPane; import net.sourceforge.barbecue.Barcode; import net.sourceforge.barbecue.BarcodeException; import net.sourceforge.barbecue.BarcodeFactory; import net.sourceforge.barbecue.BarcodeImageHandler; import net.sourceforge.barbecue.output.OutputException; import com.iware.connection.db.GetStuff; import com.iware.pos.beans.PrintableBean; public class PrinterManager { public static boolean PrintTicket(final PrintableBean printable, final String input){ try { // printable is a bean containing all the information to be printed. final Book book = new Book();//java.awt.print.Book // here i create a new printable object where draw all the content from the bean //object onto the graphic g Printable b= new Printable() { @Override public int print(Graphics g, PageFormat pf, int page) throws PrinterException { // TODO Auto-generated method stub // We have only one page, and 'page' // is zero-based if (page &gt; 0) { return NO_SUCH_PAGE; } // User (0,0) is typically outside the // imageable area, so we must translate // by the X and Y values in the PageFormat // to avoid clipping. // Paper paper = pf.getPaper(); Paper paper = new Pape…
tagged with: printing
type: Question
has comment: http://stackoverflow.com/comment/31057041
answer count: 0
score: 0
tagged with: java

http://stackoverflow.com/comment/31149365
score: 0
type: AnswerComment
has text: Neither do I, unfortunately. If this were Oracle you could pull it out of the metadata. I think you need someone who knows access better than I do.
type: Comment
comment on: http://stackoverflow.com/a/20780397

httpsurlconnection
type: Tag
tag name: httpsurlconnection
tags question: http://stackoverflow.com/q/20693039

http://stackoverflow.com/a/20742285
has comment: http://stackoverflow.com/comment/31080115
has comment: http://stackoverflow.com/comment/31080082
answers question: http://stackoverflow.com/q/20742148
type: Answer
has body: I'll advise you to use UTF8, but if you insist on ISO-8859-2, you'll have to change your DBURL to looks like: jdbc:mysql://localhost:3306/yourDatabase?useUnicode=falsee&amp;characterEncoding=ISO-8859-2
has comment: http://stackoverflow.com/comment/31080341
score: 0

http://stackoverflow.com/comment/30997470
comment on: http://stackoverflow.com/q/20696245
score: 0
has text: They will likely both be null....
type: Comment
type: QuestionComment

http://stackoverflow.com/q/20829718
has title: Issue with aapt.exe
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20737200
upvote count: 9
has answer: http://stackoverflow.com/a/23599122
tagged with: java
has comment: http://stackoverflow.com/comment/31241075
tagged with: eclipse
score: 9
tagged with: r.java-file
has answer: http://stackoverflow.com/a/20832561
has answer: http://stackoverflow.com/a/22561890
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/23740222
has comment: http://stackoverflow.com/comment/31248183
favorite count: 0
has comment: http://stackoverflow.com/comment/31238766
tagged with: android
possible better answer: http://stackoverflow.com/a/21070202
has answer: http://stackoverflow.com/a/21070202
has body: I'm using the latest version of the ADT Bundle downloaded on the android developers site. I'm on Windows 7. My R.java file is not compiling correctly due to the fact that I get the following crash message from Windows: Here is the problem details output: Problem signature: Problem Event Name: APPCRASH Application Name: aapt.exe Application Version: 0.0.0.0 Application Timestamp: 52684cb5 Fault Module Name: aapt.exe Fault Module Version: 0.0.0.0 Fault Module Timestamp: 52684cb5 Exception Code: c0000005 Exception Offset: 0003cf2a OS Version: 6.1.7601.2.1.0.256.1 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&amp;clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\system32\en-US\erofflps.txt Now because of this, my R.java file keeps disappearing and the following problems show up: Take note of the first problem on that list Now I've went through the following steps about 10 times: 1. Uncheck build automatically 2. Clean project, 3. Check build config 4. Rebuild project If your going to say to do any of this as a solution then don't post a solution because I'm not going to do something I've already done a billion times. I ported this project over from Android Studio from all its errors and, in my experience with Eclipse, I've never seen this aapt.exe error. What is aapt.exe and what's its purpose? Any help is greatly appreciated. Andrew
has answer: http://stackoverflow.com/a/20835289
has answer: http://stackoverflow.com/a/24572589
accepted answer: http://stackoverflow.com/a/20835289
has comment: http://stackoverflow.com/comment/31248333

http://stackoverflow.com/q/20836460
linked to: http://stackoverflow.com/q/5093563
type: Question
tagged with: spring-mvc
score: 3
has comment: http://stackoverflow.com/comment/31254586
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/20853461
tagged with: entities
has answer: http://stackoverflow.com/a/47954876
has answer: http://stackoverflow.com/a/20844980
has answer: http://stackoverflow.com/a/20836718
has answer: http://stackoverflow.com/a/20842321
has answer: http://stackoverflow.com/a/20853461
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31255385
answer count: 5
linked to: http://stackoverflow.com/q/2413577
possible better answer: http://stackoverflow.com/a/20836718
type: AnsweredQuestion
has title: multiple POJOs/entities for the singletable
upvote count: 3
has body: Does anyone know how I can create multiple POJOs/entities for the one table? Without getting the DuplicateEntitites error? The reason I need multiple pojos is that I want to hide some properties in some cases. Thank you for your time. Updated: How I implemented Hrishikesh's suggestion. @Entity(name="baseT1") @Table(name="T1") public class BaseT1{ } @Entity(name="T1") @Table(name="T1") public class T1 extends BaseT1{ } This gives me: Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate table mapping T1 error.
tagged with: spring

http://stackoverflow.com/a/20711344
answers question: http://stackoverflow.com/q/20711185
has body: I believe the issue you may be facing is that a Hash Table(set or map) has to be backed by a fixed number of entries it can hold. So your first declaration may have a table able to hold 16 entries. Putting aside things like load factors, once you tried to put 17 entries into the table, it has to grow to accommodate more entries to prevent collisions, so Java will expand it for you. This expansion includes creating a new table with 2 * previousSize entries, then copying over the old entries. So if you are constantly expanding, you may end up hitting an area, like 524,288 where it will have to grow, but it will create a new table able to handle 1,048,576 entries, but it will have to copy over the entire previous table. If you don't mind the extra look up time, you might think about using a TreeSet instead of a HashSet. You lookups will now be logarithmic time, but a Tree doesn't have a pre-allocated table and can grow dynamically easily. Either use this, or declare the size of your HashSet so it won't grow dynamically.
has comment: http://stackoverflow.com/comment/31024089
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31024046
type: Answer
accepted answer of: http://stackoverflow.com/q/20711185
score: 5
upvote count: 5

http://stackoverflow.com/comment/31088355
type: AnswerComment
comment on: http://stackoverflow.com/a/20729004
score: 0
type: Comment
has text: I hate Eclipse..errors aren't always displayed..i don't understand why professors constrain to use Eclipse as IDE :(

http://stackoverflow.com/q/20713121
tagged with: eclipse
has body: I have been trying to build a Jave Web Service using Eclipse (Eclipse Java EE IDE for Web Developers, Kepler Service Release 1). I wrote the code, and used Eclipse to generate a web service for it (which would also create the WSDL file for it). I notice that resultant web service seems to ignore all interface annotations (@WebMethod, @WebResult...etc.). Using wsgen, all the annotations seem to be respected. Is this by design or am I doing something wrong here? Below is the source code of the service, with the WSDL generated by Eclipse following: package org.itemKeyGenerator; import java.sql.SQLException; import java.util.NoSuchElementException; import javax.jws.WebMethod; import javax.jws.WebResult; import javax.jws.WebService; import org.itemKeyGenerator.beans.DocumentKey; import org.itemKeyGenerator.beans.ElementKey; import org.itemKeyGenerator.beans.GroupKey; @WebService (serviceName = "itemKeyGeneratorService", portName = "itemKeyGenerator") public class ItemKeyGeneratorService { private static DatabaseAdapter adapter = new DatabaseAdapter(); public ItemKeyGeneratorService() {} @WebMethod(operationName = "generate_document_key") @WebResult(name = "key") public DocumentKey generateDocumentKey() throws SQLException, NoSuchElementException { return adapter.generateAndGetDocumentKey(); } @WebMethod(operationName = "generate_group_key") public @WebResult(name = "key")GroupKey generateGroupKey( DocumentKey k) throws SQLException, NoSuchElementException { return adapter.generateAndGetInvoiceElementGroupKey(k); } @WebMethod(operationName = "generate_element_key") public @WebResult(name = "key")ElementKey generateElementKey( GroupKey k) throws SQLException, NoSuchElementException { return adapter.generateAndGetInvoiceElementDetailKey(k); } } Eclipse generated WSDL: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://itemKeyGenerator.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://itemKeyGenerator.org" xmlns:intf="htt…
has comment: http://stackoverflow.com/comment/31044013
has comment: http://stackoverflow.com/comment/31029717
tagged with: wsdl
downvote count: 0
has comment: http://stackoverflow.com/comment/31043954
has comment: http://stackoverflow.com/comment/31165861
score: 1
favorite count: 0
type: Question
has title: Java-WS Eclipse ignoring interface-customization annotations
has comment: http://stackoverflow.com/comment/31052179
tagged with: java
upvote count: 1
tagged with: web-services
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/20787718
has comment: http://stackoverflow.com/comment/31160958
tagged with: java
has answer: http://stackoverflow.com/a/20787772
type: Question
has body: I am writing an application in java to read the inbox of the input email address provided its credentials. So far with Javamail I can only connect to mail servers supporting IMAP and POP3. My queries are: Is any way to connect to mail servers which do not support IMAP and POP3? Can we connect and read exchange emails with Javamail API? I have found exjello for connecting to exchange mail servers but I am not able to connect to my corporate mail server.
score: 0
has title: Email Reader in Java
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/20755858
has comment: http://stackoverflow.com/comment/31105264
tagged with: java
has comment: http://stackoverflow.com/comment/31105292
type: UnansweredQuestion
tagged with: eclipse
has title: Getting thousand errors after importing code from an apk
has comment: http://stackoverflow.com/comment/31105351
has comment: http://stackoverflow.com/comment/31105304
has comment: http://stackoverflow.com/comment/31107432
linked to: http://stackoverflow.com/q/7888102
favorite count: 0
has body: Okay, so my programming teacher sent me an app that I should look at and modify. I downloaded the APK file, and turned it into a source code following these instructions: how to extract code of apk file. I have the java (src) files, the resources files, and the XML files. I have the Manifest file too. I imported them successfully on eclipse, but now it has like 2000 errors. I really don't know what to do. The apk works fine on my phone. Why is it doing this? If anyone needs the apk, I'll upload it. If someone can be so generous to convert it into a working eclipse workspace for me, I'll be more than grateful.
type: Question
has answer: http://stackoverflow.com/a/20755943
tagged with: android
has comment: http://stackoverflow.com/comment/31105300
score: -1
has answer: http://stackoverflow.com/a/22039998
has comment: http://stackoverflow.com/comment/31107404
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31107478
upvote count: 1

http://stackoverflow.com/q/20746071
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/20746134
type: Question
answer count: 3
downvote count: 0
has body: I'm new to Android development. I work on a system that doesn't have an internet connection. I have installed the new Android Developer studio which claims to be supporting offline development. I have updated the Gradle to 1.9 (by copying the downloaded zip file to the folder "C:\Documents and Settings\.gradle\wrapper\dists\gradle-1.9-all\3jdgemv0iv8uqohg3kcp2o88r1". It is clear that the developer studio did detect this and unpacked the gradle in that folder. After this I created a new HelloWorld project and tried to build it, I get the following error. Gradle: A problem occurred configuring project ':app'. &gt; Could not resolve all dependencies for configuration ':app:classpath'. &gt; Could not resolve com.android.tools.build:gradle:0.7.+. Required by: HellowWorld1:app:unspecified &gt; No cached version of com.android.tools.build:gradle:0.7.+ available for offline mode. Do you know what is causing this? How do I solve this? Is there any other file which I should update with the information w.r.t the manually installed Gradle version?
has title: Failed to build Android Hello World application in offline mode
favorite count: 0
has answer: http://stackoverflow.com/a/25701126
type: UnansweredQuestion
tagged with: android
score: 2
has answer: http://stackoverflow.com/a/25388968
tagged with: build
upvote count: 2

http://stackoverflow.com/q/20810957
has title: Missing Dependencies for jersey project
tagged with: java
type: Question
has body: I'm using maven. Newest versions of all jersey jars and I can not post to my service running on tomcat... has anyone faces this issue? Been at it for hours. SEVERE: Missing dependency for method public java.lang.String restService.status.SubmitName.post(java.io.InputStream) at parameter at index 0 SEVERE: Method, public java.lang.String restService.status.SubmitName.post(java.io.InputStream), annotated with POST of resource class restService.status.SubmitName, is not recognized as valid resource method. Here are my dependencies: org.jvnet mimepull 1.6 com.sun.jersey.contribs jersey-multipart 1.18 com.sun.jersey jersey-servlet 1.18 com.sun.jersey jersey-server 1.18
tagged with: jersey
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31203629
score: 0
has comment: http://stackoverflow.com/comment/31203319
has comment: http://stackoverflow.com/comment/31203400
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31203344
tagged with: maven
tagged with: web-services

http://stackoverflow.com/a/20831370
has comment: http://stackoverflow.com/comment/31242355
has comment: http://stackoverflow.com/comment/31242230
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31242204
has comment: http://stackoverflow.com/comment/31241819
upvote count: 2
has body: You would want to put your if-statement in a while-loop by using the hasNextLine() function, which will loop until theres no more lines left to iterate over: while(sc.hasNextLine()) { // Your code.. } For more info regarding the function check Scanner::hasNextLine documentation.
has comment: http://stackoverflow.com/comment/31242361
has comment: http://stackoverflow.com/comment/31242331
type: Answer
answers question: http://stackoverflow.com/q/20831324

http://stackoverflow.com/comment/31085843
comment on: http://stackoverflow.com/a/20741516
type: Comment
has text: Thanks for the reply. Where is this Jar? I only copied that code and ran it
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31094229
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20749614
has text: @AndrewThompson That so needs to be an answer
score: 0

http://stackoverflow.com/comment/31236805
has text: When building a large string, you should use StringBuilder.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/20828789
score: 0

http://stackoverflow.com/comment/31084895
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20744955
has text: Maybe already answered here? http://stackoverflow.com/questions/4045484/http-delete-with-rest
score: 0

http://stackoverflow.com/comment/31181690
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20798313
has text: Got it.I have to use a.id and a.code to get a new record..Thank for all your help

http://stackoverflow.com/comment/31201016
comment on: http://stackoverflow.com/q/20809749
has text: it's a programmer 'joke'
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31007425
has text: Well, it's the same thing. Just instantiate each one with the approximate value.
type: Comment
comment on: http://stackoverflow.com/a/20702229
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31184640
comment on: http://stackoverflow.com/a/20799179
type: Comment
has text: @Josef then do that from a different test class that's not run by spring
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31113866
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20761020
has text: I am just writing a String sql query to be executed by statement and fetching the ResultSet.

http://stackoverflow.com/q/20802499
has answer: http://stackoverflow.com/a/20802568
type: Question
score: -1
has title: Comparing text fields to database data one by one
tagged with: sql-server
has body: I have many text fields that serve as the locker number and I want to check one-by-one if they are equal to the retrieved data. How is that possible to check them one-by-one? try{ String get = "SELECT no from accounts"; rs = st.executeQuery(get); while(rs.next()){ num = rs.getString("no"); //System.out.println(num + " "); } if(s2149.getText().equals(num)){ s2149.setBackground(Color.red); } if(!s2149.getText().equals(num)){ s2149.setBackground(Color.green); } }catch(Exception ex){ System.out.println(ex.getMessage());}; }
has comment: http://stackoverflow.com/comment/31187940
tagged with: sql
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31187503
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31187922
has comment: http://stackoverflow.com/comment/31187858
upvote count: 0
has comment: http://stackoverflow.com/comment/31187793
has comment: http://stackoverflow.com/comment/31187885
has comment: http://stackoverflow.com/comment/31187566
tagged with: java

http://stackoverflow.com/q/20685378
has answer: http://stackoverflow.com/a/20685629
answer count: 4
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/20685634
has answer: http://stackoverflow.com/a/20685472
downvote count: 1
type: Question
tagged with: navigation-drawer
upvote count: 0
score: -1
has body: I am trying to develop a simple app with navigation drawer. I do all my best and view so many articles but I failed There is no error in my code but when I run my app in emulator it shows run time error... plzz help me here is my logcat file 12-19 15:07:20.562: E/AndroidRuntime(1067): FATAL EXCEPTION: main 12-19 15:07:20.562: E/AndroidRuntime(1067): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dhruv.sms/com.dhruv.sms.MainActivity}: java.lang.NullPointerException 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.os.Handler.dispatchMessage(Handler.java:99) 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.os.Looper.loop(Looper.java:137) 12-19 15:07:20.562: E/AndroidRuntime(1067): at android.app.ActivityThread.main(ActivityThread.java:5039) 12-19 15:07:20.562: E/AndroidRuntime(1067): at java.lang.reflect.Method.invokeNative(Native Method) 12-19 15:07:20.562: E/AndroidRuntime(1067): at java.lang.reflect.Method.invoke(Method.java:511) 12-19 15:07:20.562: E/AndroidRuntime(1067): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-19 15:07:20.562: E/AndroidRuntime(1067): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:560) 12-19 15:07:20.562: E/AndroidRuntime(1067): at dalvik.system.NativeStart.main(Native Method) 12-19 15:07:20.562: E/AndroidRuntime(1067): Caused by: java.lang.NullPointerException 12-19 15:07:20.562: E/AndroidRuntime(1067): at com.dhruv.sms.MainActivity.onCreate(MainActivity.java:80) 12-19 15:07:20.562: E/AndroidRu…
has answer: http://stackoverflow.com/a/20685477
favorite count: 0
has title: Getting error in my android app
type: UnansweredQuestion
tagged with: android

foreign-collection
tags question: http://stackoverflow.com/q/20802976
type: Tag
tag name: foreign-collection

http://stackoverflow.com/q/20710062
tagged with: java
has body: There are many threads with similar issues and recommendations to fix. I've tried all and none works for my case except putting the service in foreground, which I do not want to do so far. I cannot post a comment to existing threads as I don't have enough reputations and I want to question, so can't answer. This is the only choice to bring my question and look for some expert's opinions and recommendations. Existing threads with similar issues discussed, Time taken for Android Service to restart after being forcibly killed Background Service getting killed in android Android: Scheduling restart of crashed service with HUGE delay? MY PROBLEM: I've a service that starts at boot time (listening to intent BOOT_COMPLETED) I start a thread that does interaction with other service through a socket and is interrupted when the service is killed (onDestroy). Using Wifi on phone, my service is never killed by android and it works as expected. If I switch to 3G only (At&amp;T SIM), My service gets killed approx. after 1800 seconds (30 minutes) and scheduled to be restarted in approx. 3600 sec (1 hour). All this time the thread that service started is doing SQLLite calls and interacting with this other service. Android thinks my service has been idle for 1800+ seconds and will kill its with long restart time. Questions: What do I need to do to tell Android ActivityManager that my service is doing work using a thread it spun, so it should not be killed. Happens only on 3G. How to reduce the timer to under 20 seconds. 1 hour is just too long. I did used AsyncTask to spin other thread that loops for ever sleeping 1 second, but still my service gets killed. How Android behavior changes when using 3G versus Wifi in determining which service to kill?
type: Question
linked to: http://stackoverflow.com/q/8044444
downvote count: 0
has answer: http://stackoverflow.com/a/21145740
tagged with: sqlite
answer count: 1
tagged with: service
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
linked to: http://stackoverflow.com/q/12219249
has title: My background service gets killed and restarted with long wait despite being busy
linked to: http://stackoverflow.com/q/10534965
score: 2

http://stackoverflow.com/q/20824384
tagged with: javascript
favorite count: 0
accepted answer: http://stackoverflow.com/a/20824795
score: 2
upvote count: 2
type: Question
type: AnsweredQuestion
has title: Passing javascript variable to custom Primefaces component
tagged with: primefaces
has body: I'm trying to retrieve the content of a javascript variable (array) in the JS widget code of a Primefaces custom component... I know I'm missing steps in the component and its renderer java code! As a matter of fact, I want to add a completion feature (among others) on the Primefaces Terminal based on a list of commands stored in a javascript array and which I'd like to be provided in an attribute of the extended terminal component eg: &lt;my:terminal completion="commandsList" /&gt; having: var commandsList = ["foo", "bar"]; Here's the code so far: MyTerminal.java @ResourceDependencies({ @ResourceDependency(library="primefaces", name="terminal/terminal.css"), @ResourceDependency(library="primefaces", name="primefaces.css"), @ResourceDependency(library="primefaces", name="jquery/jquery.js"), @ResourceDependency(library="primefaces", name="jquery/jquery-plugins.js"), @ResourceDependency(library="primefaces", name="primefaces.js"), @ResourceDependency(library="primefaces", name="terminal/terminal.js"), @ResourceDependency(library="js", name="terminal.js") }) @FacesComponent(MyTerminal.COMPONENT_TYPE) public class MyTerminal extends Terminal { public static final String COMPONENT_FAMILY = "com.jsf.components"; public static final String COMPONENT_TYPE = "com.jsf.components.MyTerminal"; @Override public String getFamily() { return COMPONENT_FAMILY; } @Override public String getRendererType() { return MyTerminalRenderer.RENDERER_TYPE; } private enum PropertyKeys { completion } public String getCompletion() { return (String) getStateHelper().eval(PropertyKeys.completion, null); } public void setCompletion(String completion) { getStateHelper().put(PropertyKeys.completion, completion); } } MyTerminalRenderer.java @FacesRenderer( componentFamily = MyTerminal.COMPONENT_FAMILY, rendererType = MyTerminalRenderer.RENDERER_TYPE ) public class MyTerminalRenderer extends TerminalRenderer { public static final String RENDERER_TYPE = "com.jsf.components.MyTerminalRenderer"; protected …
tagged with: java
tagged with: jsf-2
has answer: http://stackoverflow.com/a/20824795
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31078749
score: 0
type: AnswerComment
has text: Be sure you are clear about "value (contents) is [sic] copied". Objects live on the heap; you pass a reference that tells you where to go to find the object. The reference value is passed, not an object.
type: Comment
comment on: http://stackoverflow.com/a/20736055

http://stackoverflow.com/comment/31238333
comment on: http://stackoverflow.com/a/20829088
score: 0
type: AnswerComment
type: Comment
has text: @nachokk sure i will :)

http://stackoverflow.com/a/20806871
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/20806803
has body: You can't. However, you can change the way it's displayed, use String#format: String res = String.format("%02d", s);
downvote count: 0
type: Answer

facebook
tags question: http://stackoverflow.com/q/20732282
type: Tag
tags question: http://stackoverflow.com/q/20728207
tags question: http://stackoverflow.com/q/20692174
tags question: http://stackoverflow.com/q/20697440
tags question: http://stackoverflow.com/q/20720417
tags question: http://stackoverflow.com/q/20682264
tag name: facebook
tags question: http://stackoverflow.com/q/20849202
tags question: http://stackoverflow.com/q/20838371
tags question: http://stackoverflow.com/q/20719849
tags question: http://stackoverflow.com/q/20825747
tags question: http://stackoverflow.com/q/20707383
tags question: http://stackoverflow.com/q/20746007
tags question: http://stackoverflow.com/q/20701542

http://stackoverflow.com/a/38164966
answers question: http://stackoverflow.com/q/20734540
has body: I update my Hibernate JPA to 2.1 and It works. org.hibernate.javax.persistence hibernate-jpa-2.1-api 1.0.0.Final
downvote count: 0
type: Answer
upvote count: 16
score: 16

http://stackoverflow.com/comment/31115643
comment on: http://stackoverflow.com/a/20761728
has text: @ Chris the solution you gave works perfect for this scenario but what would happen when the expression to be calculated changes?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/20720911
has answer: http://stackoverflow.com/a/20723068
answer count: 2
has body: I have upgraded my Phonegap running on Windows 7 to the currently latest version to 3.3.0. I could create a project without any issue but when I try to add a platform say "android" an error occurs. Shown below is the error I get when I run "cordova platform add android" command on command promt on Windows 7. Please help. E:\Dropbox\Development\Android\weatherlk&gt;cordova platform add android Creating android project... C:\Users\Teshan\AppData\Roaming\npm\node_modules\cordova\node_modules\q\ throw e; ^ Error: An error occured during creation of android sub-project. C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q. throw e; ^ Error: An error occurred while listing Android targets at C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\lib\check_ at _rejected (C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin at C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\node_modul at Promise.when (C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\ at Promise.promise.promiseDispatch (C:\Users\Teshan\.cordova\lib\and 752:41) at C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\node_modul at flush (C:\Users\Teshan\.cordova\lib\android\cordova\3.3.0\bin\nod at process._tickCallback (node.js:415:13) at C:\Users\Teshan\AppData\Roaming\npm\node_modules\cordova\src\plat at ChildProcess.exithandler (child_process.js:641:7) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:735:16) at Process.ChildProcess._handle.onexit (child_process.js:802:5)
downvote count: 0
favorite count: 0
tagged with: android
tagged with: windows
has answer: http://stackoverflow.com/a/25275372
score: 2
tagged with: cordova
upvote count: 2
type: UnansweredQuestion
has title: Phonegap 3.3 cannot add platform
type: Question
tagged with: java

import
type: Tag
tags question: http://stackoverflow.com/q/20777260
tags question: http://stackoverflow.com/q/20840724
tags question: http://stackoverflow.com/q/20833606
tags question: http://stackoverflow.com/q/20729543
tags question: http://stackoverflow.com/q/20841843
tags question: http://stackoverflow.com/q/20843799
tag name: import
tags question: http://stackoverflow.com/q/20751836
tags question: http://stackoverflow.com/q/20753792
tags question: http://stackoverflow.com/q/20828786
tags question: http://stackoverflow.com/q/20846641
tags question: http://stackoverflow.com/q/20843431

http://stackoverflow.com/comment/31111926
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20759529
has text: Java and C++ are different languages. Imagine you tried speaking Portuguese by doing a word-by-word literal translation from your native Bulgarian; the result wouldn't be pretty, no matter how pretty some native Portuguese speakers are.

http://stackoverflow.com/comment/31008301
type: QuestionComment
comment on: http://stackoverflow.com/q/20702656
score: 2
has text: you can refer this - https://github.com/Joisar/LockScreenApp
type: Comment

http://stackoverflow.com/a/20755383
type: Answer
answers question: http://stackoverflow.com/q/20755184
upvote count: 1
downvote count: 0
score: 1
has body: I believe you can use aspectj for this.. a quick google search gave me this link.. http://java.jiderhamn.se/2013/08/23/debugging-third-party-libraries-with-aspectj-and-maven/ see if this helps..

http://stackoverflow.com/comment/31017538
type: Comment
comment on: http://stackoverflow.com/a/20705563
has text: **Please don't teach string concatenation like this**. They might continue to use it. Use `StringBuilder`.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31098798
type: Comment
score: 4
comment on: http://stackoverflow.com/a/20752249
type: AnswerComment
has text: If the problem was caused by the slowness of the Java serialization, it would also be slow on localhost.

http://stackoverflow.com/q/20717330
score: 0
has title: How to query StockTracker java database
has comment: http://stackoverflow.com/comment/31037467
has comment: http://stackoverflow.com/comment/31057458
has comment: http://stackoverflow.com/comment/31059505
answer count: 0
has comment: http://stackoverflow.com/comment/31035699
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: database
has body: I have been trying to figure out how to query a java database but all I seem to run into are sql articles. As you can probably see from my history I am very new to Java and probably not very good at it. I need to list the user’s ID, first name, and last name followed by their stocks, including both the stock symbol and stock description ( name). This needs to be done for all users. import javax.swing.*; import java.awt.*; import java.awt.event.*; import static java.awt.BorderLayout.*; // updated for v5.0 import java.util.*; import java.io.*; import java.sql.*; import javax.swing.border.TitledBorder; import static javax.swing.JOptionPane.*; // updated for v5.0 class StockTracker extends JFrame implements ActionListener, WindowListener, Activator, STAction { String stockSymbol; StockTrackerDB db; User user = null; JTextField jtfStockSymbol; JButton jbtAddStock,jbtDelStock,jbtLogout; JButton jbtAddUser,jbtDelUser,jbtUpdUser,jbtListUsers; JComboBox jcbStockList; Activator caller; public StockTracker(User currentUser, Activator callerObj,StockTrackerDB dbc) throws ClassNotFoundException,SQLException { super("Stock Tracker"); // call super (JFrame) constructor int width = 0; //330; int height = 0; //370; user = currentUser; caller = callerObj; // save reference to caller object db = dbc; // save reference to database (access class) // Define components for panel 1 JLabel label1 = new JLabel("User: "+user.getFirstName()+" "+user.getLastName()); jbtLogout = new JButton("Log out"); JPanel p1= new JPanel(); p1.setLayout(new BorderLayout()); p1.add(label1, WEST); // updated for v5.0 p1.add(jbtLogout, EAST); // updated for v5.0 jbtAddStock = new JButton("Add Stock"); jbtDelStock = new JButton("Delete Stock"); jtfStockSymbol = new JTextField(4); jcbStockList = new JComboBox(); buildStockList(); JPanel p2= new JPanel(); p2.setLayout(new GridLayout(3,2,5,5)); // rows, cols, hgap, vgap p2.add(jbtAddStock); p2.add(jtfStockSymbol); p2.add(jbtDelStock); p2.add(jcbStockList); p2.setBor…

user-interface
tags question: http://stackoverflow.com/q/20767518
tags question: http://stackoverflow.com/q/20733608
tags question: http://stackoverflow.com/q/20846227
tags question: http://stackoverflow.com/q/20737099
tags question: http://stackoverflow.com/q/20740204
tags question: http://stackoverflow.com/q/20811180
type: Tag
tags question: http://stackoverflow.com/q/20754723
tags question: http://stackoverflow.com/q/20775817
tags question: http://stackoverflow.com/q/20818425
tags question: http://stackoverflow.com/q/20701285
tags question: http://stackoverflow.com/q/20698608
tags question: http://stackoverflow.com/q/20770686
tags question: http://stackoverflow.com/q/20830590
tags question: http://stackoverflow.com/q/20807546
tags question: http://stackoverflow.com/q/20707760
tags question: http://stackoverflow.com/q/20759270
tags question: http://stackoverflow.com/q/20845153
tags question: http://stackoverflow.com/q/20750118
tags question: http://stackoverflow.com/q/20752717
tags question: http://stackoverflow.com/q/20816044
tags question: http://stackoverflow.com/q/20709018
tags question: http://stackoverflow.com/q/20820554
tags question: http://stackoverflow.com/q/20829733
tags question: http://stackoverflow.com/q/20717313
tags question: http://stackoverflow.com/q/20848316
tags question: http://stackoverflow.com/q/20741712
tags question: http://stackoverflow.com/q/20841972
tags question: http://stackoverflow.com/q/20734507
tags question: http://stackoverflow.com/q/20845197
tags question: http://stackoverflow.com/q/20716454
tags question: http://stackoverflow.com/q/20811873
tags question: http://stackoverflow.com/q/20808652
tag name: user-interface
tags question: http://stackoverflow.com/q/20796819
tags question: http://stackoverflow.com/q/20702467
tags question: http://stackoverflow.com/q/20734119
tags question: http://stackoverflow.com/q/20738887

http://stackoverflow.com/comment/31130334
score: 1
has text: possible duplicate of [how to remove special characters from an string?](http://stackoverflow.com/questions/7552253/how-to-remove-special-characters-from-an-string)
comment on: http://stackoverflow.com/q/20769908
type: QuestionComment
type: Comment

http://stackoverflow.com/q/20707017
has answer: http://stackoverflow.com/a/71093659
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/63775574
possible better answer: http://stackoverflow.com/a/36405093
has answer: http://stackoverflow.com/a/36405093
has body: Currently I have the following build.gradle file: apply plugin: 'java' sourceSets { main { java { srcDir 'src/model' } } } dependencies { compile files('libs/mnist-tools.jar', 'libs/gson-2.2.4.jar') runtime fileTree(dir: 'libs', include: '*.jar') } This build.gradle file is for my repository here. All of my main files are in src/model/ and their respective tests are in test/model. How do I add a JUnit 4 dependency correctly and then run those tests in the folders of tests/model?
answer count: 6
score: 140
has answer: http://stackoverflow.com/a/64121203
tagged with: build.gradle
favorite count: 0
has title: How to run JUnit tests with Gradle?
type: AnsweredQuestion
tagged with: junit4
downvote count: 0
has answer: http://stackoverflow.com/a/20707188
tagged with: java
accepted answer: http://stackoverflow.com/a/20707188
has answer: http://stackoverflow.com/a/49200169
upvote count: 140

http://stackoverflow.com/comment/31191876
type: QuestionComment
has text: If you want to do it efficently, you should use a HashSet to store the ids that are currently in the array. When you add a new student, just make sure his id is not in the set. Set look up O(1) so it is really faster than looping through the array especially if the array is large!
comment on: http://stackoverflow.com/q/20804698
score: 0
type: Comment

http://stackoverflow.com/a/20730203
has body: WifiLock wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock"); System services are not available at object instantiation time. Postpone initializing your wifiLock to onCreate() or later.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/20730196
answers question: http://stackoverflow.com/q/20730196
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31058672
has comment: http://stackoverflow.com/comment/31058648

http://stackoverflow.com/comment/31168313
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/20791599
has text: Could you check if these variables are in `System.getenv()` map when you print it? + Is it `export`ed in the .profile?

http://stackoverflow.com/q/20792161
tagged with: increment
has title: Having difficulty incrementing
has comment: http://stackoverflow.com/comment/31169399
type: Question
has answer: http://stackoverflow.com/a/20792272
has comment: http://stackoverflow.com/comment/31169350
answer count: 1
has comment: http://stackoverflow.com/comment/31169432
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/20792272
tagged with: for-loop
tagged with: game-engine
has body: I'm having some difficulty incrementing my counter called right. Instead of incrementing it constantly prints out 1 and doesn't add the numbers together. I tried using another variable to total up the counter but no luck. Any ideas to why it is not incrementing? Code: tf.addActionListener(new ActionListener() { int wrong = 0; int right = 0; @Override public void actionPerformed(ActionEvent e) {// enter key JTextField tf = (JTextField) e.getSource(); letter = tf.getText(); tf.setText(""); // tf.requestFocus(); jlLetsUsed.setText(jlLetsUsed.getText() + letter + " ");// sets char[] jlabelText = jlLines.getText().toCharArray();// converts char userEnteredChar = letter.charAt(0); System.out.println(wordList[level]); if (!wordList[level].contains(letter)) { wrong++; if (wrong == 6) { JOptionPane.showMessageDialog(frame, "He's dead, game over." + "\n" + "The word was " + wordList[level] + ".", "You Lost", JOptionPane.INFORMATION_MESSAGE, ic); GameStructure restart = new GameStructure(); level = (int) (Math.random() * 64);// generate new // random word restart.window(); } return; } int i = 0; for (i = 0; i &lt; wordList[level].length(); i++) { if (wordList[level].charAt(i) == userEnteredChar) { jlabelText[3 * i] = ' '; jlabelText[3 * i + 1] = userEnteredChar; right++; }// end if }// end for jlLines.setText(String.valueOf(jlabelText)); if (jlabelText.length / 3 == right) { JOptionPane.showMessageDialog(frame, "You got the word!.", "You Lost", JOptionPane.INFORMATION_MESSAGE, ic); GameStructure restart = new GameStructure(); level = (int) (Math.random() * 64);// generate new // random word restart.window(); } }// end actionPerformed method });
has comment: http://stackoverflow.com/comment/31169326
type: AnsweredQuestion

http://stackoverflow.com/comment/31041585
type: QuestionComment
score: 0
has text: Is that the actual POSTMAN post request? The following `"name": chassis` is not well formed.
comment on: http://stackoverflow.com/q/20720955
type: Comment

http://stackoverflow.com/a/20680217
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/20680145
type: Answer
has body: You can do this. sort each word and add it to a MultiMap of sorted word to actual word. look up each word to use as an anagram by sorting the word first. The index cost is once and O(N) where N is the number of words. After that the cost of sorting is O(M log M) to sort the letters where M is the number of letters. This is very cheap compared to the cost of calculating permutations. BTW This approach, the words are only scanned once, in advance.
score: 4

http://stackoverflow.com/q/20692007
has comment: http://stackoverflow.com/comment/30989930
type: AnsweredQuestion
has body: I want to write a method for selecting a specific year (say 2009) from the Time array. This would refer (8001) which is basically a key for year 2009. In the FactTable I would like to add all the figures which represent quantity (the 1s). So it would show sales total for year 2009. Anyone have a clue how i can do this. The Time array stores {timekey, year, month, week, day} The FactTable stores {clientid, Vehicleid, branchid, timekey, quantity, profit} int[][] Time = new int[][] {{8001,2009,1,1,1}, {8002,2010,1,1,7}, {8003,2011,1,1,5}, {8004,2012,1,1,5}}; int[][] FactTable = new int [][] {{1,125,20,8001,1,2000}, {2,126,40,8001,1,1500}, {3,127,50,8001,1,2500}, {4,128,10,8001,1,2500}}; int sum = 0; int year = 8001; for (int i = 0; i&lt; FactTable.length-1; i++) { for (int j = 1; j &lt; FactTable[i].length-1; j++) { year = year + FactTable + [0][4]; } } System.out.println (year);
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20692610
tagged with: arrays
has answer: http://stackoverflow.com/a/20692330
possible better answer: http://stackoverflow.com/a/20692275
has title: How to write a method for multidimensional array
has answer: http://stackoverflow.com/a/20692257
has answer: http://stackoverflow.com/a/20692275
score: 0
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/30990363
has answer: http://stackoverflow.com/a/20692434
has comment: http://stackoverflow.com/comment/30989851
accepted answer: http://stackoverflow.com/a/20692610
answer count: 5
has comment: http://stackoverflow.com/comment/30989926

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/20739513
tags question: http://stackoverflow.com/q/20711837
type: Tag
tags question: http://stackoverflow.com/q/20712738
tags question: http://stackoverflow.com/q/20835808
tags question: http://stackoverflow.com/q/20811912
tags question: http://stackoverflow.com/q/20796042
tags question: http://stackoverflow.com/q/20816217
tags question: http://stackoverflow.com/q/20758597

nlp
tags question: http://stackoverflow.com/q/20768607
tags question: http://stackoverflow.com/q/20765738
tags question: http://stackoverflow.com/q/20824720
tags question: http://stackoverflow.com/q/20813541
tags question: http://stackoverflow.com/q/20710999
tag name: nlp
type: Tag
tags question: http://stackoverflow.com/q/20741392
tags question: http://stackoverflow.com/q/20844217
tags question: http://stackoverflow.com/q/20747529

http://stackoverflow.com/q/20725717
has comment: http://stackoverflow.com/comment/31050876
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has body: I am very new to java and i'm trying to make a basic calculator. There is another question on this but I changed the things that fixed it for him but it still doesn't work. Here's my code: import java.util.Scanner; class HelloWorld{ public static void main(String args[]) int num1; int num2; String op; Scanner input = new Scanner(System.in); System.out.println("Enter your first number"); num1 = input.nextInt(); System.out.println("Enter your second number"); num2 = input.nextInt(); System.out.println("Enter the operation"); op = input.nextLine(); if (op.equals("*")){ System.out.println("The answer is: " + (num2 * num1)); } if (op.equals("/")){ System.out.println("The answer is: " + (num2 / num1)); } if (op.equals("+")){ System.out.println("The answer is: " + (num2 + num1)); } if (op.equals("-")){ System.out.println("The answer is: " + (num2 - num1)); } } } The error says: Enter your first number Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextInt(Scanner.java:2160) at java.util.Scanner.nextInt(Scanner.java:2119) at HelloWorld.main(HelloWorld.java:12) I can't seem to find whats wrong (I have its something simple that i missed)
linked to: http://stackoverflow.com/q/7056749
has answer: http://stackoverflow.com/a/20725918
has answer: http://stackoverflow.com/a/20725804
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31056822
has comment: http://stackoverflow.com/comment/31051091
has comment: http://stackoverflow.com/comment/31050889
type: Question
has answer: http://stackoverflow.com/a/20725732
has comment: http://stackoverflow.com/comment/31050837
has comment: http://stackoverflow.com/comment/31050956
has answer: http://stackoverflow.com/a/20725869
tagged with: calculator
favorite count: 0
has comment: http://stackoverflow.com/comment/31050861
has title: Java simple calculator Error
linked to: http://stackoverflow.com/q/13729294
answer count: 4
has comment: http://stackoverflow.com/comment/31050854

http://stackoverflow.com/comment/31266619
comment on: http://stackoverflow.com/q/20845044
has text: your problem seems to be in the DroppedTiles.java, line 29. Can you post the code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31136803
comment on: http://stackoverflow.com/q/20773855
type: QuestionComment
type: Comment
score: 2
has text: Consider posting this to http://codereview.stackexchange.com/

http://stackoverflow.com/a/20816143
has comment: http://stackoverflow.com/comment/31219723
score: 6
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/20815987
upvote count: 6
has comment: http://stackoverflow.com/comment/31291411
has body: Try with options.getItem(i).getStyle().setColor("#FF0000"); ListBox listBox = new ListBox(); //Add item to listBox. SelectElement selectElement = SelectElement.as(listBox.getElement()); NodeList&lt;OptionElement&gt; options = selectElement.getOptions(); for (int i = 0; i &lt; options.getLength(); i++) { options.getItem(i).getStyle().setColor("#FF0000"); }

http://stackoverflow.com/q/20792993
favorite count: 0
has answer: http://stackoverflow.com/a/20793358
type: UnansweredQuestion
score: 8
downvote count: 0
has answer: http://stackoverflow.com/a/20793029
tagged with: mysql
upvote count: 8
type: Question
has body: Let's say I have this kind of Java object: String brand = "Toyota"; String model = "Corolla"; int year = "2013"; CarBean car = new CarBean(brand, model, year); How to store easily this object to MySQL? I've done JDBC succefully and tables are working, but there is always something that gives me grey hairs. What would be easy (but at least semi professional) way to store/retrieve data back and forth with NetBeans and MySQL?
has title: Easy way to store Java objects to MySQL?
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/31170778
has answer: http://stackoverflow.com/a/20793052
answer count: 3

http://stackoverflow.com/a/23546851
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36162226
has comment: http://stackoverflow.com/comment/36178238
downvote count: 0
has comment: http://stackoverflow.com/comment/36131636
has comment: http://stackoverflow.com/comment/36153265
has body: When using your own rulset.xml file as described by kuporific, like: pmd { ruleSetFiles = files('path/to/ruleSet.xml') } gradle 1.10 uses some kind of default rules. Yes it does complain if the filepath is wrong, yes it complains if the contents are invalid. But during the checks some default ruleset will be applied. So I'm kind of suprised this worked for you. Also see: http://forums.gradle.org/gradle/topics/with_gradle_1_5_pmd_applying_basic_rules_even_when_they_are_not_included_in_our_rule_set_files Workaround is not to use ruleSetfiles, but reference them one by one: ruleSets = [ "$projectRoot/buildtools/pmd-rules/strings.xml"]
answers question: http://stackoverflow.com/q/20710704
type: Answer

http://stackoverflow.com/a/20844404
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/31265546
upvote count: 6
has comment: http://stackoverflow.com/comment/31265650
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20844376
answers question: http://stackoverflow.com/q/20844376
downvote count: 0
has body: You can convert the image bytes to base64, and save the bytes as a string. You would decode the base64 when reading the file back out. Though bitmaps can be large. I would try to save the file somewhere else and only save the path in XML.

http://stackoverflow.com/a/20803721
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/20803664
has body: look here: Extracting a process&#39;s exit code in the case of ThreadInterrupted You need to get the return code... you must wait for it.
downvote count: 0
type: Answer

http://stackoverflow.com/q/20792181
has comment: http://stackoverflow.com/comment/31169847
has comment: http://stackoverflow.com/comment/31169750
score: 0
has comment: http://stackoverflow.com/comment/31169678
has body: I have an (java) application that runs database purge queries on startup. Depending on the user, these queries could wind up removing hundreds of thousands of records. I've broken up the queries so that they're limited to 5000 records, with some breathing room between each query running. The table uses InnoDB. An example query: DELETE FROM table WHERE epoch &lt;= '1388094517' LIMIT 5000; However, certain users are seeing various errors with lock problems: java.sql.SQLException: The total number of locks exceeds the lock table size java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction Advising mysql config changes are pretty much not possible because this is a distributed application. What steps can I take to make sure the delete queries are not causing locking errors? The application begins logging data on startup and needs to be able to write to the database while the current delete query is running.
has comment: http://stackoverflow.com/comment/31169864
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20725170
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31171318
tagged with: mysql
has title: Avoiding lock errors on new writes while deleting records on InnoDB table
type: Question

http://stackoverflow.com/a/20752825
has comment: http://stackoverflow.com/comment/31100094
has comment: http://stackoverflow.com/comment/31099784
has body: Adding &lt;M extends Number&gt; to the first example doesn't add anything the compiler cares about. Remember you are saying "a type which is a supertype of M" if we are saying "M is a subtype of Number" and "the type is a supertype of M", we aren't actually saying if the type is a subtype of Number. For a better example, have M be Integer and the variable be of type A&lt;Object&gt;. While obviously that won't work, it satisfies all the requirements of the function correctly. Since there exists no way to fix the function definition, it just lets it pass and assumes the call site will catch the problem.
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20752781

http://stackoverflow.com/a/20688717
has body: If you need a total that is dynamically kept up to date then you will need to either override your TableModel to provide the sum for the final row, or will need to listener for changes to the model and update the last row with the sum. Customizing your own TableModel would also allow you the ability to make your summary row uneditable so while this might be more work, it provides much more flexibility.
score: 0
answers question: http://stackoverflow.com/q/20687139
type: Answer

http://stackoverflow.com/a/20779184
has body: this keyword can be used to refer current class instance variable. this() can be used to invoke current class constructor. this keyword can be used to invoke current class method (implicitly) this can be passed as an argument in the method call. this can be passed as argument in the constructor call. this keyword can also be used to return the current class instance. find examples from this: http://javarevisited.blogspot.in/2012/01/this-keyword-java-example-tutorial.html
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/20779151

http://stackoverflow.com/comment/31227686
has text: *" I have no way of knowing if its right"* Yes you do. Learn how HTML works. It is a prerequisite to making this work.
score: 0
comment on: http://stackoverflow.com/q/20823759
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31105074
type: QuestionComment
comment on: http://stackoverflow.com/q/20755695
type: Comment
has text: Sounds like Shanghai is full of random timezone changes :-)
score: 0

adaptive-design
type: Tag
tags question: http://stackoverflow.com/q/20764682
tag name: adaptive-design

http://stackoverflow.com/a/20706916
upvote count: 1
has body: With generics, you'd just do: public class MyClass&lt;T&gt;{ T myVar; } The ? syntax is used primarily when you want to give more context -- ie ? exteds SomeType
score: 1
answers question: http://stackoverflow.com/q/20703261
downvote count: 0
type: Answer

http://stackoverflow.com/q/20721091
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20721188
score: 1
has answer: http://stackoverflow.com/a/20721200
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/20721240
downvote count: 0
possible better answer: http://stackoverflow.com/a/20721188
has title: Using addMouseListener() to each label in an array?
favorite count: 0
accepted answer: http://stackoverflow.com/a/20721115
tagged with: mouselistener
upvote count: 1
tagged with: swing
answer count: 4
has answer: http://stackoverflow.com/a/20721115
has body: I am currently writing a program that has 28 labels created and arranged in a grid within a for loop and I would like to add a mouseListener to each of the labels. I can add a mouseListener to each of the labels, but when I try to specify the label number and change that label's border color, I get a "local variable is accessed from inner class needs to be declared final" error. I understand the reasoning behind this error, but I cannot make the "labelNum" variable final as it needs to change since it's in the loop. What is a workaround solution here? for (int c = 0; c &lt; 7; c++) { for (int d = 0; d &lt; 4; d++) { labelNum = c*4+d; inventorySlotLabels[labelNum] = new JLabel(); inventorySlotLabels[labelNum].setHorizontalAlignment(javax.swing.SwingConstants.CENTER); inventorySlotLabels[labelNum].setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); inventorySlotLabels[labelNum].setBounds(15+d*40+d*10, 15+c*30+c*10, 40, 30); inventorySlotLabels[labelNum].setIcon(new javax.swing.ImageIcon(getClass().getResource("Item.png"))); inventorySlotLabels[labelNum].addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { headerLabel.setText("Inventory Slot Clicked"); inventorySlotLabels[labelNum].setBorder(BorderFactory.createLineBorder(Color.WHITE)); } } } }

reactor
tags question: http://stackoverflow.com/q/20793415
tag name: reactor
type: Tag

http://stackoverflow.com/a/20803448
has comment: http://stackoverflow.com/comment/31189262
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/20803293
has comment: http://stackoverflow.com/comment/31189283
downvote count: 0
has comment: http://stackoverflow.com/comment/31189228
has body: You're clearing your Map after adding it to the List. The Map references are all thus the same (and empty)... I think you want to make this change - // resultValues.clear(); // No, if you need another Map... do this resultValues = new HashMap&lt;String, String&gt;(); Then to iterate your value List try for (HashMap&lt;String, String&gt; map : value) { for (String key : map.keySet()) { System.out.printf("key[%s] = %s\n", key, map.get(key)); } }
has comment: http://stackoverflow.com/comment/31189181
has comment: http://stackoverflow.com/comment/31189295
type: Answer

http://stackoverflow.com/comment/31061454
type: QuestionComment
has text: I solved it :) I m not shure but maybe problewm was: String table = null; Pattern tablep = Pattern.compile("(<table.* )"); Matcher tablem = tablep.matcher(page); if (tablem.find()) {table = tablem.group(1);}
comment on: http://stackoverflow.com/q/20731616
score: 0
type: Comment

http://stackoverflow.com/a/23166271
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/20772486
type: Answer
has body: Use BigInt datatype with its implicit operations Here is an example of addition BigInteger big1 = new BigInteger("1234567856656567242177779"); BigInteger big2 = new BigInteger("12345565678566567131275737372777569"); BigInteger bigSum = big1.add(big2); System.out.println(bigSum );
upvote count: 1

http://stackoverflow.com/comment/31095014
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/20748110
has text: the `ObjectProperty<TimelineState> state` property that I mentioned.

http://stackoverflow.com/a/20750146
answers question: http://stackoverflow.com/q/20750049
score: 0
has body: Using a JScrollBar, you can add a class with myScrollBar.addAdjustmentListener(this) so it will call your AdjustmentListener's adjustmentValueChanged(AdjustmentEvent e) method. In this method, use e.getValue() to get the value of the scroll bar. Interpret this value (with some good 'ol mathematics) to update the visibility/invisibility and x/y positions of your buttons! For more, read up a tutorial on JScrollBar's. Don't forget to set the orientation, min and max values, etc.
type: Answer

http://stackoverflow.com/q/20760237
has answer: http://stackoverflow.com/a/20760298
type: Question
score: 0
linked to: http://stackoverflow.com/q/7975802
answer count: 3
has comment: http://stackoverflow.com/comment/31112635
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/20760668
tagged with: jakarta-ee
has body: I have 7 textfields in my jsp which are presently being filled from a List of parameters which i get from server. By using a List I iterate parameters, which I feel gets order-dependent. Eg I have to traverse from index 0-6. So let's say later I change the order of parameters my logic will have to change and change code everytime. I thought of keeping parameters in a Map and then I will get like Map.get("xyz"). Is there a better solution to it??
tagged with: java
has answer: http://stackoverflow.com/a/20760345
has title: Using List vs Map?

http://stackoverflow.com/a/20835948
type: Answer
answers question: http://stackoverflow.com/q/20826952
score: 3
upvote count: 3
has body: I decided that I shouldn't mess with the Android standard meaning and I have chosen to let the users dismiss the keyboard if they wish to.
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/20826952

http://stackoverflow.com/q/20804704
tagged with: java
has body: Ok, so I'm kinda new to android java programming. I've been searching for an answer for quite some time now without any success. Here's an example: setAlarmHandler(difference); //(difference is in MS) public void setAlarmHandler (long difference) { Handler myHandler = new Handler(); Runnable setAlarm = new Runnable() { public void run() { System.out.println("test"); } }; // Schedule the execution myHandler.postDelayed(setAlarm, difference); } public void addListenerOnCheckBox1() { checkBox1.setOnClickListener(new OnClickListener() { public void onClick(View v) { if(checkBox1.isChecked()){ myHandler.removeCallbacks(setAlarm); } } }); } So I try to cancel the handler from "addListenerOnCheckBox1()" but I get the error "myHandler cannot be resolved". So what do I need to do to be able to cancel the handler from this method? Also, if I just ignore the "cancelling-part" (removes "myHandler.removeCallbacks(setAlarm);"), the app runs just perfect in my emulator. I'm sure the answer I'm looking for will make me feel really stupid, but I just can't make this work on my own..Any help is greatly appreciated!
type: Question
accepted answer: http://stackoverflow.com/a/20804733
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31191595
has comment: http://stackoverflow.com/comment/31192448
tagged with: handler
possible better answer: http://stackoverflow.com/a/20804902
has answer: http://stackoverflow.com/a/20804902
tagged with: android
has title: Cancel running handler
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/20804733

http://stackoverflow.com/q/20839021
upvote count: 1
accepted answer: http://stackoverflow.com/a/20842453
type: AnsweredQuestion
has title: Running accelerometer inside a service gives "Unable to create service" exception
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31255478
type: Question
has comment: http://stackoverflow.com/comment/31255771
downvote count: 0
has body: Actually I want Accelerometer to run in the background and give a message but I am getting some exceptions. Here are my all xml and java files. Please help! This is my Service Class import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.widget.Toast; public class MyService extends Service implements AccelerometerListener { private static Context mycontext; @Override public IBinder onBind(Intent arg0) { throw new UnsupportedOperationException("Not Implemented Yet"); } @Override public void onCreate() { // TODO Auto-generated method stub mycontext=MyService.this; Toast.makeText(this,"Accelerometer is starting", Toast.LENGTH_LONG); AccelerometerManager.startListening(this); } @Override public void onShake(float force) { // TODO Auto-generated method stub Toast.makeText(this,"Motion detected", Toast.LENGTH_SHORT); } @Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Toast.makeText(this,"Accelerometer is destroyed",Toast.LENGTH_LONG); AccelerometerManager.stopListening(); } public static Context getContext() { return mycontext; } @Override public void onAccelerationChanged(float x, float y, float z) { // TODO Auto-generated method stub } } MainActivity class import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } // Start the service public void startNewService(View view) { startService(new Intent(MainActivity.this, MyService.class)); } // Stop the service public void stopNewService(View view) { stopService(new Intent(MainActivity.this, MyService.class)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenu…
has answer: http://stackoverflow.com/a/20842453
has comment: http://stackoverflow.com/comment/31255230
has comment: http://stackoverflow.com/comment/31255409
tagged with: android
answer count: 1
favorite count: 0